wlmaker
|
#include "menu_item.h"
#include <libbase/libbase.h>
#include "config.h"
#include "toolkit/toolkit.h"
Classes | |
struct | _wlmaker_menu_item_t |
Enumerations | |
enum | wlmaker_menu_item_state_t { WLMAKER_MENU_ITEM_STATE_UNDEFINED = 0 , WLMAKER_MENU_ITEM_STATE_DISABLED , WLMAKER_MENU_ITEM_STATE_ENABLED , WLMAKER_MENU_ITEM_STATE_SELECTED } |
Variables | |
const bs_test_case_t | wlmaker_menu_item_test_cases [] |
static const wlmaker_menu_item_descriptor_t | test_descriptor |
static const wlmtk_style_fill_t | test_fill |
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.
State of a menu item.
|
static |
Verifies the contains function.
|
static |
Verifies the menu item is drawn as desired.
bs_dllist_node_t * wlmaker_dlnode_from_menu_item | ( | wlmaker_menu_item_t * | item_ptr | ) |
Cast: Returns the a pointer to the bs_dllist_node_t
of |item_ptr|.
item_ptr |
bool wlmaker_menu_item_contains | ( | const wlmaker_menu_item_t * | menu_item_ptr, |
double | x, | ||
double | y ) |
Returns whether the menu item contains |x|, |y|.
This is satisfied if |x| is in [item.x, item.x + width) and |y| is in [item.y, item.y + height).
menu_item_ptr | |
x | |
y |
wlmaker_menu_item_t * wlmaker_menu_item_create | ( | const wlmaker_menu_item_descriptor_t * | desc_ptr, |
void * | callback_ud_ptr ) |
Creates a menu item from the given descriptor.
desc_ptr | |
callback_ud_ptr | Argument to provide to item's callbacks. |
wlmaker_menu_item_t
or NULL on error. Must be destroyed by calling wlmaker_menu_item_destroy(). void wlmaker_menu_item_destroy | ( | wlmaker_menu_item_t * | menu_item_ptr | ) |
Destroys a menu item previously created by wlmaker_menu_item_create().
menu_item_ptr |
void wlmaker_menu_item_draw | ( | wlmaker_menu_item_t * | menu_item_ptr, |
cairo_t * | cairo_ptr ) |
Draws the menu item. Uses the position and size set previously.
menu_item_ptr | |
cairo_ptr |
void wlmaker_menu_item_execute | ( | const wlmaker_menu_item_t * | menu_item_ptr | ) |
Executes the action associated with the menu item, ie. call the callback.
menu_item_ptr |
wlmaker_menu_item_t * wlmaker_menu_item_from_dlnode | ( | bs_dllist_node_t * | dlnode_ptr | ) |
Cast: Returns the wlmaker_menu_item_t
holding the |dlnode_ptr|.
dlnode_ptr |
void wlmaker_menu_item_get_desired_size | ( | const wlmaker_menu_item_t * | menu_item_ptr, |
uint32_t * | width_ptr, | ||
uint32_t * | height_ptr ) |
Retrieves the desired size by the menu item.
This provides the size sufficient to show the full menu item information. If the menu opts to draw the item with a smaller size, some information may be omitted, eg. the label might get clipped.
menu_item_ptr | |
width_ptr | May be NULL. |
height_ptr | May be NULL. |
bool wlmaker_menu_item_redraw_needed | ( | const wlmaker_menu_item_t * | menu_item_ptr | ) |
Returns whether the menu item should be redrawn.
This is the case when the state becomes different from the drawn state.
menu_item_ptr |
void wlmaker_menu_item_set_focus | ( | wlmaker_menu_item_t * | menu_item_ptr, |
bool | focussed ) |
Sets the pointer focus state of the menu item (show as selected).
menu_item_ptr | |
focussed |
void wlmaker_menu_item_set_position | ( | wlmaker_menu_item_t * | menu_item_ptr, |
uint32_t | x, | ||
uint32_t | y ) |
Sets the size of this menu item, relative to the cairo_t
it will draw in.
menu_item_ptr | |
x | |
y |
void wlmaker_menu_item_set_size | ( | wlmaker_menu_item_t * | menu_item_ptr, |
uint32_t | width, | ||
uint32_t | height ) |
Sets the size of the menu item. Will be used throughout subsequent draw operations.
menu_item_ptr | |
width | |
height |
|
static |
Descriptor of the menu item used in the unit test.
|
static |
Properties of the fill, used for the unit test.
const bs_test_case_t wlmaker_menu_item_test_cases[] |
Unit tests.