Project Homepage Sourceforge Page CVS Repository Freshmeat.net Page Download project Author's Homepage

comboBox.h File Reference


Detailed Description

comboBox specific functions

Definition in file comboBox.h.

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

combo box mode settings

Settings for various combo box modes

#define RF_EXAMPLE_MODE   0
#define RF_HISTORY_MODE   1
#define RF_MAX_MODE   1

Functions

int combo_init (unsigned int mode)
 comob box initialization


Variables

GList * cbitems
 the combo box list

unsigned int combo_mode
 the combo box mode


Define Documentation

#define RF_EXAMPLE_MODE   0
 

an example

Definition at line 33 of file comboBox.h.

Referenced by combo_init(), and main().

#define RF_HISTORY_MODE   1
 

history mode

Definition at line 34 of file comboBox.h.

Referenced by combo_init(), main(), and on_mainWindow_key_press_event().

#define RF_MAX_MODE   1
 

max. modes available

Definition at line 35 of file comboBox.h.

Referenced by on_mainWindow_key_press_event().


Function Documentation

int combo_init unsigned int  mode  ) 
 

comob box initialization

Author:
Karl N. Redman
Parameters:
mode The mode we want to initialize to.
Purpose:
This function is a bit misleading right now. What we want to accomplish is the setting of the values of the combo box list based on various predefined modes of operation.

the persistant history list

Note:
We use GLists because we can easily use the convenience function, gtk_combo_set_popdown_strings(GTK_COMBO(combo), (GList *)aGList) for this kind of data (text only).
Warning:
The stuff in this function is a workaround for lack of gtk+1.2 combobox functionality. The next version of gtk+ looks to have solved some of the problems we're working around here.
Note:
Note: This is a gtk+1.2 method and, I'm told, doesn't work for gtk+2+ (I'll find out I guess)

Definition at line 44 of file comboBox.c.

References cbitems, combo1, history_file, readHistory(), RF_EXAMPLE_MODE, and RF_HISTORY_MODE.

Referenced by main(), on_mainWindow_key_press_event(), and run_command().

00045 {
00046   /**
00047      \note We use GLists because we can easily use the convenience function,
00048      gtk_combo_set_popdown_strings(GTK_COMBO(combo), (GList *)aGList)
00049      for this kind of data (text only).
00050   */
00051 
00052   /** \warning
00053       The stuff in this function is a workaround for lack of gtk+1.2
00054       combobox functionality. The next version of gtk+ looks to have
00055       solved some of the problems we're working around here.
00056   */
00057 
00058   ///the persistant history list
00059   //static GList *hist_list = NULL;
00060   //static GList *exec_list = NULL;
00061   //static GList *file_list = NULL;
00062 
00063   if((unsigned int)mode == RF_EXAMPLE_MODE)
00064     {
00065       /* we're going to change the contents of the combo box list so
00066          we need to delete the old contents and populate it with
00067          something else. 
00068       */
00069 
00070       /**
00071          \note
00072          Note: This is a gtk+1.2 method and, I'm told, doesn't work
00073          for gtk+2+ (I'll find out I guess)
00074       */
00075 
00076       GtkList *oldList = NULL;
00077       
00078       //get the current list
00079       //we could save this if we wanted to.
00080       oldList = (GtkList *)GTK_COMBO(combo1)->list;
00081       
00082       //remove each item in the GTK_LIST
00083       if (GTK_LIST(oldList)->children != NULL)
00084         gtk_list_remove_items (oldList, (GList *)oldList->children);
00085 
00086       //repopulate the list
00087       GList *list = NULL;
00088       list = g_list_append(list, "");
00089       list = g_list_append(list, "1");
00090       list = g_list_append(list, "2");
00091       list = g_list_append(list, "3");
00092       list = g_list_append(list, "4");
00093 
00094       //save a pointer to the list ?
00095       cbitems = list;
00096 
00097       //populate the combo box list widget
00098       gtk_combo_set_popdown_strings(GTK_COMBO(combo1), (GList *)cbitems);
00099 
00100       //a settingthat doesn't really go here
00101       gtk_combo_set_use_arrows_always(GTK_COMBO(combo1), 1);
00102     }
00103 
00104   
00105   if((unsigned int)mode == RF_HISTORY_MODE)
00106     {
00107       GtkList *oldList = NULL;
00108 
00109       oldList = (GtkList *)GTK_COMBO(combo1)->list;
00110       
00111       if (GTK_LIST(oldList)->children != NULL)
00112         gtk_list_remove_items (oldList, (GList *)oldList->children);
00113 
00114       cbitems = NULL;
00115       //cbitems = g_list_append(cbitems, "");
00116       //cbitems = g_list_append(cbitems, "a");
00117       //cbitems = g_list_append(cbitems, "b");
00118       //cbitems = g_list_append(cbitems, "c");
00119       //cbitems = g_list_append(cbitems, "d");
00120       //cbitems = g_list_append(cbitems, "e");
00121       //cbitems = g_list_append(cbitems, "f");
00122       
00123       cbitems = readHistory(cbitems, history_file);
00124       gtk_combo_set_popdown_strings(GTK_COMBO(combo1), (GList *)cbitems);
00125       gtk_combo_set_use_arrows_always(GTK_COMBO(combo1), 1);
00126     }
00127 
00128   return 0;
00129 }

Here is the call graph for this function:


Variable Documentation

GList* cbitems
 

the combo box list

Definition at line 39 of file comboBox.h.

Referenced by combo_init(), main(), and on_mainWindow_destroy().

unsigned int combo_mode
 

the combo box mode

Definition at line 41 of file comboBox.h.

Referenced by main(), on_mainWindow_key_press_event(), and run_command().


Generated on Thu Mar 18 07:26:18 2004 for run-free by doxygen 1.3.5