12 #ifndef ROOT_TGComboBox
13 #define ROOT_TGComboBox
38 class TGScrollBarElement;
41 class TGComboBoxPopup :
public TGCompositeFrame {
48 TGComboBoxPopup(
const TGComboBoxPopup&);
49 TGComboBoxPopup& operator=(
const TGComboBoxPopup&);
52 TGComboBoxPopup(
const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1,
53 UInt_t options = kVerticalFrame,
54 Pixel_t back = GetWhitePixel());
56 virtual Bool_t HandleButton(Event_t *);
57 void KeyPressed(TGFrame*, UInt_t, UInt_t);
59 void SetListBox(TGListBox *lb) { fListBox = lb; }
60 void PlacePopup(Int_t x, Int_t y, UInt_t w, UInt_t h);
63 ClassDef(TGComboBoxPopup,0)
67 class TGComboBox :
public TGCompositeFrame,
public TGWidget {
70 TGComboBox(
const TGComboBox&);
71 TGComboBox& operator=(
const TGComboBox&);
75 TGTextEntry *fTextEntry;
76 TGScrollBarElement *fDDButton;
77 TGComboBoxPopup *fComboFrame;
79 const TGPicture *fBpic;
87 TGComboBox(
const TGWindow *p = 0, Int_t
id = -1,
88 UInt_t options = kHorizontalFrame | kSunkenFrame | kDoubleBorder,
89 Pixel_t back = GetWhitePixel());
90 TGComboBox(
const TGWindow *p,
const char *text, Int_t
id = -1,
91 UInt_t options = kHorizontalFrame | kSunkenFrame | kDoubleBorder,
92 Pixel_t back = GetWhitePixel());
94 virtual ~TGComboBox();
96 virtual void DrawBorder();
97 virtual TGDimension GetDefaultSize()
const {
return TGDimension(fWidth, fHeight); }
99 virtual Bool_t HandleButton(Event_t *event);
100 virtual Bool_t HandleDoubleClick(Event_t *event);
101 virtual Bool_t HandleMotion(Event_t *event);
102 virtual Bool_t HandleSelection(Event_t *event);
103 virtual Bool_t HandleSelectionRequest(Event_t *event);
104 virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
106 virtual void AddEntry(TGString *s, Int_t
id)
107 { fListBox->AddEntry(s,
id); Resize(); }
108 virtual void AddEntry(
const char *s, Int_t
id)
109 { fListBox->AddEntry(s,
id); Resize(); }
110 virtual void AddEntry(TGLBEntry *lbe, TGLayoutHints *lhints)
111 { fListBox->AddEntry(lbe, lhints); Resize(); }
112 virtual void InsertEntry(TGString *s, Int_t
id, Int_t afterID)
113 { fListBox->InsertEntry(s,
id, afterID); Resize(); }
114 virtual void InsertEntry(
const char *s, Int_t
id, Int_t afterID)
115 { fListBox->InsertEntry(s,
id, afterID); Resize(); }
116 virtual void InsertEntry(TGLBEntry *lbe, TGLayoutHints *lhints, Int_t afterID)
117 { fListBox->InsertEntry(lbe, lhints, afterID); Resize(); }
118 virtual void NewEntry(
const char *s =
"Entry")
119 { fListBox->NewEntry(s); Resize(); }
120 virtual void RemoveEntry(Int_t
id = -1);
121 virtual void RemoveAll();
122 virtual void Layout();
123 virtual Bool_t IsTextInputEnabled()
const {
return (fTextEntry != 0); }
124 virtual void EnableTextInput(Bool_t on);
125 virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
126 { fListBox->RemoveEntries(from_ID, to_ID); }
127 virtual Int_t GetNumberOfEntries()
const
128 {
return fListBox->GetNumberOfEntries(); }
130 virtual TGListBox *GetListBox()
const {
return fListBox; }
131 virtual TGTextEntry *GetTextEntry()
const {
return fTextEntry; }
132 virtual TGLBEntry *FindEntry(
const char *s)
const;
133 virtual void Select(Int_t
id, Bool_t emit = kTRUE);
134 virtual Int_t GetSelected()
const {
return fListBox->GetSelected(); }
135 virtual TGLBEntry *GetSelectedEntry()
const
136 {
return fListBox->GetSelectedEntry(); }
137 virtual void SetTopEntry(TGLBEntry *e, TGLayoutHints *lh);
138 virtual void SetEnabled(Bool_t on = kTRUE);
139 virtual Bool_t IsEnabled()
const {
return fDDButton->IsEnabled(); }
140 virtual void SortByName(Bool_t ascend = kTRUE)
141 { fListBox->SortByName(ascend); }
143 virtual void Selected(Int_t widgetId, Int_t
id);
144 virtual void Selected(Int_t
id) { Emit(
"Selected(Int_t)",
id); }
145 virtual void Selected(
const char *txt) { Emit(
"Selected(char*)", txt); }
146 virtual void ReturnPressed();
147 virtual void SavePrimitive(std::ostream &out, Option_t *option =
"");
149 ClassDef(TGComboBox,0)
160 class TGLineStyleComboBox :
public TGComboBox {
163 TGLineStyleComboBox(
const TGWindow *p = 0, Int_t
id = -1,
164 UInt_t options = kHorizontalFrame | kSunkenFrame | kDoubleBorder,
165 Pixel_t back = GetWhitePixel());
167 virtual void SavePrimitive(std::ostream &out, Option_t *option =
"");
169 ClassDef(TGLineStyleComboBox, 0)
182 class TGLineWidthComboBox :
public TGComboBox {
185 TGLineWidthComboBox(
const TGWindow *p = 0, Int_t
id = -1,
186 UInt_t options = kHorizontalFrame | kSunkenFrame | kDoubleBorder,
187 Pixel_t back = GetWhitePixel(), Bool_t none=kFALSE);
189 virtual void SavePrimitive(std::ostream &out, Option_t *option =
"");
191 ClassDef(TGLineWidthComboBox, 0)
204 const Int_t kMaxFonts = 20;
206 class TGFontTypeComboBox :
public TGComboBox {
209 FontStruct_t fFonts[kMaxFonts];
212 TGFontTypeComboBox(
const TGWindow *p = 0, Int_t
id = -1,
213 UInt_t options = kHorizontalFrame | kSunkenFrame | kDoubleBorder,
214 Pixel_t bask = GetWhitePixel());
215 virtual ~TGFontTypeComboBox();
217 ClassDef(TGFontTypeComboBox, 0)