General tips about GTK+ programming



Hello, everybody

I'm a new programming in GTK+ (especially under C). Before, I've used
GTKmm with C++ style, and everything was clear till now. I've read
many GTK sources, made by people, and found, that there isn't any
general rule of GUI program creation. Let me explain, what I want.

In GTKmm, I've created a class (Gtk::Window), make public and private
methods, also put there some data, I want to display (that data was
wrapped inside other classes and etc). I didn't use global variables.
If I need to show options dialog window, I've created derived class
(OptionsWindow), and use it, for example in MainWindow class. So, I
think it helps me with navigating inside my sources and make the code
clearer. Main function was too little: i18n, gtkinit, mainwindow
creation, gtkrun.

In GTK world, there are no specific rules, or maybe I didn't find good
one. I saw sources larger than 100-200 kb. They also contains all the
windows, signals, internal data. Some of them has functions like "void
create_gui();", other create main windows as usual "GtkWidget*
create_main_window()".

I've even read some books and tutorials about GTK. And there are also
one file, which creates all, programmer needed. Yes, I saw some
examples named as "Widget Creation". But nobody creates window
widgets. Maybe you know why?

And the last question, for example, I have data, I want to use in GUI.
How should I write or manipulate with it? Should I create it as
structure, derived from GObject? or I have to use global (or static)
objects. and where should I initialize it?

I hope I didn't make you boring. Thank everybody in advance, who will
help me with advices, tips, maybe links and clear sources. I want to
have a general view of GTK programming and rewrite my C++ game made by
GTKmm to GTK, and improve programming skills.

Thank you again
Vlad Volodin



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