user input/app architecture


I've been trying now for several days to understand how to properly
manage user input and build a 'proper' gtk app.

I am writing a CAD like program, by 'CAD like' I mean a series of
widgets surrounding a drawing area where some data is being graphically
displayed. The purpose of the surrounding widgets is to facilitate the
manipulation of this data.

I've built the drawing and data management routines, and am now working
on getting user input to switch between tools, and edit the data being

My first question is regarding keyboard input. My first attempt to
realize keyboard input was to capture keystrokes, but doing so caused
problems with the mouse events. Mainly click events coming out as

My second attempt is to use key-bindings. I've done the following
bellow, but can't figure out how to have this binding trigger a

	GtkBindingSet *binding_set =

		gdk_keyval_from_name(t"Escape"), 0, "my_funkey_key", 0);

The second question I have is in regard to toolbars. I've build a
vertical toolbar as shown:

	GtkWidget * toolbar = gtk_toolbar_new ();

	gtk_toolbar_set_orientation( (GtkToolbar *)toolbar ,
	gtk_toolbar_set_icon_size ( (GtkToolbar *)toolbar ,
	gtk_toolbar_set_style ( (GtkToolbar *)toolbar ,

	GtkToolItem * gtkimg = gtk_tool_button_new_from_stock
	gtk_toolbar_insert( GTK_TOOLBAR(toolbar) , gtkimg , -1 );

	gtkimg = gtk_tool_button_new_from_stock ( GTK_STOCK_COPY );
	gtk_toolbar_insert( GTK_TOOLBAR(toolbar) , gtkimg , -1 );

	gtkimg = gtk_tool_button_new_from_stock ( GTK_STOCK_PASTE ) ;
	gtk_toolbar_insert( GTK_TOOLBAR(toolbar) , gtkimg , -1 ) ;

How can I make the tools mutually exclusive?
To better manage the events I've been looking at gtkaction, but like the
key-bindings I don't understand how they are to be used...

Could somebody help me understand how this type of app is supposed to be

Max S.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]