../dox/GUI-GTK.dox
ut_gtk.c GUI_ functions ..
Example_Window Example_Toolbar
________________________________________________________________________________
// Simple-Gtk-Demo (minimum) #include "MS_Def1.h" #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "../gtk/ut_gtk.h" #include "../ut/ut_cast.h" // INT_PTR #include "../ut/types_gui.h" // UI_Func.. #include "../gr/ut_UI.h" // UI_Func.. #ifdef _MSC_VER // die folgenden 2 Funktionen exportieren (werden vom Main gerufen): __declspec(dllexport) int gCad_main (); __declspec(dllexport) int gCad_fini (); // nachfolgende externals werden aus dem Main-Exe imported: #define extern __declspec(dllimport) #endif //========================================================= int gCad_main () { //========================================================= // user has selected this plugin; starting ... TX_Print("gCad_main DemoGtk1"); win1__ (NULL, PTR_INT(UI_FuncInit)); // create window return 0; } //========================================================= int gCad_fini () { //========================================================= // dll being unloaded - reset Input, kill all open windows !!! TX_Print("...... gCad_fini DemoGtk1"); win1__ (NULL, PTR_INT(UI_FuncExit)); // kill window AP_User_reset (); // close application return 0; } //========================================================= int win1__ (void *parent, void *data) { //========================================================= static void *win0; void *box0; printf("win1__ %d\n",INT_PTR(data)); switch (INT_PTR(data)) { case UI_FuncInit: win0 = GUI_Window ("Gtk1", win1__, NULL, 0); // X calls UI_FuncKill box0 = GUI_Vbox (win0, 0); GUI_Butt (box0,"Exit ", win1__, PTR_INT(UI_FuncKill), 50); gtk_widget_show (win0); break; case UI_FuncKill: // 99 gCad_fini (); break; case UI_FuncExit: // 102 gtk_widget_destroy (win0); win0 = NULL; break; } return 0; } //================ EOF ==================================
More examples: see DemoKondensatorplatte.c
________________________________________________________________________________
GUI_Window GUI_Butt Toolbar: static GtkWidget *tbApp=NULL; //---------------------------------------------------------------- // ex xa_ui.c: extern GtkWidget *UIw_Box_TB; // toolbarBox static GtkWidget *tbApp=NULL; // Toolbar int gCad_main () { tbApp = app1_init_UI (UIw_Box_TB, NULL); } int gCad_fini () { GUI_obj_del (tbApp); // remove the toolbar tbApp = NULL; } GtkWidget* app1_init_UI (GtkWidget *parent, void *data) { tbApp = GUI_Toolbox (parent); box0 = GUI_Hbox (tbApp, 0); gtk_widget_show tbApp); return tbApp; }
1.6.3