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; }
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[]) { 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[]) { 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; }
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; }