wlmaker
Loading...
Searching...
No Matches
Functions | Variables
bordered.c File Reference
#include "bordered.h"
#include <string.h>
#include "libbase/libbase.h"
Include dependency graph for bordered.c:

Functions

static void _wlmtk_bordered_container_update_layout (wlmtk_container_t *container_ptr)
 
static wlmtk_rectangle_t_wlmtk_bordered_create_border_rectangle (wlmtk_bordered_t *bordered_ptr)
 
static void _wlmtk_bordered_destroy_border_rectangle (wlmtk_bordered_t *bordered_ptr, wlmtk_rectangle_t **rectangle_ptr_ptr)
 
static void _wlmtk_bordered_set_positions (wlmtk_bordered_t *bordered_ptr)
 
bool wlmtk_bordered_init (wlmtk_bordered_t *bordered_ptr, wlmtk_element_t *element_ptr, const wlmtk_margin_style_t *style_ptr)
 
void wlmtk_bordered_fini (wlmtk_bordered_t *bordered_ptr)
 
void wlmtk_bordered_set_style (wlmtk_bordered_t *bordered_ptr, const wlmtk_margin_style_t *style_ptr)
 
wlmtk_element_twlmtk_bordered_element (wlmtk_bordered_t *bordered_ptr)
 
static void test_init_fini (bs_test_t *test_ptr)
 
void test_rectangle_pos (bs_test_t *test_ptr, wlmtk_rectangle_t *rect_ptr, int x, int y, int width, int height)
 

Variables

static const wlmtk_container_vmt_t bordered_container_vmt
 
const bs_test_case_t wlmtk_bordered_test_cases []
 
static const wlmtk_margin_style_t test_style
 

Detailed Description

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ _wlmtk_bordered_container_update_layout()

void _wlmtk_bordered_container_update_layout ( wlmtk_container_t container_ptr)
static

Updates the layout of the bordered element.

Parameters
container_ptr

◆ _wlmtk_bordered_create_border_rectangle()

wlmtk_rectangle_t * _wlmtk_bordered_create_border_rectangle ( wlmtk_bordered_t bordered_ptr)
static

Creates a border rectangle and adds it to bordered_ptr.

◆ _wlmtk_bordered_destroy_border_rectangle()

void _wlmtk_bordered_destroy_border_rectangle ( wlmtk_bordered_t bordered_ptr,
wlmtk_rectangle_t **  rectangle_ptr_ptr 
)
static

Removes the rectangle from bordered_ptr, destroys it and NULLs it.

◆ _wlmtk_bordered_set_positions()

void _wlmtk_bordered_set_positions ( wlmtk_bordered_t bordered_ptr)
static

Updates the position of all 4 border elements.

Retrieves the position and dimensions of wlmtk_bordered_t::element_ptr and arranges the 4 border elements around it.

Parameters
bordered_ptr

◆ test_init_fini()

void test_init_fini ( bs_test_t *  test_ptr)
static

Exercises setup and teardown.

◆ test_rectangle_pos()

void test_rectangle_pos ( bs_test_t *  test_ptr,
wlmtk_rectangle_t rect_ptr,
int  x,
int  y,
int  width,
int  height 
)

Helper: Tests that the rectangle is positioned as specified.

◆ wlmtk_bordered_element()

wlmtk_element_t * wlmtk_bordered_element ( wlmtk_bordered_t bordered_ptr)

Returns the superclass wlmtk_element_t for bordered_ptr.

◆ wlmtk_bordered_fini()

void wlmtk_bordered_fini ( wlmtk_bordered_t bordered_ptr)

Un-initializes the bordered element.

Parameters
bordered_ptr

◆ wlmtk_bordered_init()

bool wlmtk_bordered_init ( wlmtk_bordered_t bordered_ptr,
wlmtk_element_t element_ptr,
const wlmtk_margin_style_t style_ptr 
)

Initializes the bordered element.

The bordered element positions the element within such that north-western corner is at (0, 0).

Parameters
bordered_ptr
element_ptr
style_ptr
Returns
true on success.

◆ wlmtk_bordered_set_style()

void wlmtk_bordered_set_style ( wlmtk_bordered_t bordered_ptr,
const wlmtk_margin_style_t style_ptr 
)

Updates the style.

Parameters
bordered_ptr
style_ptr

Variable Documentation

◆ bordered_container_vmt

const wlmtk_container_vmt_t bordered_container_vmt
static
Initial value:
= {
}
static void _wlmtk_bordered_container_update_layout(wlmtk_container_t *container_ptr)
Definition bordered.c:138

Virtual method table: wlmtk_container_t at wlmtk_bordered_t.

◆ test_style

const wlmtk_margin_style_t test_style
static
Initial value:
= {
.width = 2,
.color = 0xff000000
}

Style used for tests.

◆ wlmtk_bordered_test_cases

const bs_test_case_t wlmtk_bordered_test_cases[]
Initial value:
= {
{ 1, "init_fini", test_init_fini },
{ 0, NULL, NULL }
}
static void test_init_fini(bs_test_t *test_ptr)
Definition bordered.c:270

Unit test cases.