Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
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 ) );
	}
}
Ejemplo n.º 3
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;
}
Ejemplo n.º 4
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;
}
Ejemplo n.º 5
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 );
	}
}
Ejemplo n.º 6
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;
}
Ejemplo n.º 7
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;
}
Ejemplo n.º 8
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;
}
Ejemplo n.º 9
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;
}
Ejemplo n.º 10
0
int main(int argc, char ** argv)
{

	object_t *w, *f; 
	layout_t *lt, *lt2;
	bounds_t *b, *b2;
	
	object_t *btnSetText, *rbLeftJustify, *rbCenterJustify, *rbRightJustify, *rbFillJustify;
	object_t *rg, *btnQuit;  
	
	int y = 10, x= 10; 
	
   claro_base_init();
	claro_graphics_init();

	// create objects 	
	w = window_widget_create(0, new_bounds(100,100,500, 200) , 0); 
   lt = layout_create(w, 	"[{10}]"
   									"[{35}text|(5)|set]"
   									"[{5}]"
   									"[{35}lj|cj|rj|fj]"
   									"[{5}]"
   									"[{50}fr]"
   									"[{5}]"
   									"[{35}quit]"
   									"[{10}]"
   									, *b, 10,10);

	txtEntry = textbox_widget_create(w, lt_bounds(lt, "text"), 0);     
   btnSetText = button_widget_create_with_label(w, lt_bounds(lt, "set"), 0,"Set Text");
 
 	b2 = lt_bounds(lt, "fr"); 
 	f = frame_widget_create_with_label(w, b2, 0, "Label Test Area");
 	lt2 = layout_create(f, "[{5}][_label][{5}]", *b2, 10,10);
 	lblText = label_widget_create(f, lt_bounds(lt2, "label"), 0); 
 	 	
   rg = radiogroup_create(w,0);   
   rbLeftJustify = radiobutton_widget_create(w, rg, lt_bounds(lt, "lj"), "Left Justify",0); 
   rbCenterJustify = radiobutton_widget_create(w, rg, lt_bounds(lt, "cj"), "Center Justify",0);
   rbRightJustify = radiobutton_widget_create(w, rg, lt_bounds(lt, "rj"), "Right Justify",0);
	rbFillJustify = radiobutton_widget_create(w, rg, lt_bounds(lt, "fj"), "Fill Justify",0);
     
	btnQuit = button_widget_create_with_label(w, lt_bounds(lt, "quit"), 0, "Quit"); 
	
	// set up handlers 
	object_addhandler(w, "destroy", window_closed);
	object_addhandler(btnQuit, "pushed", window_closed);
	
	object_addhandler(btnSetText, "pushed", handle_set_text);   
	object_addhandler_interface(rbLeftJustify, "selected", handle_justify, (void*)cLabelLeft); 
	object_addhandler_interface(rbCenterJustify, "selected", handle_justify, (void*)cLabelCenter);
	object_addhandler_interface(rbRightJustify, "selected", handle_justify, (void*)cLabelRight);
	object_addhandler_interface(rbFillJustify, "selected", handle_justify, (void*)cLabelFill);
	
	
	// set things 
	window_set_title(w, "Label Test"); 
	
	 		
	window_show(w); 
	window_focus(w); 
			
	claro_loop(); 

    return 0;
}
Ejemplo n.º 11
0
void create_autoeditwin( list_item_t *item )
{
	int w, h, btn_w;
	char *srv_title, *chan_title, *srv_text, *chn_text;
	int text_w, c;
	object_t *aew_lbl_server, *aew_lbl_channels;
	layout_t *lt;
	bounds_t *b;
	char lt_str[512];
	int enable = 1;
	
	aew_edit_item = item;
	
	w = 400;
	h = 150;
	btn_w = (w-20-(10*(2-1))) / 2;
	
	b = new_bounds( -1, -1, w, h );
	autoeditwin = window_widget_create( bersirc->mainwin, b, cWindowModalDialog | cWindowCenterParent );
	window_set_icon( autoeditwin, b_icon("bersirc") );
	window_set_title( autoeditwin, lang_phrase_quick( (item==0?"addserver_t":"editserver_t") ) );
	object_addhandler( autoeditwin, "destroy", b_autoeditwin_killed );
	
	// input
	
	srv_title = lang_phrase_quick( "serveraddy_inp" );
	chan_title = lang_phrase_quick( "channels_inp" );
	
	srv_text = "";
	chn_text = "";
	
	if ( item != 0 )
	{
		int *ip = item->data[0];
		enable = *ip;
		srv_text = item->data[1];
		chn_text = item->data[2];
	}
	
	text_w = widget_font_string_width( bersirc->mainwin, srv_title, strlen( srv_title ) );
	c = widget_font_string_width( bersirc->mainwin, chan_title, strlen( chan_title ) );
	if ( c > text_w )
		text_w = c;
	
	sprintf( lt_str, "[][{25}<|(%d)lblserver|<|txtserver|<][][{25}<|(%d)lblchannels|<|txtchannels|<]"
					 "[][{25}<|enabled|<][][{25}<|btnsave|<|btncancel|<]", text_w, text_w );
	lt = layout_create( autoeditwin, lt_str, *b, 10, 10 );
	
	aew_lbl_server = label_widget_create_with_text( autoeditwin, lt_bounds(lt,"lblserver"), 0, srv_title );
	aew_txt_server = textbox_widget_create( autoeditwin, lt_bounds(lt,"txtserver"), 0 );
	textbox_set_text( aew_txt_server, srv_text );
	
	aew_lbl_channels = label_widget_create_with_text( autoeditwin, lt_bounds(lt,"lblchannels"), 0, chan_title );
	aew_txt_channels = textbox_widget_create( autoeditwin, lt_bounds(lt,"txtchannels"), 0 );
	textbox_set_text( aew_txt_channels, chn_text );
	
	object_addhandler( autoeditwin, "dialog_ok", b_autoeditwin_save );
	object_addhandler( aew_txt_server, "changed", b_autoeditwin_txtchanged );
	
	widget_focus( aew_txt_server );
	
	aew_cbx_enabled = checkbox_widget_create_with_label( autoeditwin, lt_bounds(lt,"enabled"), 0, lang_phrase_quick( "autoitemenable" ) );
	checkbox_set_checked( aew_cbx_enabled, enable );
	
	// buttons
	
	aw_btnsave = button_widget_create_with_label( autoeditwin, lt_bounds(lt,"btnsave"), 0, lang_phrase_quick( "save" ) );
	aw_btncancel = button_widget_create_with_label( autoeditwin, lt_bounds(lt,"btncancel"), 0, lang_phrase_quick( "cancel" ) );
	
	object_addhandler( aw_btnsave, "pushed", b_autoeditwin_save );
	object_addhandler( aw_btncancel, "pushed", b_autoeditwin_close );
	
	if ( item == 0 )
		widget_disable( OBJECT( aw_btnsave ) );
	
	window_show( autoeditwin );
}
Ejemplo n.º 12
0
int main(int argc, char ** argv)
{

	object_t *w, *bQuit;
	
	object_t *cA, *lStatusA, *bChangeTextA, *bToggleCheckedA; 
	object_t *cB, *lStatusB, *bChangeTextB, *bToggleCheckedB;
	object_t *lA, *lB, *lC, *lD; 
	  
	layout_t *lt;
	bounds_t *b;
		
	claro_base_init();
	claro_graphics_init();

	// window
		// objects 
		w = window_widget_create(0, new_bounds(100,100,800, 230) , 0);
		b = new_bounds(100,100,800,230);
		 
     	lt = layout_create(w,	"[{20}]"
   												"[{25}<bleh|(5)|lA|(5)|(125)lStatusA|(5)]"
   												"[{35}<bleh|(5)|(125)bChangeTextA|(5)|(125)bToggleCheckedA|(5)|(525)cA|(5)]"
   												"[{30}]"
   												"[{25}<bleh|(5)|lB|(5)|(125)lStatusB|(5)]"
   												"[{35}<bleh|(5)|(125)bChangeTextB|(5)|(125)bToggleCheckedB|(5)|(525)cB|(5)]"
   												"[{20}]"
   												"[{35}bQuit]"
   												"[{5}]"
   												, *b, 0,0);

		bQuit = button_widget_create_with_label(w, lt_bounds(lt, "bQuit"), 0, "Quit"); 
		
		// events 
		object_addhandler(bQuit, "pushed", close_window); 
		object_addhandler(w, "destroy", close_window);
   							
 
		
	// checkbox A
		// objects 
		lA = label_widget_create_with_text(w,lt_bounds(lt, "lA"),0, "Checkbox A (checkbox_widget_create_with_text()) :");
		lStatusA = label_widget_create_with_text(w,lt_bounds(lt, "lStatusA"),0, "Not Checked");
	 	
		bChangeTextA = button_widget_create_with_label(w, lt_bounds(lt, "bChangeTextA"), 0, "Change Text");
		bToggleCheckedA = button_widget_create_with_label(w, lt_bounds(lt, "bToggleCheckedA"), 0, "Toggle Checked");
		cA = checkbox_widget_create_with_label(w, lt_bounds(lt, "cA"), 0, "Checkbox A");
		
		// events 
		object_addhandler_interface(bChangeTextA, "pushed", bChangeText_pushed, cA);	// change text 
		object_addhandler_interface(bToggleCheckedA, "pushed", bToggleChecked_pushed, cA);	// toggle
		object_addhandler_interface(cA, "changed", cCheck_changed, lStatusA);
	
	// checkbox B
		// objects 
		lB = label_widget_create_with_text(w,lt_bounds(lt, "lB"),0, "Checkbox B (checkbox_widget_create()) :");
		lStatusB = label_widget_create_with_text(w,lt_bounds(lt, "lStatusB"),0, "Not Checked");
	 	
		bChangeTextB = button_widget_create_with_label(w, lt_bounds(lt, "bChangeTextB"), 0, "Change Text");
		bToggleCheckedB = button_widget_create_with_label(w, lt_bounds(lt, "bToggleCheckedB"), 0, "Toggle Checked");
		cB = checkbox_widget_create(w, lt_bounds(lt, "cB"), 0); 
		
		// events 
		object_addhandler_interface(bChangeTextB, "pushed", bChangeText_pushed, cB);	// change text 
		object_addhandler_interface(bToggleCheckedB, "pushed", bToggleChecked_pushed, cB);	// toggle
		object_addhandler_interface(cB, "changed", cCheck_changed, lStatusB);
 

	
	// set things 
	window_set_title(w, "Checkbox Test");
	 		
	window_show(w); 
	window_focus(w); 
			
	claro_loop(); 

    return 0;
}