user input/app architecture

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

 



Hello,

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
displayed.

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
keystrokes.

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
callback...

GtkBindingSet *binding_set =
gtk_binding_set_new("my_binding_set");

gtk_binding_entry_add_signal(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_ORIENTATION_VERTICAL );
gtk_toolbar_set_icon_size ( (GtkToolbar *)toolbar ,
GTK_ICON_SIZE_SMALL_TOOLBAR );
gtk_toolbar_set_style ( (GtkToolbar *)toolbar ,
GTK_TOOLBAR_ICONS );

GtkToolItem * gtkimg = gtk_tool_button_new_from_stock
( GTK_STOCK_CUT );
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
done?

Max S. 

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux