本文整理汇总了C++中SsdWidget类的典型用法代码示例。如果您正苦于以下问题:C++ SsdWidget类的具体用法?C++ SsdWidget怎么用?C++ SsdWidget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SsdWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ssd_widget_get
const void *ssd_widget_get_data (const SsdWidget widget, const char *name) {
SsdWidget w = ssd_widget_get (widget, name);
if (!w) return NULL;
if (w->get_data) return w->get_data (w);
else return NULL;
}
示例2: ssd_widget_set_data
int ssd_widget_set_data (const SsdWidget widget, const char *name,
const void *value) {
SsdWidget w = ssd_widget_get (widget, name);
if (!w || !w->set_data) return -1;
return w->set_data(w, value);
}
示例3:
const char *ssd_widget_get_value (const SsdWidget widget, const char *name) {
SsdWidget w = widget;
if (name) w = ssd_widget_get (w, name);
if (!w) return "";
if (w->get_value) return w->get_value (w);
return w->value;
}
示例4: ssd_widget_draw_one
static void ssd_widget_draw_one (SsdWidget w, int x, int y, int height) {
RoadMapGuiRect rect;
SsdSize size;
ssd_widget_get_size (w, &size, NULL);
if (w->flags & SSD_ALIGN_VCENTER) {
y += (height - size.height) / 2;
}
w->position.x = x;
w->position.y = y;
if (size.width && size.height) {
rect.minx = x;
rect.miny = y;
rect.maxx = x + size.width - 1;
rect.maxy = y + size.height - 1;
#if 0
if (!w->parent) printf("****** start draw ******\n");
printf("draw - %s:%s x=%d-%d y=%d-%d ofset_x=%d ofset_y=%d \n", w->_typeid, w->name, rect.minx, rect.maxx, rect.miny, rect.maxy, w->offset_x, w->offset_y);
#endif
if (!RecalculateWidgets && ssd_widget_rect_in_screen(&rect))
w->draw(w, &rect, 0);
if (w->children) ssd_widget_draw (w->children, &rect, w->flags);
}
}
示例5: ssd_widget_container_size
void ssd_widget_container_size (SsdWidget dialog, SsdSize *size) {
SsdSize max_size;
/* Calculate size recurisvely */
if (dialog->parent) {
ssd_widget_container_size (dialog->parent, size);
max_size.width = size->width;
max_size.height = size->height;
} else {
max_size.width = roadmap_canvas_width ();
#ifdef TOUCH_SCREEN
max_size.height = roadmap_canvas_height ();
#else
max_size.height = roadmap_canvas_height () - roadmap_bar_bottom_height();
#endif
}
ssd_widget_get_size (dialog, size, &max_size);
if (dialog->draw) {
RoadMapGuiRect rect;
rect.minx = 0;
rect.miny = 0;
rect.maxx = size->width - 1;
rect.maxy = size->height - 1;
dialog->draw (dialog, &rect, SSD_GET_SIZE|SSD_GET_CONTAINER_SIZE);
size->width = rect.maxx - rect.minx + 1;
size->height = rect.maxy - rect.miny + 1;
}
}
示例6: ssd_generic_icon_list_dialog_show
void ssd_generic_icon_list_dialog_show(
const char* title,
int count,
const char** labels,
const void** values,
const char** icons,
const int* flags,
PFN_ON_ITEM_SELECTED on_item_selected,
PFN_ON_ITEM_SELECTED on_item_deleted,
void* context,
const char* left_softkey_text,
SsdSoftKeyCallback left_softkey_callback,
int list_height,
int dialog_flags,
BOOL add_next_button)
{
static SsdListContext list_context;
SsdWidget list;
int list_flags = 0;
#if defined (OPENGL)
/*
* Borders are fast in OPENGL
*/
list_flags |= SSD_ALIGN_CENTER|SSD_CONTAINER_BORDER|SSD_ROUNDED_CORNERS|SSD_ROUNDED_WHITE;
#endif // OPENGL
list_context.on_item_selected= on_item_selected;
list_context.on_item_deleted = on_item_deleted;
list_context.context = context;
list_context.left_softkey_callback = left_softkey_callback;
if ( !ssd_dialog_exists( SSD_GEN_LIST_DLG_NAME ) )
{
GenericList = ssd_dialog_new ( SSD_GEN_LIST_DLG_NAME, "", on_dialog_closed, SSD_CONTAINER_TITLE|dialog_flags);
list = ssd_list_new ("list", SSD_MAX_SIZE, SSD_MAX_SIZE, inputtype_none, 0, NULL);
ssd_widget_add (GenericList, list);
}
else{
GenericList->flags &= ~SSD_HEADER_BLACK;
GenericList->flags |= dialog_flags;
}
ssd_widget_set_offset(GenericList,0,0);
list = ssd_widget_get (GenericList, "list");
GenericList->set_value (GenericList->parent, title);
ssd_widget_set_context (GenericList, &list_context);
ssd_widget_reset_cache (list->parent);
ssd_widget_reset_position(GenericList);
ssd_list_resize ( list, list_height );
ssd_list_populate (list, count, labels, values,icons,flags, list_callback, del_callback, add_next_button);
ssd_widget_set_left_softkey_text(GenericList, left_softkey_text);
if (left_softkey_callback != NULL)
ssd_widget_set_left_softkey_callback(GenericList, list_left_softkey_callback);
ssd_dialog_activate (SSD_GEN_LIST_DLG_NAME, NULL);
ssd_dialog_draw();
}
示例7: roadmap_messagebox
void roadmap_messagebox (const char *title, const char *text) {
SsdWidget dialog = ssd_dialog_activate ("message_box", NULL);
title = roadmap_lang_get (title);
text = roadmap_lang_get (text);
if (!dialog) {
create_messagebox ();
dialog = ssd_dialog_activate ("message_box", NULL);
}
dialog->set_value (dialog, title);
ssd_widget_set_value (dialog, "text", text);
kill_messagebox_timer ();
ssd_dialog_draw ();
}
示例8: ssd_confirm_dialog_custom
void ssd_confirm_dialog_custom (const char *title, const char *text, BOOL default_yes, ConfirmDialogCallback callback, void *context,const char *textYes, const char *textNo) {
SsdWidget dialog;
confirm_dialog_context *data =
(confirm_dialog_context *)calloc (1, sizeof(*data));
data->default_yes = default_yes;
dialog = ssd_dialog_activate ("confirm_dialog", NULL);
title = roadmap_lang_get (title);
text = roadmap_lang_get (text);
if (!dialog) {
create_confirm_dialog (default_yes,textYes,textNo);
dialog = ssd_dialog_activate ("confirm_dialog", NULL);
}
else{
#ifdef TOUCH_SCREEN
//set button text & softkeys
SsdWidget buttonYes;
SsdWidget buttonNo;
buttonYes = ssd_widget_get(dialog, roadmap_lang_get ("Yes")); // change the buttons to custom text
ssd_button_change_text(buttonYes, textYes);
buttonNo = ssd_widget_get(dialog, roadmap_lang_get ("No"));
ssd_button_change_text(buttonNo, textNo);
#else //Non touch
set_soft_keys(dialog, textYes, textNo); // change softkeys text to custom text
ssd_dialog_refresh_current_softkeys();
#endif
}
if (title[0] == 0){
ssd_widget_hide(ssd_widget_get(dialog, "title_bar"));
}
else{
ssd_widget_show(ssd_widget_get(dialog, "title_bar"));
}
data->callback = callback;
data->context = context;
dialog->set_value (dialog, title);
ssd_widget_set_value (dialog, "text", text);
dialog->context = data;
ssd_dialog_draw ();
}
示例9: ssd_generic_list_dialog_show
void ssd_generic_list_dialog_show(const char* title,
int count,
const char** labels,
const void** values,
PFN_ON_ITEM_SELECTED on_item_selected,
PFN_ON_ITEM_SELECTED on_item_deleted,
void* context,
int list_height )
{
static SsdListContext list_context;
SsdWidget list;
int flags = 0;
#if defined (OPENGL)
/*
* Borders are fast in OPENGL
*/
flags |= SSD_ALIGN_CENTER|SSD_CONTAINER_BORDER|SSD_ROUNDED_CORNERS|SSD_ROUNDED_WHITE;
#endif // OPENGL
list_context.on_item_selected= on_item_selected;
list_context.on_item_deleted = on_item_deleted;
list_context.context = context;
list_context.left_softkey_callback = NULL;
if (!GenericList)
{
GenericList = ssd_dialog_new ( SSD_GEN_LIST_DLG_NAME, "", on_dialog_closed,
SSD_CONTAINER_TITLE);
ssd_dialog_add_vspace (GenericList, 5, 0);
list = ssd_list_new ("list", ssd_container_get_width(), SSD_MAX_SIZE, inputtype_none, flags, NULL);
ssd_widget_add (GenericList, list);
}
list = ssd_widget_get (GenericList, "list");
ssd_widget_set_offset(GenericList,0,0);
ssd_widget_set_left_softkey_text(GenericList, roadmap_lang_get("Exit_key"));
ssd_widget_set_left_softkey_callback(GenericList, NULL);
GenericList->set_value (GenericList->parent, title);
ssd_widget_set_context (GenericList, &list_context);
ssd_widget_reset_cache (list->parent);
ssd_widget_reset_position(GenericList);
ssd_list_resize ( list, list_height );
ssd_list_populate (list, count, labels, values, NULL, NULL, list_callback, del_callback, FALSE);
ssd_dialog_activate ( SSD_GEN_LIST_DLG_NAME, NULL );
ssd_dialog_draw();
}
示例10: ssd_widget_free_node
/*******************************************************
* Deallocates the widget node only
*/
static void ssd_widget_free_node( SsdWidget widget )
{
/*
* Release the widget itself
*/
if ( widget->release )
{
widget->release( widget );
}
free( (char*) widget->name );
free( widget );
}
示例11: ssd_widget_pointer_up_force_click
int ssd_widget_pointer_up_force_click (SsdWidget widget,
const RoadMapGuiPoint *point) {
int ret_val = 0;
int movement = ABS_POINTS_DISTANCE( PressedPointerPoint, *point );
if ( widget->force_click &&
ssd_widget_contains_point( widget, point, TRUE ) &&
( movement < FORCE_CLICK_MOVEMENT_THRESHOLD ) )
{
if ( widget->long_click && roadmap_pointer_long_click_expired() )
{
ret_val = widget->long_click( widget, point );
}
else
{
if ( widget->short_click )
ret_val = widget->short_click( widget, point );
}
widget->force_click = FALSE;
}
// TODO :: Check return value
return 1;
}
示例12: ssd_button_on_key_pressed
static BOOL ssd_button_on_key_pressed (SsdWidget button, const char* utf8char, uint32_t flags)
{
struct ssd_button_data *data = (struct ssd_button_data *) button->data;
if (data->state == BUTTON_STATE_DISABLED)
return FALSE;
if( KEY_IS_ENTER )
{
button->callback(button, SSD_BUTTON_SHORT_CLICK);
return TRUE;
}
return FALSE;
}
示例13: get_size
static void get_size(SsdWidget w, SsdSize * pack_size, RoadMapGuiRect * max_size){
if (!(w->flags & SSD_VAR_SIZE) && w->children) {
RoadMapGuiRect container_rect = *max_size;
int container_width;
int container_height;
w->draw (w, max_size, SSD_GET_SIZE);
container_width = max_size->minx - container_rect.minx +
container_rect.maxx - max_size->maxx;
container_height = max_size->miny - container_rect.miny +
container_rect.maxy - max_size->maxy;
calc_pack_size (w->children, max_size, pack_size);
pack_size->width += container_width;
pack_size->height += container_height;
} else {
w->draw (w, max_size, SSD_GET_SIZE);
pack_size->width = max_size->maxx - max_size->minx + 1;
pack_size->height = max_size->maxy - max_size->miny + 1;
}
}
示例14: ssd_widget_on_key_pressed
BOOL ssd_widget_on_key_pressed( SsdWidget w, const char* utf8char, uint32_t flags)
{
SsdWidget child;
if(w->key_pressed && w->key_pressed( w, utf8char, flags))
return TRUE;
child = w->children;
while( child)
{
if( ssd_widget_on_key_pressed( child, utf8char, flags))
return TRUE;
child = child->next;
}
return FALSE;
}
示例15: on_key
static BOOL on_key( void* context, const char* utf8char, uint32_t flags)
{
SsdWidget editbox = ssd_widget_get( s_dialog, s_editbox_name);
return editbox->key_pressed( editbox, utf8char, flags);
}