Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGFrame.h
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 03/01/98
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGFrame
13 #define ROOT_TGFrame
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TGFrame, TGCompositeFrame, TGVerticalFrame, TGHorizontalFrame, //
19 // TGMainFrame, TGTransientFrame and TGGroupFrame //
20 // //
21 // This header contains all different Frame classes. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #include "TGWindow.h"
26 #include "TQObject.h"
27 #include "TGDimension.h"
28 #include "TGGC.h"
29 #include "TGFont.h"
30 #include "TGLayout.h"
31 #include "TGString.h"
32 #include "TList.h"
33 
34 class TGResourcePool;
35 class TGTextButton;
36 class TGVFileSplitter;
37 class TDNDData;
38 
39 //---- frame states
40 
41 enum EFrameState {
42  kIsVisible = BIT(0),
43  kIsMapped = kIsVisible,
44  kIsArranged = BIT(1)
45 };
46 
47 //---- frame cleanup
48 enum EFrameCleanup {
49  kNoCleanup = 0,
50  kLocalCleanup = 1,
51  kDeepCleanup = -1
52 };
53 
54 //---- types of frames (and borders)
55 
56 enum EFrameType {
57  kChildFrame = 0,
58  kMainFrame = BIT(0),
59  kVerticalFrame = BIT(1),
60  kHorizontalFrame = BIT(2),
61  kSunkenFrame = BIT(3),
62  kRaisedFrame = BIT(4),
63  kDoubleBorder = BIT(5),
64  kFitWidth = BIT(6),
65  kFixedWidth = BIT(7),
66  kFitHeight = BIT(8),
67  kFixedHeight = BIT(9),
68  kFixedSize = (kFixedWidth | kFixedHeight),
69  kOwnBackground = BIT(10),
70  kTransientFrame = BIT(11),
71  kTempFrame = BIT(12),
72  kMdiMainFrame = BIT(13),
73  kMdiFrame = BIT(14)
74 };
75 
76 //---- MWM hints stuff
77 
78 enum EMWMHints {
79  // functions
80  kMWMFuncAll = BIT(0),
81  kMWMFuncResize = BIT(1),
82  kMWMFuncMove = BIT(2),
83  kMWMFuncMinimize = BIT(3),
84  kMWMFuncMaximize = BIT(4),
85  kMWMFuncClose = BIT(5),
86 
87  // input mode
88  kMWMInputModeless = 0,
89  kMWMInputPrimaryApplicationModal = 1,
90  kMWMInputSystemModal = 2,
91  kMWMInputFullApplicationModal = 3,
92 
93  // decorations
94  kMWMDecorAll = BIT(0),
95  kMWMDecorBorder = BIT(1),
96  kMWMDecorResizeH = BIT(2),
97  kMWMDecorTitle = BIT(3),
98  kMWMDecorMenu = BIT(4),
99  kMWMDecorMinimize = BIT(5),
100  kMWMDecorMaximize = BIT(6)
101 };
102 
103 //---- drag and drop
104 
105 enum EDNDFlags {
106  kIsDNDSource = BIT(0),
107  kIsDNDTarget = BIT(1)
108 };
109 
110 
111 
112 //////////////////////////////////////////////////////////////////////////
113 // //
114 // TGFrame //
115 // //
116 // This class subclasses TGWindow, used as base class for some simple //
117 // widgets (buttons, labels, etc.). //
118 // It provides: //
119 // - position & dimension fields //
120 // - an 'options' attribute (see constant above) //
121 // - a generic event handler //
122 // - a generic layout mechanism //
123 // - a generic border //
124 // //
125 //////////////////////////////////////////////////////////////////////////
126 
127 class TGFrame : public TGWindow, public TQObject {
128 
129 protected:
130  enum { kDeleteWindowCalled = BIT(15) };
131 
132  Int_t fX; // frame x position
133  Int_t fY; // frame y position
134  UInt_t fWidth; // frame width
135  UInt_t fHeight; // frame height
136  UInt_t fMinWidth; // minimal frame width
137  UInt_t fMinHeight; // minimal frame height
138  UInt_t fMaxWidth; // maximal frame width
139  UInt_t fMaxHeight; // maximal frame height
140  Int_t fBorderWidth; // frame border width
141  UInt_t fOptions; // frame options
142  Pixel_t fBackground; // frame background color
143  UInt_t fEventMask; // currenty active event mask
144  Int_t fDNDState; // EDNDFlags
145  TGFrameElement *fFE; // pointer to frame element
146 
147  static Bool_t fgInit;
148  static Pixel_t fgDefaultFrameBackground;
149  static Pixel_t fgDefaultSelectedBackground;
150  static Pixel_t fgWhitePixel;
151  static Pixel_t fgBlackPixel;
152  static const TGGC *fgBlackGC;
153  static const TGGC *fgWhiteGC;
154  static const TGGC *fgHilightGC;
155  static const TGGC *fgShadowGC;
156  static const TGGC *fgBckgndGC;
157  static Time_t fgLastClick;
158  static UInt_t fgLastButton;
159  static Int_t fgDbx, fgDby;
160  static Window_t fgDbw;
161  static UInt_t fgUserColor;
162 
163  static Time_t GetLastClick();
164 
165  virtual void *GetSender() { return this; } //used to set gTQSender
166  virtual void Draw3dRectangle(UInt_t type, Int_t x, Int_t y,
167  UInt_t w, UInt_t h);
168  virtual void DoRedraw();
169 
170  const TGResourcePool *GetResourcePool() const
171  { return fClient->GetResourcePool(); }
172 
173  TString GetOptionString() const; //used in SavePrimitive()
174 
175  // some protected methods use in gui builder
176  virtual void StartGuiBuilding(Bool_t on = kTRUE);
177 
178 private:
179  TGFrame(const TGFrame&); // not implemented
180  TGFrame& operator=(const TGFrame&); // not implemented
181 
182 public:
183  // Default colors and graphics contexts
184  static Pixel_t GetDefaultFrameBackground();
185  static Pixel_t GetDefaultSelectedBackground();
186  static Pixel_t GetWhitePixel();
187  static Pixel_t GetBlackPixel();
188  static const TGGC &GetBlackGC();
189  static const TGGC &GetWhiteGC();
190  static const TGGC &GetHilightGC();
191  static const TGGC &GetShadowGC();
192  static const TGGC &GetBckgndGC();
193 
194  TGFrame(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1,
195  UInt_t options = 0, Pixel_t back = GetDefaultFrameBackground());
196  TGFrame(TGClient *c, Window_t id, const TGWindow *parent = 0);
197  virtual ~TGFrame();
198 
199  virtual void DeleteWindow();
200  virtual void ReallyDelete() { delete this; }
201 
202  UInt_t GetEventMask() const { return fEventMask; }
203  void AddInput(UInt_t emask);
204  void RemoveInput(UInt_t emask);
205 
206  virtual Bool_t HandleEvent(Event_t *event);
207  virtual Bool_t HandleConfigureNotify(Event_t *event);
208  virtual Bool_t HandleButton(Event_t *) { return kFALSE; }
209  virtual Bool_t HandleDoubleClick(Event_t *) { return kFALSE; }
210  virtual Bool_t HandleCrossing(Event_t *) { return kFALSE; }
211  virtual Bool_t HandleMotion(Event_t *) { return kFALSE; }
212  virtual Bool_t HandleKey(Event_t *) { return kFALSE; }
213  virtual Bool_t HandleFocusChange(Event_t *) { return kFALSE; }
214  virtual Bool_t HandleClientMessage(Event_t *event);
215  virtual Bool_t HandleSelection(Event_t *) { return kFALSE; }
216  virtual Bool_t HandleSelectionRequest(Event_t *) { return kFALSE; }
217  virtual Bool_t HandleSelectionClear(Event_t *) { return kFALSE; }
218  virtual Bool_t HandleColormapChange(Event_t *) { return kFALSE; }
219  virtual Bool_t HandleDragEnter(TGFrame *) { return kFALSE; }
220  virtual Bool_t HandleDragLeave(TGFrame *) { return kFALSE; }
221  virtual Bool_t HandleDragMotion(TGFrame *) { return kFALSE; }
222  virtual Bool_t HandleDragDrop(TGFrame *, Int_t /*x*/, Int_t /*y*/, TGLayoutHints*)
223  { return kFALSE; }
224  virtual void ProcessedConfigure(Event_t *event)
225  { Emit("ProcessedConfigure(Event_t*)", (Long_t)event); } //*SIGNAL*
226  virtual void ProcessedEvent(Event_t *event)
227  { Emit("ProcessedEvent(Event_t*)", (Long_t)event); } //*SIGNAL*
228 
229  virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2);
230  virtual Bool_t ProcessMessage(Long_t, Long_t, Long_t) { return kFALSE; }
231 
232  virtual TGDimension GetDefaultSize() const ;
233  virtual void Move(Int_t x, Int_t y);
234  virtual void Resize(UInt_t w = 0, UInt_t h = 0);
235  virtual void Resize(TGDimension size);
236  virtual void MoveResize(Int_t x, Int_t y, UInt_t w = 0, UInt_t h = 0);
237  virtual UInt_t GetDefaultWidth() const { return GetDefaultSize().fWidth; }
238  virtual UInt_t GetDefaultHeight() const { return GetDefaultSize().fHeight; }
239  virtual Pixel_t GetBackground() const { return fBackground; }
240  virtual void ChangeBackground(Pixel_t back);
241  virtual void SetBackgroundColor(Pixel_t back);
242  virtual Pixel_t GetForeground() const;
243  virtual void SetForegroundColor(Pixel_t /*fore*/) { }
244  virtual UInt_t GetOptions() const { return fOptions; }
245  virtual void ChangeOptions(UInt_t options);
246  virtual void Layout() { }
247  virtual void MapSubwindows() { } // Simple frames do not have subwindows
248  // Redefine this in TGCompositeFrame!
249  virtual void ReparentWindow(const TGWindow *p, Int_t x = 0, Int_t y = 0)
250  { TGWindow::ReparentWindow(p, x, y); Move(x, y); }
251  virtual void MapWindow() { TGWindow::MapWindow(); if (fFE) fFE->fState |= kIsVisible; }
252  virtual void MapRaised() { TGWindow::MapRaised(); if (fFE) fFE->fState |= kIsVisible; }
253  virtual void UnmapWindow() { TGWindow::UnmapWindow(); if (fFE) fFE->fState &= ~kIsVisible; }
254 
255  virtual void DrawBorder();
256  virtual void DrawCopy(Handle_t /*id*/, Int_t /*x*/, Int_t /*y*/) { }
257  virtual void Activate(Bool_t) { }
258  virtual Bool_t IsActive() const { return kFALSE; }
259  virtual Bool_t IsComposite() const { return kFALSE; }
260  virtual Bool_t IsEditable() const { return kFALSE; }
261  virtual void SetEditable(Bool_t) {}
262  virtual void SetLayoutBroken(Bool_t = kTRUE) {}
263  virtual Bool_t IsLayoutBroken() const { return kFALSE; }
264  virtual void SetCleanup(Int_t = kLocalCleanup) { /* backward compatebility */ }
265 
266  virtual void SetDragType(Int_t type);
267  virtual void SetDropType(Int_t type);
268  virtual Int_t GetDragType() const;
269  virtual Int_t GetDropType() const;
270 
271  UInt_t GetWidth() const { return fWidth; }
272  UInt_t GetHeight() const { return fHeight; }
273  UInt_t GetMinWidth() const { return fMinWidth; }
274  UInt_t GetMinHeight() const { return fMinHeight; }
275  UInt_t GetMaxWidth() const { return fMaxWidth; }
276  UInt_t GetMaxHeight() const { return fMaxHeight; }
277  TGDimension GetSize() const { return TGDimension(fWidth, fHeight); }
278  Int_t GetX() const { return fX; }
279  Int_t GetY() const { return fY; }
280  Int_t GetBorderWidth() const { return fBorderWidth; }
281 
282  TGFrameElement *GetFrameElement() const { return fFE; }
283  void SetFrameElement(TGFrameElement *fe) { fFE = fe; }
284 
285  Bool_t Contains(Int_t x, Int_t y) const
286  { return ((x >= 0) && (x < (Int_t)fWidth) && (y >= 0) && (y < (Int_t)fHeight)); }
287  virtual TGFrame *GetFrameFromPoint(Int_t x, Int_t y)
288  { return (Contains(x, y) ? this : 0); }
289 
290  // Modifiers (without graphic update)
291  virtual void SetX(Int_t x) { fX = x; }
292  virtual void SetY(Int_t y) { fY = y; }
293  virtual void SetWidth(UInt_t w) { fWidth = w; }
294  virtual void SetHeight(UInt_t h) { fHeight = h; }
295  virtual void SetMinWidth(UInt_t w) { fMinWidth = w; }
296  virtual void SetMinHeight(UInt_t h) { fMinHeight = h; }
297  virtual void SetMaxWidth(UInt_t w) { fMaxWidth = w; }
298  virtual void SetMaxHeight(UInt_t h) { fMaxHeight = h; }
299  virtual void SetSize(const TGDimension &s) { fWidth = s.fWidth; fHeight = s.fHeight; }
300 
301  // Printing and saving
302  virtual void Print(Option_t *option="") const;
303  void SaveUserColor(std::ostream &out, Option_t *);
304  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
305 
306  // dummy to remove from context menu
307  virtual void Delete(Option_t * /*option*/ ="") { }
308  virtual TObject *DrawClone(Option_t * /*option */="") const { return 0; }
309  virtual void DrawClass() const { }
310  virtual void Dump() const { }
311  virtual void Inspect() const { }
312  virtual void SetDrawOption(Option_t * /*option*/="") { }
313 
314  // drag and drop...
315  void SetDNDSource(Bool_t onoff)
316  { if (onoff) fDNDState |= kIsDNDSource; else fDNDState &= ~kIsDNDSource; }
317  void SetDNDTarget(Bool_t onoff)
318  { if (onoff) fDNDState |= kIsDNDTarget; else fDNDState &= ~kIsDNDTarget; }
319  Bool_t IsDNDSource() const { return fDNDState & kIsDNDSource; }
320  Bool_t IsDNDTarget() const { return fDNDState & kIsDNDTarget; }
321 
322  virtual TDNDData *GetDNDData(Atom_t /*dataType*/) { return 0; }
323  virtual Bool_t HandleDNDDrop(TDNDData * /*DNDData*/) { return kFALSE; }
324  virtual Atom_t HandleDNDPosition(Int_t /*x*/, Int_t /*y*/, Atom_t /*action*/,
325  Int_t /*xroot*/, Int_t /*yroot*/) { return kNone; }
326  virtual Atom_t HandleDNDEnter(Atom_t * /*typelist*/) { return kNone; }
327  virtual Bool_t HandleDNDLeave() { return kFALSE; }
328  virtual Bool_t HandleDNDFinished() { return kFALSE; }
329 
330  ClassDef(TGFrame,0) // Base class for simple widgets (button, etc.)
331 };
332 
333 //////////////////////////////////////////////////////////////////////////
334 // //
335 // TGCompositeFrame //
336 // //
337 // This class is the base class for composite widgets //
338 // (menu bars, list boxes, etc.). //
339 // //
340 // It provides: //
341 // - a layout manager //
342 // - a frame container (TList *) //
343 // //
344 //////////////////////////////////////////////////////////////////////////
345 
346 class TGCompositeFrame : public TGFrame {
347 
348 
349 protected:
350  TGLayoutManager *fLayoutManager; // layout manager
351  TList *fList; // container of frame elements
352  Bool_t fLayoutBroken; // no layout manager is used
353  Int_t fMustCleanup; // cleanup mode (see EFrameCleanup)
354  Bool_t fMapSubwindows; // kTRUE - map subwindows
355 
356  static TGLayoutHints *fgDefaultHints; // default hints used by AddFrame()
357 
358 private:
359  TGCompositeFrame(const TGCompositeFrame&); // not implemented
360  TGCompositeFrame& operator=(const TGCompositeFrame&); // not implemented
361 
362 public:
363  TGCompositeFrame(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1,
364  UInt_t options = 0,
365  Pixel_t back = GetDefaultFrameBackground());
366  TGCompositeFrame(TGClient *c, Window_t id, const TGWindow *parent = 0);
367  virtual ~TGCompositeFrame();
368 
369  virtual TList *GetList() const { return fList; }
370 
371  virtual UInt_t GetDefaultWidth() const
372  { return GetDefaultSize().fWidth; }
373  virtual UInt_t GetDefaultHeight() const
374  { return GetDefaultSize().fHeight; }
375  virtual TGDimension GetDefaultSize() const
376  { return (IsLayoutBroken() ? TGDimension(fWidth, fHeight) :
377  fLayoutManager->GetDefaultSize()); }
378  virtual TGFrame *GetFrameFromPoint(Int_t x, Int_t y);
379  virtual Bool_t TranslateCoordinates(TGFrame *child, Int_t x, Int_t y,
380  Int_t &fx, Int_t &fy);
381  virtual void MapSubwindows();
382  virtual void Layout();
383  virtual Bool_t HandleButton(Event_t *) { return kFALSE; }
384  virtual Bool_t HandleDoubleClick(Event_t *) { return kFALSE; }
385  virtual Bool_t HandleCrossing(Event_t *) { return kFALSE; }
386  virtual Bool_t HandleMotion(Event_t *) { return kFALSE; }
387  virtual Bool_t HandleKey(Event_t *) { return kFALSE; }
388  virtual Bool_t HandleFocusChange(Event_t *) { return kFALSE; }
389  virtual Bool_t HandleSelection(Event_t *) { return kFALSE; }
390  virtual Bool_t HandleDragEnter(TGFrame *);
391  virtual Bool_t HandleDragLeave(TGFrame *);
392  virtual Bool_t HandleDragMotion(TGFrame *);
393  virtual Bool_t HandleDragDrop(TGFrame *frame, Int_t x, Int_t y, TGLayoutHints *lo);
394  virtual void ChangeOptions(UInt_t options);
395  virtual Bool_t ProcessMessage(Long_t, Long_t, Long_t) { return kFALSE; }
396 
397  virtual TGLayoutManager *GetLayoutManager() const { return fLayoutManager; }
398  virtual void SetLayoutManager(TGLayoutManager *l);
399 
400  virtual TGFrameElement* FindFrameElement(TGFrame *f) const;
401 
402  virtual void AddFrame(TGFrame *f, TGLayoutHints *l = 0);
403  virtual void RemoveAll();
404  virtual void RemoveFrame(TGFrame *f);
405  virtual void ShowFrame(TGFrame *f);
406  virtual void HideFrame(TGFrame *f);
407  Int_t GetState(TGFrame *f) const;
408  Bool_t IsVisible(TGFrame *f) const;
409  Bool_t IsVisible(TGFrameElement *ptr) const { return (ptr->fState & kIsVisible); }
410  Bool_t IsArranged(TGFrame *f) const;
411  Bool_t IsArranged(TGFrameElement *ptr) const { return (ptr->fState & kIsArranged); }
412  Bool_t IsComposite() const { return kTRUE; }
413  virtual Bool_t IsEditable() const;
414  virtual void SetEditable(Bool_t on = kTRUE);
415  virtual void SetLayoutBroken(Bool_t on = kTRUE);
416  virtual Bool_t IsLayoutBroken() const
417  { return fLayoutBroken || !fLayoutManager; }
418  virtual void SetEditDisabled(UInt_t on = 1);
419  virtual void SetCleanup(Int_t mode = kLocalCleanup);
420  virtual Int_t MustCleanup() const { return fMustCleanup; }
421  virtual void Cleanup();
422  virtual void SetMapSubwindows(Bool_t on) { fMapSubwindows = on; }
423  virtual Bool_t IsMapSubwindows() const { return fMapSubwindows; }
424 
425  virtual void Print(Option_t *option="") const;
426  virtual void ChangeSubframesBackground(Pixel_t back);
427  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
428  virtual void SavePrimitiveSubframes(std::ostream &out, Option_t *option = "");
429 
430  ClassDef(TGCompositeFrame,0) // Base class for composite widgets (menubars, etc.)
431 };
432 
433 
434 class TGVerticalFrame : public TGCompositeFrame {
435 public:
436  TGVerticalFrame(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1,
437  UInt_t options = kChildFrame,
438  Pixel_t back = GetDefaultFrameBackground()) :
439  TGCompositeFrame(p, w, h, options | kVerticalFrame, back) { SetWindowName(); }
440  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
441 
442  ClassDef(TGVerticalFrame,0) // Composite frame with vertical child layout
443 };
444 
445 class TGHorizontalFrame : public TGCompositeFrame {
446 public:
447  TGHorizontalFrame(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1,
448  UInt_t options = kChildFrame,
449  Pixel_t back = GetDefaultFrameBackground()) :
450  TGCompositeFrame(p, w, h, options | kHorizontalFrame, back) { SetWindowName(); }
451  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
452 
453  ClassDef(TGHorizontalFrame,0) // Composite frame with horizontal child layout
454 };
455 
456 
457 //////////////////////////////////////////////////////////////////////////
458 // //
459 // TGMainFrame //
460 // //
461 // This class defines top level windows that interact with the system //
462 // Window Manager (WM or MWM for Motif Window Manager). //
463 // //
464 //////////////////////////////////////////////////////////////////////////
465 
466 class TGMainFrame : public TGCompositeFrame {
467 
468 protected:
469  enum { kDontCallClose = BIT(14) };
470 
471  // mapping between key and window
472  class TGMapKey : public TObject {
473  private:
474  TGMapKey(const TGMapKey&);
475  TGMapKey& operator=(const TGMapKey&);
476  public:
477  UInt_t fKeyCode;
478  TGWindow *fWindow;
479  TGMapKey(UInt_t keycode, TGWindow *w): fKeyCode(keycode), fWindow(w) { }
480  };
481 
482  Atom_t *fDNDTypeList; // handles DND types
483  TList *fBindList; // list with key bindings
484  TString fWindowName; // window name
485  TString fIconName; // icon name
486  TString fIconPixmap; // icon pixmap name
487  TString fClassName; // WM class name
488  TString fResourceName; // WM resource name
489  UInt_t fMWMValue; // MWM decoration hints
490  UInt_t fMWMFuncs; // MWM functions
491  UInt_t fMWMInput; // MWM input modes
492  Int_t fWMX; // WM x position
493  Int_t fWMY; // WM y position
494  UInt_t fWMWidth; // WM width
495  UInt_t fWMHeight; // WM height
496  UInt_t fWMMinWidth; // WM min width
497  UInt_t fWMMinHeight; // WM min height
498  UInt_t fWMMaxWidth; // WM max width
499  UInt_t fWMMaxHeight; // WM max height
500  UInt_t fWMWidthInc; // WM width increments
501  UInt_t fWMHeightInc; // WM height increments
502  EInitialState fWMInitState; // WM initial state
503 
504  TString GetMWMvalueString() const; //used in SaveSource()
505  TString GetMWMfuncString() const; //used in SaveSource()
506  TString GetMWMinpString() const; //used in SaveSource()
507 
508 private:
509  TGMainFrame(const TGMainFrame&); // not implemented
510  TGMainFrame& operator=(const TGMainFrame&); // not implemented
511 
512 public:
513  TGMainFrame(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1,
514  UInt_t options = kVerticalFrame);
515  virtual ~TGMainFrame();
516 
517  virtual Bool_t HandleKey(Event_t *event);
518  virtual Bool_t HandleClientMessage(Event_t *event);
519  virtual Bool_t HandleSelection(Event_t *event);
520  virtual Bool_t HandleSelectionRequest(Event_t *event);
521  virtual Bool_t HandleButton(Event_t *event);
522  virtual Bool_t HandleMotion(Event_t *event);
523  virtual Bool_t SaveFrameAsCodeOrImage();
524  virtual void SendCloseMessage();
525  virtual void CloseWindow(); //*SIGNAL*
526 
527  void DontCallClose();
528  void SetWindowName(const char *name = 0);
529  void SetIconName(const char *name);
530  const TGPicture *SetIconPixmap(const char *iconName);
531  void SetIconPixmap(char **xpm_array);
532  void SetClassHints(const char *className, const char *resourceName);
533  void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input);
534  void SetWMPosition(Int_t x, Int_t y);
535  void SetWMSize(UInt_t w, UInt_t h);
536  void SetWMSizeHints(UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax,
537  UInt_t winc, UInt_t hinc);
538  void SetWMState(EInitialState state);
539 
540  virtual Bool_t BindKey(const TGWindow *w, Int_t keycode, Int_t modifier) const;
541  virtual void RemoveBind(const TGWindow *w, Int_t keycode, Int_t modifier) const;
542  TList *GetBindList() const { return fBindList; }
543 
544  const char *GetWindowName() const { return fWindowName; }
545  const char *GetIconName() const { return fIconName; }
546  const char *GetIconPixmap() const { return fIconPixmap; }
547  void GetClassHints(const char *&className, const char *&resourceName) const
548  { className = fClassName.Data(); resourceName = fResourceName.Data(); }
549  void GetMWMHints(UInt_t &value, UInt_t &funcs, UInt_t &input) const
550  { value = fMWMValue; funcs = fMWMFuncs; input = fMWMInput; }
551  void GetWMPosition(Int_t &x, Int_t &y) const { x = fWMX; y = fWMY; }
552  void GetWMSize(UInt_t &w, UInt_t &h) const { w = fWMWidth; h = fWMHeight; }
553  void GetWMSizeHints(UInt_t &wmin, UInt_t &hmin, UInt_t &wmax, UInt_t &hmax,
554  UInt_t &winc, UInt_t &hinc) const
555  { wmin = fWMMinWidth; hmin = fWMMinHeight; wmax = fWMMaxWidth;
556  hmax = fWMMaxHeight; winc = fWMWidthInc; hinc = fWMHeightInc; }
557  EInitialState GetWMState() const { return fWMInitState; }
558 
559  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
560  virtual void SaveSource(const char *filename = "Rootappl.C", Option_t *option = ""); // *MENU*icon=bld_save.png*
561 
562  ClassDef(TGMainFrame,0) // Top level window frame
563 };
564 
565 
566 //////////////////////////////////////////////////////////////////////////
567 // //
568 // TGTransientFrame //
569 // //
570 // This class defines transient windows that typically are used for //
571 // dialogs. //
572 // //
573 //////////////////////////////////////////////////////////////////////////
574 
575 class TGTransientFrame : public TGMainFrame {
576 
577 protected:
578  const TGWindow *fMain; // window over which to popup dialog
579 
580 private:
581  TGTransientFrame(const TGTransientFrame&); // not implemented
582  TGTransientFrame& operator=(const TGTransientFrame&); // not implemented
583 
584 public:
585  TGTransientFrame(const TGWindow *p = 0, const TGWindow *main = 0, UInt_t w = 1, UInt_t h = 1,
586  UInt_t options = kVerticalFrame);
587 
588  enum EPlacement { kCenter, kLeft, kRight, kTop, kBottom, kTopLeft, kTopRight,
589  kBottomLeft, kBottomRight };
590  virtual void CenterOnParent(Bool_t croot = kTRUE, EPlacement pos = kCenter);
591  const TGWindow *GetMain() const { return fMain; }
592  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
593  virtual void SaveSource(const char *filename = "Rootdlog.C", Option_t *option = ""); // *MENU*icon=bld_save.png*
594 
595  ClassDef(TGTransientFrame,0) // Frame for dialog (transient) windows
596 };
597 
598 
599 //////////////////////////////////////////////////////////////////////////
600 // //
601 // TGGroupFrame //
602 // //
603 // A group frame is a composite frame with a border and a title. //
604 // It is typically used to group a number of logically related widgets //
605 // visually together. //
606 // //
607 //////////////////////////////////////////////////////////////////////////
608 
609 class TGGroupFrame : public TGCompositeFrame {
610 
611 protected:
612  TGString *fText; // title text
613  FontStruct_t fFontStruct; // title fontstruct
614  GContext_t fNormGC; // title graphics context
615  Int_t fTitlePos; // *OPTION={GetMethod="GetTitlePos";SetMethod="SetTitlePos";Items=(-1="Left",0="Center",1="Right")}*
616  Bool_t fHasOwnFont; // kTRUE - font defined locally, kFALSE - globally
617 
618  virtual void DoRedraw();
619 
620  static const TGFont *fgDefaultFont;
621  static const TGGC *fgDefaultGC;
622 
623 private:
624  TGGroupFrame(const TGGroupFrame&); // not implemented
625  TGGroupFrame& operator=(const TGGroupFrame&); // not implemented
626 
627 public:
628  enum ETitlePos { kLeft = -1, kCenter = 0, kRight = 1 };
629 
630  static FontStruct_t GetDefaultFontStruct();
631  static const TGGC &GetDefaultGC();
632 
633  TGGroupFrame(const TGWindow *p, TGString *title,
634  UInt_t options = kVerticalFrame,
635  GContext_t norm = GetDefaultGC()(),
636  FontStruct_t font = GetDefaultFontStruct(),
637  Pixel_t back = GetDefaultFrameBackground());
638  TGGroupFrame(const TGWindow *p = 0, const char *title = 0,
639  UInt_t options = kVerticalFrame,
640  GContext_t norm = GetDefaultGC()(),
641  FontStruct_t font = GetDefaultFontStruct(),
642  Pixel_t back = GetDefaultFrameBackground());
643  virtual ~TGGroupFrame();
644 
645  virtual TGDimension GetDefaultSize() const;
646  virtual void DrawBorder();
647  virtual void SetTitle(TGString *title);
648  virtual void SetTitle(const char *title);
649  virtual void Rename(const char *title) { SetTitle(title); } //*MENU*icon=bld_rename.png*
650  Int_t GetTitlePos() const { return fTitlePos; }
651  virtual void SetTitlePos(ETitlePos pos = kLeft) { fTitlePos = pos; } //*SUBMENU*
652  virtual void SetTextColor(Pixel_t color, Bool_t local = kTRUE);
653  virtual void SetTextFont(const char *fontName, Bool_t local = kTRUE);
654  virtual void SetTextFont(FontStruct_t font, Bool_t local = kTRUE);
655  GContext_t GetNormGC() const { return fNormGC; }
656  FontStruct_t GetFontStruct() const { return fFontStruct; }
657 
658  virtual const char *GetTitle() const { return fText->GetString(); }
659  Bool_t HasOwnFont() const;
660 
661  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
662 
663  ClassDef(TGGroupFrame,0) // A composite frame with border and title
664 };
665 
666 //////////////////////////////////////////////////////////////////////////
667 // //
668 // TGHeaderFrame //
669 // //
670 // Horizontal Frame used to contain header buttons and splitters //
671 // in a list view. Used to have resizable column headers. //
672 // //
673 //////////////////////////////////////////////////////////////////////////
674 
675 class TGHeaderFrame : public TGHorizontalFrame {
676 private:
677  TGHeaderFrame(const TGHeaderFrame&); // Not implemented
678  TGHeaderFrame& operator=(const TGHeaderFrame&); // Not implemented
679 
680 protected:
681  Int_t fNColumns; // number of columns
682  TGTextButton **fColHeader; // column headers for in detailed mode
683  TGVFileSplitter **fSplitHeader; // column splitters
684  Cursor_t fSplitCursor; // split cursor;
685  Bool_t fOverSplitter; // Indicates if the cursor is over a splitter
686  Int_t fOverButton; // Indicates over which button the mouse is
687  Int_t fLastButton; // Indicates the last button clicked if any
688 
689 public:
690  TGHeaderFrame(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1,
691  UInt_t options = kChildFrame,
692  Pixel_t back = GetDefaultFrameBackground());
693 
694  virtual Bool_t HandleButton(Event_t* event);
695  virtual Bool_t HandleMotion(Event_t* event);
696  virtual Bool_t HandleDoubleClick(Event_t *event);
697 
698  void SetColumnsInfo(Int_t nColumns, TGTextButton **colHeader, TGVFileSplitter **splitHeader);
699 
700  ClassDef(TGHeaderFrame,0) // Header frame with buttons and splitters
701 };
702 
703 
704 #endif