diff --git a/Gtk3/gtk18/gtk18.cbp b/Gtk3/gtk18/gtk18.cbp new file mode 100644 index 0000000..2f9beb5 --- /dev/null +++ b/Gtk3/gtk18/gtk18.cbp @@ -0,0 +1,37 @@ + + + + + + diff --git a/Gtk3/gtk18/gtk18.dev b/Gtk3/gtk18/gtk18.dev new file mode 100644 index 0000000..849214d --- /dev/null +++ b/Gtk3/gtk18/gtk18.dev @@ -0,0 +1,62 @@ +[Project] +FileName=gtk18.dev +Name=gtk18 +Type=1 +Ver=2 +ObjFiles= +Includes= +Libs= +PrivateResource= +ResourceIncludes= +MakeIncludes= +Compiler= +CppCompiler= +Linker= +IsCpp=1 +Icon= +ExeOutput= +ObjectOutput= +LogOutput= +LogOutputEnabled=0 +OverrideOutput=0 +OverrideOutputName=gtk18.exe +HostApplication= +UseCustomMakefile=0 +CustomMakefile= +CommandLine= +Folders= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=6 +CompilerSettings=000000a100000000000000000 +UnitCount=1 + +[VersionInfo] +Major=1 +Minor=0 +Release=0 +Build=0 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion=1.0.0.0 +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +AutoIncBuildNr=0 +SyncProduct=1 + +[Unit1] +FileName=main.cpp +CompileCpp=1 +Folder= +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/Gtk3/gtk18/gtk18.layout b/Gtk3/gtk18/gtk18.layout new file mode 100644 index 0000000..59c526e --- /dev/null +++ b/Gtk3/gtk18/gtk18.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/Gtk3/gtk18/gtk18.ui b/Gtk3/gtk18/gtk18.ui new file mode 100644 index 0000000..0140477 --- /dev/null +++ b/Gtk3/gtk18/gtk18.ui @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + False + + + + + + True + False + + + 100 + 80 + True + False + liststore1 + 2 + True + + + False + + + + + 252 + 89 + + + + + 100 + 80 + True + False + 2 + True + 1 + + Hello + ajsnsjnsk + + + + False + Hello + + + + + 118 + 137 + + + + + + diff --git a/Gtk3/gtk18/main.cpp b/Gtk3/gtk18/main.cpp new file mode 100644 index 0000000..79dd61c --- /dev/null +++ b/Gtk3/gtk18/main.cpp @@ -0,0 +1,46 @@ +#include + +void print1(GtkWidget *widget,gpointer data){ +//Check user selection of combo box and print specific char + const gchar *str=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(data)); + g_print("%s\n",str); + if(strcmp(str,"test1")==0){ + g_print("1\n"); + }else{ + g_print("2\n"); + } +} + +static void activate(GtkApplication *app,gpointer user_data){ + GtkWidget *window; + GtkWidget *fixed; + GtkWidget *combo; + GtkWidget *button; + window=gtk_application_window_new(app);//Create a window sized 300x200 + gtk_window_set_title(GTK_WINDOW(window),"gtk (18)"); + gtk_window_set_default_size(GTK_WINDOW(window),300,200); + gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER); + fixed=gtk_fixed_new();//Put the widget at a fixed position + gtk_container_add(GTK_CONTAINER(window),fixed); + combo=gtk_combo_box_text_new();//Create a combo box + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo),"test1"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo),"test2"); + gtk_combo_box_set_active(GTK_COMBO_BOX(combo),0);//Set default selection + gtk_widget_set_size_request(combo,100,40); + gtk_fixed_put(GTK_FIXED(fixed),combo,100,50); + button=gtk_button_new_with_label("Print");//Button to response + gtk_widget_set_size_request(button,100,50); + gtk_fixed_put(GTK_FIXED(fixed),button,100,105); + g_signal_connect(G_OBJECT(button),"clicked",G_CALLBACK(print1),(gpointer)combo); + gtk_widget_show_all(window); +} + +int main(int argc,char *argv[]){ +//Common way to create a gtk application + GtkApplication *app; + int status; + app=gtk_application_new("com.github.daleclack.gtk18",G_APPLICATION_FLAGS_NONE); + g_signal_connect(app,"activate",G_CALLBACK(activate),NULL); + status=g_application_run(G_APPLICATION(app),argc,argv); + return status; +}