00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
#ifndef COMBO_H
00043
#define COMBO_H
00044
00045
#include <vdk/vdkobj.h>
00046
#include <vdk/value_sem_list.h>
00047
00048
typedef VDKValueList<VDKString> StringList;
00049
typedef VDKValueListIterator<VDKString> StringListIterator;
00050
00065 class VDKCombo:
public VDKObject
00066 {
00067
static int FocusOutEvent(GtkWidget *w,
00068 GdkEventFocus *event,
00069 gpointer wid);
00070
static int FocusInEvent(GtkWidget *w,
00071 GdkEventFocus *event,
00072 gpointer wid);
00073
protected:
00074
int changeConnect;
00075
VDKObjectSignal s_activated, s_changed, s_selected;
00076 GList *popdownlist;
00077 StringList popdownstr;
00078
void SortList();
00079
VDKString buffer;
00080
public:
00081
00085 VDKReadWriteValueProp<VDKCombo,char*>
Text;
00091 VDKReadWriteValueProp<VDKCombo,bool>
Editable;
00097 VDKReadWriteValueProp<VDKCombo,bool>
Sorted;
00101 VDKReadWriteValueProp<VDKCombo,bool>
Hidden;
00106 VDKReadWriteValueProp<VDKCombo,bool>
CaseSensitive;
00137 VDKReadWriteValueProp<VDKCombo,StringList>
PopdownStrings;
00143 VDKReadOnlyValueProp<VDKCombo,int>
Selected;
00149
VDKCombo(
VDKForm* owner,
char* def = (
char*) NULL,
00150 GtkWidget* combo = NULL);
00153
virtual ~
VDKCombo();
00154
00155
void SetText(
char* text);
00156
char* GetText();
00157
void SetEditable(
bool flag)
00158 { gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(widget)->entry),flag); }
00159
bool GetEditable()
00160 {
return Editable; }
00161
void SetSorted(
bool flag)
00162 {
if(flag && !
Sorted) SortList(); }
00163
bool GetSorted()
00164 {
return Sorted; }
00165
void SetBackground(
VDKRgb rgb,
00166 GtkStateType state);
00167
void SetHidden(
bool flag)
00168 { gtk_entry_set_visibility(GTK_ENTRY(GTK_COMBO(widget)->entry), ! flag) ; }
00169
bool GetHidden()
00170 {
return !
Hidden; }
00171
void SetPopdownStrings(StringList);
00172 StringList GetPopdownStrings();
00173
void SetCaseSensitive(
bool flag)
00174 { gtk_combo_set_case_sensitive(GTK_COMBO(widget),flag); }
00175
bool GetCaseSensitive()
00176 {
return (
bool)(GTK_COMBO(widget)->case_sensitive); }
00177
void UseArrows(
bool flag)
00178 { gtk_combo_set_use_arrows(GTK_COMBO(widget),flag); }
00179
void UseArrowsAlways(
bool flag)
00180 { gtk_combo_set_use_arrows_always(GTK_COMBO(widget),flag); }
00181
void SetValueInList(
int val,
bool ok_if_empty)
00182 { gtk_combo_set_value_in_list(GTK_COMBO(widget),val,ok_if_empty); }
00183
void ClearList();
00184
void SelectItem(
int item)
00185 { gtk_list_select_item(GTK_LIST(GTK_COMBO(widget)->list), item); }
00186
void UnselectItem(
int item)
00187 { gtk_list_unselect_item(GTK_LIST(GTK_COMBO(widget)->list), item); }
00188
int GetSelected();
00189
#ifdef USE_SIGCPLUSPLUS
00190
public:
00196 VDKSignal1<void,int>
OnItemSelect;
00202 VDKSignal1<void,int>
OnItemUnselect;
00209 VDKSignal2<void,int, const char*>
OnItemTextChanged;
00215 VDKSignal1<void, int>
OnItemActivate;
00216
00217
protected:
00218
static void make_gtksigc_connection(
VDKCombo*);
00219
00220
private:
00221
static void _handle_item_select(GtkWidget* list,
00222 GtkWidget* item,
00223 gpointer obj);
00224
static void _handle_item_unselect(GtkWidget* list,
00225 GtkWidget* item,
00226 gpointer obj);
00227
static void _handle_item_text_changed(GtkWidget*, gpointer obj);
00228
static void _handle_item_activate(GtkWidget*, gpointer obj);
00229
#endif
00230 };
00231
#endif
00232
00233
00234
00235
00236