00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGComboBox
00013 #define ROOT_TGComboBox
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef ROOT_TGListBox
00037 #include "TGListBox.h"
00038 #endif
00039
00040 class TGScrollBarElement;
00041 class TGTextEntry;
00042
00043 class TGComboBoxPopup : public TGCompositeFrame {
00044 protected:
00045 TGListBox *fListBox;
00046 TGLBEntry *fSelected;
00047
00048 public:
00049 TGComboBoxPopup(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1,
00050 UInt_t options = kVerticalFrame,
00051 Pixel_t back = GetWhitePixel());
00052
00053 virtual Bool_t HandleButton(Event_t *);
00054
00055 void SetListBox(TGListBox *lb) { fListBox = lb; }
00056 void PlacePopup(Int_t x, Int_t y, UInt_t w, UInt_t h);
00057 void EndPopup();
00058
00059 ClassDef(TGComboBoxPopup,0)
00060 };
00061
00062
00063 class TGComboBox : public TGCompositeFrame, public TGWidget {
00064
00065 private:
00066 TGComboBox(const TGComboBox&);
00067 TGComboBox& operator=(const TGComboBox&);
00068
00069 protected:
00070 TGLBEntry *fSelEntry;
00071 TGTextEntry *fTextEntry;
00072 TGScrollBarElement *fDDButton;
00073 TGComboBoxPopup *fComboFrame;
00074 TGListBox *fListBox;
00075 const TGPicture *fBpic;
00076 TGLayoutHints *fLhs;
00077 TGLayoutHints *fLhb;
00078 TGLayoutHints *fLhdd;
00079
00080 virtual void Init();
00081
00082 public:
00083 TGComboBox(const TGWindow *p = 0, Int_t id = -1,
00084 UInt_t options = kHorizontalFrame | kSunkenFrame | kDoubleBorder,
00085 Pixel_t back = GetWhitePixel());
00086 TGComboBox(const TGWindow *p, const char *text, Int_t id = -1,
00087 UInt_t options = kHorizontalFrame | kSunkenFrame | kDoubleBorder,
00088 Pixel_t back = GetWhitePixel());
00089
00090 virtual ~TGComboBox();
00091
00092 virtual void DrawBorder();
00093 virtual TGDimension GetDefaultSize() const { return TGDimension(fWidth, fHeight); }
00094
00095 virtual Bool_t HandleButton(Event_t *event);
00096 virtual Bool_t HandleDoubleClick(Event_t *event);
00097 virtual Bool_t HandleMotion(Event_t *event);
00098 virtual Bool_t HandleSelection(Event_t *event);
00099 virtual Bool_t HandleSelectionRequest(Event_t *event);
00100 virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00101
00102 virtual void AddEntry(TGString *s, Int_t id)
00103 { fListBox->AddEntry(s, id); Resize(); }
00104 virtual void AddEntry(const char *s, Int_t id)
00105 { fListBox->AddEntry(s, id); Resize(); }
00106 virtual void AddEntry(TGLBEntry *lbe, TGLayoutHints *lhints)
00107 { fListBox->AddEntry(lbe, lhints); Resize(); }
00108 virtual void InsertEntry(TGString *s, Int_t id, Int_t afterID)
00109 { fListBox->InsertEntry(s, id, afterID); Resize(); }
00110 virtual void InsertEntry(const char *s, Int_t id, Int_t afterID)
00111 { fListBox->InsertEntry(s, id, afterID); Resize(); }
00112 virtual void InsertEntry(TGLBEntry *lbe, TGLayoutHints *lhints, Int_t afterID)
00113 { fListBox->InsertEntry(lbe, lhints, afterID); Resize(); }
00114 virtual void NewEntry(const char *s = "Entry")
00115 { fListBox->NewEntry(s); Resize(); }
00116 virtual void RemoveEntry(Int_t id = -1);
00117 virtual void RemoveAll();
00118 virtual void Layout();
00119 virtual Bool_t IsTextInputEnabled() const { return (fTextEntry != 0); }
00120 virtual void EnableTextInput(Bool_t on);
00121 virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
00122 { fListBox->RemoveEntries(from_ID, to_ID); }
00123 virtual Int_t GetNumberOfEntries() const
00124 { return fListBox->GetNumberOfEntries(); }
00125
00126 virtual TGListBox *GetListBox() const { return fListBox; }
00127 virtual TGTextEntry *GetTextEntry() const { return fTextEntry; }
00128 virtual TGLBEntry *FindEntry(const char *s) const;
00129 virtual void Select(Int_t id, Bool_t emit = kTRUE);
00130 virtual Int_t GetSelected() const { return fListBox->GetSelected(); }
00131 virtual TGLBEntry *GetSelectedEntry() const
00132 { return fListBox->GetSelectedEntry(); }
00133 virtual void SetTopEntry(TGLBEntry *e, TGLayoutHints *lh);
00134 virtual void SetEnabled(Bool_t on = kTRUE);
00135 virtual Bool_t IsEnabled() const { return fDDButton->IsEnabled(); }
00136 virtual void SortByName(Bool_t ascend = kTRUE)
00137 { fListBox->SortByName(ascend); }
00138
00139 virtual void Selected(Int_t widgetId, Int_t id);
00140 virtual void Selected(Int_t id) { Emit("Selected(Int_t)", id); }
00141 virtual void Selected(const char *txt) { Emit("Selected(char*)", txt); }
00142 virtual void ReturnPressed();
00143 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00144
00145 ClassDef(TGComboBox,0)
00146 };
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156 class TGLineStyleComboBox : public TGComboBox {
00157
00158 public:
00159 TGLineStyleComboBox(const TGWindow *p = 0, Int_t id = -1,
00160 UInt_t options = kHorizontalFrame | kSunkenFrame | kDoubleBorder,
00161 Pixel_t back = GetWhitePixel());
00162
00163 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00164
00165 ClassDef(TGLineStyleComboBox, 0)
00166
00167 };
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178 class TGLineWidthComboBox : public TGComboBox {
00179
00180 public:
00181 TGLineWidthComboBox(const TGWindow *p = 0, Int_t id = -1,
00182 UInt_t options = kHorizontalFrame | kSunkenFrame | kDoubleBorder,
00183 Pixel_t back = GetWhitePixel(), Bool_t none=kFALSE);
00184
00185 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00186
00187 ClassDef(TGLineWidthComboBox, 0)
00188
00189
00190 };
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200 const Int_t kMaxFonts = 20;
00201
00202 class TGFontTypeComboBox : public TGComboBox {
00203
00204 protected:
00205 FontStruct_t fFonts[kMaxFonts];
00206
00207 public:
00208 TGFontTypeComboBox(const TGWindow *p = 0, Int_t id = -1,
00209 UInt_t options = kHorizontalFrame | kSunkenFrame | kDoubleBorder,
00210 Pixel_t bask = GetWhitePixel());
00211 virtual ~TGFontTypeComboBox();
00212
00213 ClassDef(TGFontTypeComboBox, 0)
00214 };
00215
00216 #endif