void select_desktop(desktop_t *d) { if (d == NULL || d == mon->desk) return; PRINTF("select desktop %s\n", d->name); if (visible) { node_t *n = first_extrema(d->root); while (n != NULL) { window_show(n->client->window); n = next_leaf(n); } n = first_extrema(mon->desk->root); while (n != NULL) { window_hide(n->client->window); n = next_leaf(n); } } mon->last_desk = mon->desk; mon->desk = d; update_current(); ewmh_update_current_desktop(); put_status(); }
void set_visibility(monitor_t *m, desktop_t *d, node_t *n, bool visible) { PRINTF("set visibilty %X: %s\n", n->client->window, BOOLSTR(visible)); if (!n->client->floating) { n->vacant = !visible; update_vacant_state(n->parent); if (visible) rotate_brother(n); else unrotate_brother(n); } if (visible) { if (m->desk == d) window_show(n->client->window); if (d->focus == NULL) { if (mon->desk == d) focus_node(m, d, n); else pseudo_focus(d, n); } } else { if (m->desk == d || n->client->sticky) window_hide(n->client->window); if (d->focus == n) { node_t *f = history_get_node(d, n); if (f == NULL) f = closest_visible(d, n); if (mon->desk == d) focus_node(m, d, f); else pseudo_focus(d, f); } } }
int main(int argc, char *argv[]) { const unsigned int width = 640; const unsigned int height = 480; struct display *display; struct window *window; display = display_open(); if (!display) { fprintf(stderr, "failed to open display\n"); return 1; } window = window_create(display, argv[0], 0, 0, width, height); if (!window) { fprintf(stderr, "failed to create window\n"); return 1; } window_show(window); event_loop(window); window_close(window); display_close(display); return 0; }
void transfer_node(monitor_t *ms, desktop_t *ds, monitor_t *md, desktop_t *dd, node_t *n) { if (n == NULL || ds == NULL || dd == NULL || ms == NULL || md == NULL || (ms == md && dd == ds)) return; PRINTF("transfer node %X\n", n->client->window); unlink_node(ds, n); insert_node(md, dd, n); ewmh_set_wm_desktop(n, dd); if (ds == ms->desk && dd != md->desk) { window_hide(n->client->window); } fit_monitor(md, n->client); if (n->client->fullscreen) window_move_resize(n->client->window, md->rectangle.x, md->rectangle.y, md->rectangle.width, md->rectangle.height); if (ds != ms->desk && dd == md->desk) { window_show(n->client->window); focus_node(md, dd, n, true); } else { focus_node(md, dd, n, false); } if (ds == ms->desk || dd == md->desk) update_current(); }
int main( int argc, char *argv[] ) { layout_t *lt, *lt2, *lt3, *lt4; bounds_t *b; object_t *rg, *btn, *fr; claro_base_init( ); claro_graphics_init( ); log_fd_set_level( CL_DEBUG, stderr ); clog( CL_INFO, "%s running using Claro!", __FILE__ ); b = new_bounds( 100, 100, 460, 230 ); w = window_widget_create( 0, b, 0 ); object_addhandler( w, "destroy", window_closed ); window_set_title( w, "Radio button example" ); lt = layout_create( w, "[][_<|set1|<|set3|<][][_<|set2|<|set4|<][]", *b, 10, 10 ); /* create a frame */ b = lt_bounds(lt,"set1"); fr = frame_widget_create_with_label( w, b, 0, "Group 1" ); lt2 = layout_create( fr, "[r1][r2][r3][_]", *b, 20, 20 ); rg = radiogroup_create( fr, 0 ); btn = radiobutton_widget_create( fr, rg, lt_bounds(lt2,"r1"), "Button 1", 0 ); btn = radiobutton_widget_create( fr, rg, lt_bounds(lt2,"r2"), "Button 2", 0 ); btn = radiobutton_widget_create( fr, rg, lt_bounds(lt2,"r3"), "Button 3", 0 ); /* create a frame */ b = lt_bounds(lt,"set2"); fr = frame_widget_create_with_label( w, b, 0, "Group 2" ); lt3 = layout_create( fr, "[r1][r2][r3][_]", *b, 20, 20 ); rg = radiogroup_create( fr, 0 ); btn = radiobutton_widget_create( fr, rg, lt_bounds(lt3,"r1"), "Button 1", 0 ); btn = radiobutton_widget_create( fr, rg, lt_bounds(lt3,"r2"), "Button 2", 0 ); btn = radiobutton_widget_create( fr, rg, lt_bounds(lt3,"r3"), "Button 3", 0 ); /* create a frame */ b = lt_bounds(lt,"set3"); fr = frame_widget_create_with_label( w, b, 0, "Group 3" ); lt4 = layout_create( fr, "[r1][r2][r3][_]", *b, 20, 20 ); btn = checkbox_widget_create_with_label( fr, lt_bounds(lt4,"r1"), 0, "Button 1" ); btn = checkbox_widget_create_with_label( fr, lt_bounds(lt4,"r2"), 0, "Button 2" ); btn = checkbox_widget_create_with_label( fr, lt_bounds(lt4,"r3"), 0, "Button 3" ); window_show( w ); window_focus( w ); block_heap_loginfo( ); claro_loop( ); return 0; }
void update_root(monitor_t *m, xcb_rectangle_t *rect) { xcb_rectangle_t last_rect = m->rectangle; m->rectangle = *rect; if (m->root == XCB_NONE) { uint32_t values[] = {XCB_EVENT_MASK_ENTER_WINDOW}; m->root = xcb_generate_id(dpy); xcb_create_window(dpy, XCB_COPY_FROM_PARENT, m->root, root, rect->x, rect->y, rect->width, rect->height, 0, XCB_WINDOW_CLASS_INPUT_ONLY, XCB_COPY_FROM_PARENT, XCB_CW_EVENT_MASK, values); xcb_icccm_set_wm_class(dpy, m->root, sizeof(ROOT_WINDOW_IC), ROOT_WINDOW_IC); window_lower(m->root); if (focus_follows_pointer) { window_show(m->root); } } else { window_move_resize(m->root, rect->x, rect->y, rect->width, rect->height); put_status(SBSC_MASK_MONITOR_GEOMETRY, "monitor_geometry 0x%08X %ux%u+%i+%i\n", m->id, rect->width, rect->height, rect->x, rect->y); } for (desktop_t *d = m->desk_head; d != NULL; d = d->next) { for (node_t *n = first_extrema(d->root); n != NULL; n = next_leaf(n, d->root)) { if (n->client == NULL) { continue; } adapt_geometry(&last_rect, rect, n); } arrange(m, d); } }
void show_desktop(desktop_t *d) { if (!visible) return; for (node_t *n = first_extrema(d->root); n != NULL; n = next_leaf(n, d->root)) window_show(n->client->window); }
struct MessageNewViewData * message_new_view_show(struct Window *win, GHashTable * options) { struct MessageNewViewData *data = g_slice_alloc0(sizeof(struct MessageNewViewData)); data->win = win; data->mode = MODE_CONTENT; data->content = NULL; data->recipients = g_ptr_array_new(); data->messages_sent = 0; if (options != NULL) { char *recipient = g_hash_table_lookup(options, "recipient"); if (recipient != NULL) { char *name = g_hash_table_lookup(options, "name"); if (!name || !*name) name = "Number"; GHashTable *properties = g_hash_table_new_full(g_str_hash, g_str_equal, free, free); g_hash_table_insert(properties, strdup("name"), strdup(name)); g_hash_table_insert(properties, strdup("number"), strdup(recipient)); g_ptr_array_add(data->recipients, properties); } } window_frame_show(win, data, frame_content_show, frame_content_hide); window_show(win); return data; }
void b_open_autowin( ) { int y, yi, w, h, mpos; int btn_w; w = 650; h = 200; yi = 30; mpos = 120; if ( autowin == 0 ) { bounds_t *b = new_bounds( -1, -1, w, h ); layout_t *lt; autowin = window_widget_create( bersirc->mainwin, b, cWindowModalDialog | cWindowCenterParent ); window_set_icon( autowin, b_icon( "bersirc" ) ); window_set_title( autowin, lang_phrase_quick( "autoconnectwin" ) ); object_addhandler( autowin, "destroy", b_autowin_killed ); object_addhandler( autowin, "closing", b_autowin_closing ); lt = layout_create( autowin, "[][_<|list|<][][{25}<|btnadd|<|btnedit|<|btndelete|<|btncancel|<][]", *b, 10, 10 ); y = 10; autowin_servlist = listview_widget_create( autowin, lt_bounds(lt,"list"), 3, 0, "", cListViewTypeCheckBox, lang_phrase_quick( "serveraddy" ), cListViewTypeText, lang_phrase_quick( "channels" ), cListViewTypeText ); btn_w = ((w-20-20)/4); btnadd = button_widget_create_with_label( autowin, lt_bounds(lt,"btnadd"), 0, lang_phrase_quick( "addserver" ) ); btnedit = button_widget_create_with_label( autowin, lt_bounds(lt,"btnedit"), 0, lang_phrase_quick( "editserver" ) ); btndelete = button_widget_create_with_label( autowin, lt_bounds(lt,"btndelete"), 0, lang_phrase_quick( "deleteserver" ) ); btncancel = button_widget_create_with_label( autowin, lt_bounds(lt,"btncancel"), 0, lang_phrase_quick( "close" ) ); // no edit or delete until selected widget_disable( OBJECT( btndelete ) ); widget_disable( OBJECT( btnedit ) ); object_addhandler( autowin_servlist, "selected", b_autowin_serversel ); object_addhandler( btnadd, "pushed", b_autowin_add ); object_addhandler( btnedit, "pushed", b_autowin_edit ); object_addhandler( btndelete, "pushed", b_autowin_delete ); object_addhandler( btncancel, "pushed", b_autowin_close ); window_show( autowin ); b_autowin_gui_init( ); } else { widget_focus( OBJECT( autowin ) ); } }
void show_presel_feedbacks(monitor_t *m, desktop_t *d, node_t *n) { if (n == NULL) { return; } else { if (n->presel != NULL) { window_show(n->presel->feedback); } show_presel_feedbacks(m, d, n->first_child); show_presel_feedbacks(m, d, n->second_child); } }
static void status_icon_pushed(object_t * status, event_t * event) { if(is_shown) { window_hide(w); is_shown = FALSE; } else { window_show(w); is_shown = TRUE; } }
void draw_presel_feedback(monitor_t *m, desktop_t *d, node_t *n) { if (n == NULL || n->presel == NULL || d->layout == LAYOUT_MONOCLE) { return; } if (focus_follows_pointer) { listen_enter_notify(d->root, false); } bool exists = (n->presel->feedback != XCB_NONE); if (!exists) { initialize_presel_feedback(n); } int gap = gapless_monocle && IS_MONOCLE(d) ? 0 : d->window_gap; presel_t *p = n->presel; xcb_rectangle_t rect = n->rectangle; rect.x = rect.y = 0; rect.width -= gap; rect.height -= gap; xcb_rectangle_t presel_rect = rect; switch (p->split_dir) { case DIR_NORTH: presel_rect.height = p->split_ratio * rect.height; break; case DIR_EAST: presel_rect.width = (1 - p->split_ratio) * rect.width; presel_rect.x = rect.width - presel_rect.width; break; case DIR_SOUTH: presel_rect.height = (1 - p->split_ratio) * rect.height; presel_rect.y = rect.height - presel_rect.height; break; case DIR_WEST: presel_rect.width = p->split_ratio * rect.width; break; } window_move_resize(p->feedback, n->rectangle.x + presel_rect.x, n->rectangle.y + presel_rect.y, presel_rect.width, presel_rect.height); if (!exists && m->desk == d) { window_show(p->feedback); } if (focus_follows_pointer) { listen_enter_notify(d->root, true); } }
struct UssdViewData * ussd_view_show(struct Window *win, GHashTable * options) { struct UssdViewData *data = g_slice_alloc0(sizeof(struct UssdViewData)); data->win = win; assert(options != NULL); data->mode = (int) g_hash_table_lookup(options, "mode"); data->message = string_replace_with_tags(g_hash_table_lookup (options, "message")); data->callback_close = g_hash_table_lookup(options, "callback_close"); data->callback_close_data = g_hash_table_lookup(options, "callback_close_data"); window_frame_show(win, data, frame_ussd_show, frame_ussd_hide); window_show(win); return data; }
monitor_t *make_monitor(xcb_rectangle_t rect) { monitor_t *m = malloc(sizeof(monitor_t)); snprintf(m->name, sizeof(m->name), "%s%02d", DEFAULT_MON_NAME, ++monitor_uid); m->prev = m->next = NULL; m->desk = m->desk_head = m->desk_tail = NULL; m->rectangle = rect; m->top_padding = m->right_padding = m->bottom_padding = m->left_padding = 0; m->wired = true; m->num_sticky = 0; uint32_t mask = XCB_CW_EVENT_MASK; uint32_t values[] = {XCB_EVENT_MASK_ENTER_WINDOW}; m->root = xcb_generate_id(dpy); xcb_create_window(dpy, XCB_COPY_FROM_PARENT, m->root, root, rect.x, rect.y, rect.width, rect.height, 0, XCB_WINDOW_CLASS_INPUT_ONLY, XCB_COPY_FROM_PARENT, mask, values); window_lower(m->root); if (focus_follows_pointer) window_show(m->root); return m; }
struct ContactDeleteViewData * contact_delete_view_show(struct Window *win, GHashTable * options) { struct ContactDeleteViewData *data = g_slice_alloc0(sizeof(struct ContactDeleteViewData)); data->win = win; if (options == NULL) { g_error("At least option[id] must be set."); } else { data->id = (int) g_hash_table_lookup(options, "id"); data->callback = g_hash_table_lookup(options, "delete_callback"); data->callback_data = g_hash_table_lookup(options, "delete_callback_data"); } window_frame_show(win, data, frame_delete_show, frame_delete_hide); window_show(win); return data; }
void desktop_flush(){ /* 桌面刷新重绘 */ image_view_reshow(Desktop_im); /* 所有图标重绘 */ for(int i=0;i<app_number;i++){ struct shortcut* sh = vector_at(&sh_desktop_vector, i); shortcut_repaint(sh); shortcut_show(sh); } if(save_window!=NULL){ window_repaint(save_window); window_show(save_window); } if(save_text_line!=NULL){ text_line_repaint(save_text_line); text_line_show(save_text_line); } if(save_button!=NULL){ button_repaint(save_button); button_show(save_button); } }
int main( int argc, char *argv[] ) { claro_base_init( ); claro_graphics_init( ); log_fd_set_level( CL_DEBUG, stderr ); clog( CL_INFO, "%s running using Claro!", __FILE__ ); w = window_widget_create( 0, new_bounds( 100, 100, 230, 230 ), cWidgetCustomDraw ); window_set_title( w, "Hello, World!" ); /* t = textbox_widget_create( w, new_bounds( 10, 10, 210, -1 ), 0 ); widget_set_notify( WIDGET(t), cNotifyKey ); textbox_set_text( t, "Yeehaw!" ); */ b = button_widget_create( w, new_bounds( 0, 0, 230, -1 ), 0 ); button_set_text( b, "Close me!" ); object_addhandler( b, "pushed", push_my_button ); #ifndef NO_CAIRO c = canvas_widget_create( w, new_bounds( 15, 30, 200, 200 ), 0 ); object_addhandler(OBJECT(c), "redraw", handle_redraw ); /* add our main loop */ object_addhandler( claro, "mainloop", handle_main ); #endif window_show( w ); window_focus( w ); block_heap_loginfo( ); claro_loop( ); return 0; }
int main( int argc, char *argv[] ) { object_t *w; layout_t *lt; object_t *btn = NULL; bounds_t *b = NULL; claro_base_init( ); claro_graphics_init( ); //log_fd_set_level( CL_DEBUG, stderr ); clog( CL_INFO, "%s running using Claro!", __FILE__ ); b = new_bounds(50, 50, 300, 300); w = window_widget_create(NULL, b, 0); window_set_title(w, "Canvas Speed Test"); object_addhandler(w, "destroy", window_closed); lt = layout_create(w, "[][_<a|canvas|>a][]", *b, 10, 10 ); assert(lt != NULL && "layout was failed to parse"); c = (widget_t *)canvas_widget_create( w, lt_bounds(lt, "canvas"), 0 ); object_addhandler( OBJECT(c), "redraw", handle_redraw ); object_addhandler( OBJECT(c), "clicked", handle_mousedown ); object_addhandler( OBJECT(c), "released", handle_mouseup ); object_addhandler( OBJECT(c), "mouse_moved", handle_mousemove ); window_show( w ); window_focus( w ); claro_loop( ); return 0; }
int main(int argc, char *argv[]) { struct window *window; window = window_create(0, 0, 640, 480); if (!window) { fprintf(stderr, "window_create() failed\n"); return 1; } window_show(window); while (true) { if (!window_event_loop(window)) break; window_draw(window); } window_close(window); return 0; }
int main(int argc, char *argv[]) { claro_base_init(); claro_graphics_init(); types = g_hash_table_new(g_str_hash, g_str_equal); log_fd_set_level(CL_DEBUG, stderr); clog(CL_INFO, "%s running using Claro!", __FILE__); w = window_widget_create(0, new_bounds(100, 100, 230, 100), 0); object_addhandler(w, "destroy", window_closed); window_set_title(w, "Cursor Types"); c = combo_widget_create(w, new_bounds(10, 10, 210, -1), 0); object_addhandler(c, "selected", combo_selected); list_item_t * item = COMBO_APPEND(c, cCursorNormal); combo_select_item(c, item); COMBO_APPEND(c, cCursorTextEdit); COMBO_APPEND(c, cCursorWait); COMBO_APPEND(c, cCursorPoint); window_show(w); window_focus(w); block_heap_loginfo(); claro_loop(); g_hash_table_destroy(types); return 0; }
void parse_pushed(object_t *obj, event_t *evt) { object_t *window = NULL; bounds_t *b; object_t *lelex = NULL; size_t len; int type; lelex = (object_t *)store_get("lelex", &len, &type); assert(len == sizeof(textbox_widget_t) && type == TYPE_TEXTBOX && "invalid object in store for lelex"); // first kill the old window if it is still around window = store_take("display.window", &len, &type); if(window) { window_hide(window); event_send(window, "destroy", ""); } b = new_bounds(0,0,0,0); *b = store_get_bounds_t("window.bounds"); window = window_widget_create(NULL, b, 0); window_set_title(window, "Layout Display"); object_addhandler(window, "destroy", window_destroy_handle); object_addhandler(window, "moved", window_moved_handle); object_addhandler(window, "resized", window_moved_handle); if(!make_layout(window, b, textarea_get_text(lelex))) { event_send(window, "destroy", ""); printf("FAILED TO PARSE"); } else { store_put("display.window", window, sizeof(window_widget_t), TYPE_WINDOW); window_show( window ); window_focus( window ); } }
struct DialogViewData * dialog_view_show(struct Window *win, GHashTable * options) { struct DialogViewData *data = g_slice_alloc0(sizeof(struct DialogViewData)); data->win = win; data->type = GPOINTER_TO_INT(g_hash_table_lookup(options, "type")); // Check if type was provided gboolean type_exists = g_hash_table_lookup_extended(options, "type", NULL, NULL); assert(type_exists == TRUE); window_layout_set(win, DIALOG_FILE, "dialog"); if (data->type == PHONEGUI_DIALOG_MESSAGE_STORAGE_FULL) window_text_set(win, "content", D_ ("Your storage is full. Please delete some messages or you are not going to receive messages anymore!")); else if (data->type == PHONEGUI_DIALOG_SIM_NOT_PRESENT) window_text_set(win, "content", D_ ("GSM is not available, because no SIM card is present.")); else window_text_set(win, "content", D_("Unknown message.")); data->bt_close = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt_close, D_("Close")); evas_object_smart_callback_add(data->bt_close, "clicked", dialog_view_close_clicked, data); window_swallow(win, "button_close", data->bt_close); evas_object_show(data->bt_close); window_show(win); return data; }
void update_colors_in(node_t *n, desktop_t *d, monitor_t *m) { if (n == NULL) { return; } else { if (n->presel != NULL) { uint32_t pxl = get_color_pixel(presel_feedback_color); xcb_change_window_attributes(dpy, n->presel->feedback, XCB_CW_BACK_PIXEL, &pxl); if (d == m->desk) { /* hack to induce back pixel refresh */ window_hide(n->presel->feedback); window_show(n->presel->feedback); } } if (n == d->focus) { draw_border(n, true, (m == mon)); } else if (n->client != NULL) { draw_border(n, false, (m == mon)); } else { update_colors_in(n->first_child, d, m); update_colors_in(n->second_child, d, m); } } }
int main(int argc, char *argv[]) { image_t * img; object_t * menu; list_item_t * quit_item; claro_base_init(); claro_graphics_init(); log_fd_set_level(CL_DEBUG, stderr); clog(CL_INFO, "%s running using Claro!", __FILE__); w = window_widget_create(0, new_bounds(100, 100, 230, 230), 0); object_addhandler(w, "destroy", window_closed); window_set_title(w, "Status Icon"); menu = menu_widget_create(w, 0); quit_item = menu_append_item(menu, NULL, stock_get_image("system-log-out"), "Quit"); object_addhandler(OBJECT(quit_item), "pushed", window_closed); img = image_load(w, "icon.png"); s = status_icon_create(w, img, 0); status_icon_set_tooltip(s, "Claro - Status Icon"); status_icon_set_menu(s, menu); object_addhandler(s, "pushed", status_icon_pushed); window_show(w); window_focus(w); block_heap_loginfo(); claro_loop(); return 0; }
int main( int argc, char *argv[] ) { object_t *w, *sw, *sw2, *cw; layout_t *lt; object_t *btn; bounds_t *b = NULL; claro_base_init( ); claro_graphics_init( ); log_fd_set_level( CL_DEBUG, stderr ); clog( CL_INFO, "%s running using Claro!", __FILE__ ); b = new_bounds(50, 50, 300, 300); w = window_widget_create(NULL, b, 0); window_set_title(w, "Splitter Demo"); object_addhandler(w, "destroy", window_closed); lt = layout_create(w, "[_splitter]", *b, 10, 10 ); assert(lt != NULL && "failed to parse layout"); sw = splitter_widget_create( w, lt_bounds(lt, "splitter"), cSplitterHorizontal ); splitter_set_info( sw, cSplitterFirst, 0, 200 ); splitter_set_info( sw, cSplitterSecond, 1, 0 ); btn = button_widget_create( sw, NO_BOUNDS, 0 ); lb = btn; button_set_text(btn, "Button Left"); sw2 = splitter_widget_create( sw, NO_BOUNDS, cSplitterVertical ); splitter_set_info( sw2, cSplitterFirst, 1, 0 ); splitter_set_info( sw2, cSplitterSecond, 0, 200 ); btn = button_widget_create( sw2, NO_BOUNDS, 0 ); object_addhandler( btn, "pushed", show_button ); button_set_text(btn, "Button Top-Right"); cw = container_widget_create( sw2, NO_BOUNDS, 0 ); lt = layout_create(cw, "[_ul|(10)|ur][{10}][_ll|(10)|lr]", *b, 10, 10 ); btn = button_widget_create( cw, lt_bounds( lt, "ul" ), 0 ); object_addhandler( btn, "pushed", hide_button ); button_set_text(btn, "B-U-L"); btn = button_widget_create( cw, lt_bounds( lt, "ur" ), 0 ); button_set_text(btn, "B-U-R"); btn = button_widget_create( cw, lt_bounds( lt, "ll" ), 0 ); button_set_text(btn, "B-L-L"); btn = button_widget_create( cw, lt_bounds( lt, "lr" ), 0 ); button_set_text(btn, "B-L-R"); window_show( w ); window_focus( w ); block_heap_loginfo( ); claro_loop( ); return 0; }
int main( int argc, char *argv[] ) { object_t *window = NULL; layout_t *lt = NULL, *lt2 = NULL, *lt3 = NULL; object_t *wgt = NULL, *frm = NULL; object_t *btn = NULL; bounds_t *b = NULL; claro_base_init( ); claro_graphics_init( ); log_fd_set_level( CL_DEBUG, stderr ); clog( CL_INFO, "%s running using Claro!", __FILE__ ); b = new_bounds( 100, 100, 800, 300 ); window = window_widget_create(NULL, b, 0); window_set_title(window, "Claro Designer"); object_addhandler(window, "destroy", window_closed); lt = layout_create(window, main_layout, *b, 10, 10); assert(lt != NULL && "Failed to parse the main layout."); b = lt_bounds(lt, "lelex"); wgt = frame_widget_create_with_label(window, b, 0, "Lelex"); lt2 = layout_create(wgt, "[_lelex]", *b, 10, 10); wgt = textarea_widget_create(wgt, lt_bounds(lt2, "lelex"), 0); store_put("lelex", wgt, sizeof(textbox_widget_t), TYPE_TEXTBOX); b = lt_bounds(lt, "options"); frm = frame_widget_create_with_label(window, b, 0, "Options"); lt3 = layout_create(frm, "[chk.toolbar][chk.statusbar][_][{25}run]", *b, 20, 20); wgt = checkbox_widget_create_with_label(frm, lt_bounds(lt3, "chk.toolbar"), 0, "Has Toolbar"); object_addhandler(wgt, "changed", has_toolbar_handle); wgt = checkbox_widget_create_with_label(frm, lt_bounds(lt3, "chk.statusbar"), 0, "Has Statusbar"); object_addhandler(wgt, "changed", has_statusbar_handle); wgt = button_widget_create( frm, lt_bounds(lt3, "run"), 0 ); button_set_text( wgt, "Parse" ); object_addhandler(wgt, "pushed", parse_pushed); list_item_t *item, *sitem; image_t *img = 0; img = image_load( window, "icon.png" ); wgt = menubar_widget_create( window, 0 ); item = menubar_append_item( wgt, 0, 0, "File" ); sitem = menubar_append_item( wgt, item, img, "Test 1" ); menubar_append_item( wgt, sitem, 0, "Sub 1" ); menubar_append_item( wgt, sitem, 0, "Sub 2" ); menubar_append_item( wgt, sitem, img, "Sub 3" ); sitem = menubar_append_item( wgt, item, 0, "Test 2" ); menubar_append_item( wgt, sitem, 0, "Sub 1" ); menubar_append_item( wgt, sitem, img, "Sub 2" ); menubar_append_item( wgt, sitem, 0, "Sub 3" ); menubar_append_separator( wgt, item ); item = menubar_append_item( wgt, item, stock_get_image("system-log-out", cStockMenu), "&Quit" ); menubar_add_key_binding( wgt, item, "Q", cModifierCommand ); object_addhandler( item, "pushed", window_closed ); menubar_append_item( wgt, 0, 0, "Help" ); // and fill in our component toolbar wgt = toolbar_widget_create( window, cToolbarShowBoth ); btn = toolbar_append_icon( OBJECT(wgt), img, "Parse", "Parse the lelex" ); object_addhandler( btn, "pushed", parse_pushed ); toolbar_append_separator( OBJECT(wgt) ); btn = toolbar_append_icon( OBJECT(wgt), img, "Insert", "*shrug*" ); //toolbar_append_popup_item( OBJECT(wgt), btn, img, "I like", "*shrug*" ); //toolbar_append_popup_item( OBJECT(wgt), btn, img, "Candy", "*shrug*" ); /*btn = toolbar_add_button(wgt, "Parse", "Parse the lelex", "examples/designer/icon.png"); object_addhandler(btn, "pushed", parse_pushed); toolbar_add_button(wgt, "BT", "Button", "examples/designer/icon.png"); toolbar_add_button(wgt, "CV", "Canvas", "examples/designer/icon.png"); toolbar_add_button(wgt, "PB", "Progress", "examples/designer/icon.png"); toolbar_add_button(wgt, "LB", "Label", "examples/designer/icon.png"); toolbar_add_button(wgt, "CT", "Container", "examples/designer/icon.png"); toolbar_add_button(wgt, "TX", "Textbox", "examples/designer/icon.png");*/ status = statusbar_widget_create(window, 0); statusbar_set_text(status, "Started up"); // setup some initial last bounds for the first window b = new_bounds( 0, 200, 800, 600 ); store_put_bounds_t("window.bounds", *b); window_show( window ); window_focus( window ); claro_loop( ); return 0; }
struct MessageListViewData * message_list_view_show(struct Window *win, GHashTable * options) { g_debug("message_list_view_show()"); struct MessageListViewData *data = g_slice_alloc0(sizeof(struct MessageListViewData)); data->win = win; window_layout_set(win, MESSAGE_FILE, "list"); window_text_set(win, "title", D_("Inbox")); data->bt1 = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt1, D_("New")); evas_object_smart_callback_add(data->bt1, "clicked", message_list_view_new_clicked, data); window_swallow(win, "button_new", data->bt1); evas_object_show(data->bt1); // Options button with hover data->hv = elm_hover_add(window_evas_object_get(win)); data->bt2 = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt2, D_("Options")); evas_object_smart_callback_add(data->bt2, "clicked", my_hover_bt_1, data->hv); window_swallow(win, "button_options", data->bt2); evas_object_show(data->bt2); elm_hover_parent_set(data->hv, window_evas_object_get(win)); elm_hover_target_set(data->hv, data->bt2); data->bx = elm_box_add(window_evas_object_get(win)); elm_box_horizontal_set(data->bx, 0); elm_box_homogenous_set(data->bx, 1); evas_object_show(data->bx); data->button_answer = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->button_answer, D_("Answer")); evas_object_size_hint_min_set(data->button_answer, 130, 80); evas_object_smart_callback_add(data->button_answer, "clicked", message_list_view_answer_clicked, data); evas_object_show(data->button_answer); elm_box_pack_end(data->bx, data->button_answer); data->button_delete = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->button_delete, D_("Delete")); evas_object_size_hint_min_set(data->button_delete, 130, 80); evas_object_smart_callback_add(data->button_delete, "clicked", message_list_view_delete_clicked, data); evas_object_show(data->button_delete); elm_box_pack_end(data->bx, data->button_delete); elm_hover_content_set(data->hv, "top", data->bx); data->bt3 = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt3, D_("Show")); evas_object_smart_callback_add(data->bt3, "clicked", message_list_view_show_clicked, data); window_swallow(win, "button_show", data->bt3); evas_object_show(data->bt3); g_debug("tree init"); data->tree = etk_tree_new(); etk_tree_rows_height_set(ETK_TREE(data->tree), 80); etk_tree_mode_set(ETK_TREE(data->tree), ETK_TREE_MODE_LIST); etk_tree_headers_visible_set(ETK_TREE(data->tree), ETK_FALSE); etk_tree_multiple_select_set(ETK_TREE(data->tree), ETK_FALSE); data->col1 = etk_tree_col_new(ETK_TREE(data->tree), "Title", 300, 0.0); etk_tree_col_model_add(data->col1, etk_tree_model_edje_new(MESSAGE_FILE, "message_row")); etk_tree_build(ETK_TREE(data->tree)); Etk_Scrolled_View *scrolled_view = etk_tree_scrolled_view_get(ETK_TREE(data->tree)); etk_scrolled_view_dragable_set(ETK_SCROLLED_VIEW(scrolled_view), ETK_TRUE); etk_scrolled_view_drag_bouncy_set(ETK_SCROLLED_VIEW(scrolled_view), ETK_FALSE); etk_scrolled_view_policy_set(ETK_SCROLLED_VIEW(scrolled_view), ETK_POLICY_HIDE, ETK_POLICY_HIDE); data->container = etk_embed_new(evas_object_evas_get (window_evas_object_get(win))); etk_container_add(ETK_CONTAINER(data->container), data->tree); etk_widget_show_all(data->container); window_swallow(win, "list", etk_embed_object_get(ETK_EMBED(data->container))); ogsmd_sim_retrieve_messagebook("all", retrieve_messagebook_callback, data); window_show(win); return data; }
void manage_window(xcb_window_t win, rule_consequence_t *csq, int fd) { monitor_t *m = mon; desktop_t *d = mon->desk; node_t *f = mon->desk->focus; parse_rule_consequence(fd, csq); if (!csq->manage) { free(csq->layer); free(csq->state); window_show(win); return; } if (csq->node_desc[0] != '\0') { coordinates_t ref = {m, d, f}; coordinates_t trg = {NULL, NULL, NULL}; if (node_from_desc(csq->node_desc, &ref, &trg)) { m = trg.monitor; d = trg.desktop; f = trg.node; } } else if (csq->desktop_desc[0] != '\0') { coordinates_t ref = {m, d, NULL}; coordinates_t trg = {NULL, NULL, NULL}; if (desktop_from_desc(csq->desktop_desc, &ref, &trg)) { m = trg.monitor; d = trg.desktop; f = trg.desktop->focus; } } else if (csq->monitor_desc[0] != '\0') { coordinates_t ref = {m, NULL, NULL}; coordinates_t trg = {NULL, NULL, NULL}; if (monitor_from_desc(csq->monitor_desc, &ref, &trg)) { m = trg.monitor; d = trg.monitor->desk; f = trg.monitor->desk->focus; } } if (csq->sticky) { m = mon; d = mon->desk; f = mon->desk->focus; } if (csq->split_dir[0] != '\0' && f != NULL) { direction_t dir; if (parse_direction(csq->split_dir, &dir)) { presel_dir(m, d, f, dir); } } if (csq->split_ratio != 0 && f != NULL) { presel_ratio(m, d, f, csq->split_ratio); } node_t *n = make_node(win); client_t *c = make_client(); c->border_width = csq->border ? d->border_width : 0; n->client = c; initialize_client(n); update_floating_rectangle(n); if (c->floating_rectangle.x == 0 && c->floating_rectangle.y == 0) { csq->center = true; } c->min_width = csq->min_width; c->max_width = csq->max_width; c->min_height = csq->min_height; c->max_height = csq->max_height; monitor_t *mm = monitor_from_client(c); embrace_client(mm, c); adapt_geometry(&mm->rectangle, &m->rectangle, n); if (csq->center) { window_center(m, c); } snprintf(c->class_name, sizeof(c->class_name), "%s", csq->class_name); snprintf(c->instance_name, sizeof(c->instance_name), "%s", csq->instance_name); f = insert_node(m, d, n, f); clients_count++; put_status(SBSC_MASK_NODE_MANAGE, "node_manage %s %s 0x%X 0x%X\n", m->name, d->name, win, f!=NULL?f->id:0); if (f != NULL && f->client != NULL && csq->state != NULL && *(csq->state) == STATE_FLOATING) { c->last_layer = c->layer = f->client->layer; } if (csq->layer != NULL) { c->last_layer = c->layer = *(csq->layer); } if (csq->state != NULL) { set_state(m, d, n, *(csq->state)); c->last_state = c->state; } set_locked(m, d, n, csq->locked); set_sticky(m, d, n, csq->sticky); set_private(m, d, n, csq->private); arrange(m, d); bool give_focus = (csq->focus && (d == mon->desk || csq->follow)); if (give_focus) { focus_node(m, d, n); } else if (csq->focus) { activate_node(m, d, n); } else { stack(d, n, false); } uint32_t values[] = {CLIENT_EVENT_MASK | (focus_follows_pointer ? XCB_EVENT_MASK_ENTER_WINDOW : 0)}; xcb_change_window_attributes(dpy, win, XCB_CW_EVENT_MASK, values); if (d == m->desk) { window_show(n->id); } else { window_hide(n->id); } /* the same function is already called in `focus_node` but has no effects on unmapped windows */ if (give_focus) { xcb_set_input_focus(dpy, XCB_INPUT_FOCUS_POINTER_ROOT, win, XCB_CURRENT_TIME); } ewmh_set_wm_desktop(n, d); ewmh_update_client_list(false); free(csq->layer); free(csq->state); }
void enable_motion_recorder(void) { window_raise(motion_recorder); window_show(motion_recorder); }
void manage_window(xcb_window_t win, rule_consequence_t *csq, int fd) { monitor_t *m = mon; desktop_t *d = mon->desk; node_t *f = mon->desk->focus; parse_rule_consequence(fd, csq); if (!csq->manage) { free(csq->layer); free(csq->state); window_show(win); return; } if (csq->node_desc[0] != '\0') { coordinates_t ref = {m, d, f}; coordinates_t trg = {NULL, NULL, NULL}; if (node_from_desc(csq->node_desc, &ref, &trg) == SELECTOR_OK) { m = trg.monitor; d = trg.desktop; f = trg.node; } } else if (csq->desktop_desc[0] != '\0') { coordinates_t ref = {m, d, NULL}; coordinates_t trg = {NULL, NULL, NULL}; if (desktop_from_desc(csq->desktop_desc, &ref, &trg) == SELECTOR_OK) { m = trg.monitor; d = trg.desktop; f = trg.desktop->focus; } } else if (csq->monitor_desc[0] != '\0') { coordinates_t ref = {m, NULL, NULL}; coordinates_t trg = {NULL, NULL, NULL}; if (monitor_from_desc(csq->monitor_desc, &ref, &trg) == SELECTOR_OK) { m = trg.monitor; d = trg.monitor->desk; f = trg.monitor->desk->focus; } } if (csq->sticky) { m = mon; d = mon->desk; f = mon->desk->focus; } if (csq->split_dir[0] != '\0' && f != NULL) { direction_t dir; if (parse_direction(csq->split_dir, &dir)) { presel_dir(m, d, f, dir); } } if (csq->split_ratio != 0 && f != NULL) { presel_ratio(m, d, f, csq->split_ratio); } node_t *n = make_node(win); client_t *c = make_client(); c->border_width = csq->border ? d->border_width : 0; n->client = c; initialize_client(n); initialize_floating_rectangle(n); if (c->floating_rectangle.x == 0 && c->floating_rectangle.y == 0) { csq->center = true; } monitor_t *mm = monitor_from_client(c); embrace_client(mm, c); adapt_geometry(&mm->rectangle, &m->rectangle, n); if (csq->center) { window_center(m, c); } snprintf(c->class_name, sizeof(c->class_name), "%s", csq->class_name); snprintf(c->instance_name, sizeof(c->instance_name), "%s", csq->instance_name); f = insert_node(m, d, n, f); clients_count++; put_status(SBSC_MASK_NODE_MANAGE, "node_manage 0x%08X 0x%08X 0x%08X 0x%08X\n", m->id, d->id, win, f!=NULL?f->id:0); if (f != NULL && f->client != NULL && csq->state != NULL && *(csq->state) == STATE_FLOATING) { c->layer = f->client->layer; } if (csq->layer != NULL) { c->layer = *(csq->layer); } if (csq->state != NULL) { set_state(m, d, n, *(csq->state)); } set_hidden(m, d, n, csq->hidden); set_sticky(m, d, n, csq->sticky); set_private(m, d, n, csq->private); set_locked(m, d, n, csq->locked); arrange(m, d); uint32_t values[] = {CLIENT_EVENT_MASK | (focus_follows_pointer ? XCB_EVENT_MASK_ENTER_WINDOW : 0)}; xcb_change_window_attributes(dpy, win, XCB_CW_EVENT_MASK, values); if (d == m->desk) { show_node(d, n); } else { hide_node(d, n); } if (!csq->hidden && csq->focus) { if (d == mon->desk || csq->follow) { focus_node(m, d, n); } else { activate_node(m, d, n); } } else { stack(d, n, false); } ewmh_set_wm_desktop(n, d); ewmh_update_client_list(false); free(csq->layer); free(csq->state); }