Warning, file /include/root/TGFrame.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGFrame
0013 #define ROOT_TGFrame
0014
0015
0016 #include "TGWindow.h"
0017 #include "TQObject.h"
0018 #include "TGDimension.h"
0019 #include "TGGC.h"
0020 #include "TGFont.h"
0021 #include "TGLayout.h"
0022 #include "TGString.h"
0023
0024 class TGResourcePool;
0025 class TGTextButton;
0026 class TGVFileSplitter;
0027 class TDNDData;
0028 class TList;
0029
0030
0031
0032 enum EFrameState {
0033 kIsVisible = BIT(0),
0034 kIsMapped = kIsVisible,
0035 kIsArranged = BIT(1)
0036 };
0037
0038
0039 enum EFrameCleanup {
0040 kNoCleanup = 0,
0041 kLocalCleanup = 1,
0042 kDeepCleanup = -1
0043 };
0044
0045
0046
0047 enum EMWMHints {
0048
0049 kMWMFuncAll = BIT(0),
0050 kMWMFuncResize = BIT(1),
0051 kMWMFuncMove = BIT(2),
0052 kMWMFuncMinimize = BIT(3),
0053 kMWMFuncMaximize = BIT(4),
0054 kMWMFuncClose = BIT(5),
0055
0056
0057 kMWMInputModeless = 0,
0058 kMWMInputPrimaryApplicationModal = 1,
0059 kMWMInputSystemModal = 2,
0060 kMWMInputFullApplicationModal = 3,
0061
0062
0063 kMWMDecorAll = BIT(0),
0064 kMWMDecorBorder = BIT(1),
0065 kMWMDecorResizeH = BIT(2),
0066 kMWMDecorTitle = BIT(3),
0067 kMWMDecorMenu = BIT(4),
0068 kMWMDecorMinimize = BIT(5),
0069 kMWMDecorMaximize = BIT(6)
0070 };
0071
0072
0073
0074 enum EDNDFlags {
0075 kIsDNDSource = BIT(0),
0076 kIsDNDTarget = BIT(1)
0077 };
0078
0079
0080 class TGFrame : public TGWindow, public TQObject {
0081
0082 protected:
0083 enum { kDeleteWindowCalled = BIT(15) };
0084
0085 Int_t fX;
0086 Int_t fY;
0087 UInt_t fWidth;
0088 UInt_t fHeight;
0089 UInt_t fMinWidth;
0090 UInt_t fMinHeight;
0091 UInt_t fMaxWidth;
0092 UInt_t fMaxHeight;
0093 Int_t fBorderWidth;
0094 UInt_t fOptions;
0095 Pixel_t fBackground;
0096 UInt_t fEventMask;
0097 Int_t fDNDState;
0098 TGFrameElement *fFE;
0099
0100 static Bool_t fgInit;
0101 static Pixel_t fgDefaultFrameBackground;
0102 static Pixel_t fgDefaultSelectedBackground;
0103 static Pixel_t fgWhitePixel;
0104 static Pixel_t fgBlackPixel;
0105 static const TGGC *fgBlackGC;
0106 static const TGGC *fgWhiteGC;
0107 static const TGGC *fgHilightGC;
0108 static const TGGC *fgShadowGC;
0109 static const TGGC *fgBckgndGC;
0110 static Time_t fgLastClick;
0111 static UInt_t fgLastButton;
0112 static Int_t fgDbx, fgDby;
0113 static Window_t fgDbw;
0114 static UInt_t fgUserColor;
0115
0116 static Time_t GetLastClick();
0117
0118 void *GetSender() override { return this; }
0119 virtual void Draw3dRectangle(UInt_t type, Int_t x, Int_t y,
0120 UInt_t w, UInt_t h);
0121 void DoRedraw() override;
0122
0123 const TGResourcePool *GetResourcePool() const
0124 { return fClient->GetResourcePool(); }
0125
0126 TString GetOptionString() const;
0127
0128
0129 virtual void StartGuiBuilding(Bool_t on = kTRUE);
0130
0131 private:
0132 TGFrame(const TGFrame&) = delete;
0133 TGFrame& operator=(const TGFrame&) = delete;
0134
0135 public:
0136
0137 static Pixel_t GetDefaultFrameBackground();
0138 static Pixel_t GetDefaultSelectedBackground();
0139 static Pixel_t GetWhitePixel();
0140 static Pixel_t GetBlackPixel();
0141 static const TGGC &GetBlackGC();
0142 static const TGGC &GetWhiteGC();
0143 static const TGGC &GetHilightGC();
0144 static const TGGC &GetShadowGC();
0145 static const TGGC &GetBckgndGC();
0146
0147 TGFrame(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
0148 UInt_t options = 0, Pixel_t back = GetDefaultFrameBackground());
0149 TGFrame(TGClient *c, Window_t id, const TGWindow *parent = nullptr);
0150 ~TGFrame() override;
0151
0152 virtual void DeleteWindow();
0153 virtual void ReallyDelete() { delete this; }
0154
0155 UInt_t GetEventMask() const { return fEventMask; }
0156 void AddInput(UInt_t emask);
0157 void RemoveInput(UInt_t emask);
0158
0159 Bool_t HandleEvent(Event_t *event) override;
0160 virtual Bool_t HandleConfigureNotify(Event_t *event);
0161 virtual Bool_t HandleButton(Event_t *) { return kFALSE; }
0162 virtual Bool_t HandleDoubleClick(Event_t *) { return kFALSE; }
0163 virtual Bool_t HandleCrossing(Event_t *) { return kFALSE; }
0164 virtual Bool_t HandleMotion(Event_t *) { return kFALSE; }
0165 virtual Bool_t HandleKey(Event_t *) { return kFALSE; }
0166 virtual Bool_t HandleFocusChange(Event_t *) { return kFALSE; }
0167 virtual Bool_t HandleClientMessage(Event_t *event);
0168 virtual Bool_t HandleSelection(Event_t *) { return kFALSE; }
0169 virtual Bool_t HandleSelectionRequest(Event_t *) { return kFALSE; }
0170 virtual Bool_t HandleSelectionClear(Event_t *) { return kFALSE; }
0171 virtual Bool_t HandleColormapChange(Event_t *) { return kFALSE; }
0172 virtual Bool_t HandleDragEnter(TGFrame *) { return kFALSE; }
0173 virtual Bool_t HandleDragLeave(TGFrame *) { return kFALSE; }
0174 virtual Bool_t HandleDragMotion(TGFrame *) { return kFALSE; }
0175 virtual Bool_t HandleDragDrop(TGFrame *, Int_t , Int_t , TGLayoutHints*)
0176 { return kFALSE; }
0177 virtual void ProcessedConfigure(Event_t *event)
0178 { Emit("ProcessedConfigure(Event_t*)", (Longptr_t)event); }
0179 virtual void ProcessedEvent(Event_t *event)
0180 { Emit("ProcessedEvent(Event_t*)", (Longptr_t)event); }
0181
0182 virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2);
0183 virtual Bool_t ProcessMessage(Longptr_t, Longptr_t, Longptr_t) { return kFALSE; }
0184
0185 virtual TGDimension GetDefaultSize() const ;
0186 void Move(Int_t x, Int_t y) override;
0187 void Resize(UInt_t w = 0, UInt_t h = 0) override;
0188 virtual void Resize(TGDimension size);
0189 void MoveResize(Int_t x, Int_t y, UInt_t w = 0, UInt_t h = 0) override;
0190 virtual UInt_t GetDefaultWidth() const { return GetDefaultSize().fWidth; }
0191 virtual UInt_t GetDefaultHeight() const { return GetDefaultSize().fHeight; }
0192 virtual Pixel_t GetBackground() const { return fBackground; }
0193 virtual void ChangeBackground(Pixel_t back);
0194 void SetBackgroundColor(Pixel_t back) override;
0195 virtual Pixel_t GetForeground() const;
0196 virtual void SetForegroundColor(Pixel_t ) { }
0197 virtual UInt_t GetOptions() const { return fOptions; }
0198 virtual void ChangeOptions(UInt_t options);
0199 virtual void Layout() { }
0200 void MapSubwindows() override {}
0201
0202 void ReparentWindow(const TGWindow *p, Int_t x = 0, Int_t y = 0) override
0203 { TGWindow::ReparentWindow(p, x, y); Move(x, y); }
0204 void MapWindow() override { TGWindow::MapWindow(); if (fFE) fFE->fState |= kIsVisible; }
0205 void MapRaised() override { TGWindow::MapRaised(); if (fFE) fFE->fState |= kIsVisible; }
0206 void UnmapWindow() override { TGWindow::UnmapWindow(); if (fFE) fFE->fState &= ~kIsVisible; }
0207
0208 virtual void DrawBorder();
0209 virtual void DrawCopy(Handle_t , Int_t , Int_t ) { }
0210 virtual void Activate(Bool_t) { }
0211 virtual Bool_t IsActive() const { return kFALSE; }
0212 virtual Bool_t IsComposite() const { return kFALSE; }
0213 Bool_t IsEditable() const override { return kFALSE; }
0214 void SetEditable(Bool_t) override {}
0215 virtual void SetLayoutBroken(Bool_t = kTRUE) {}
0216 virtual Bool_t IsLayoutBroken() const { return kFALSE; }
0217 virtual void SetCleanup(Int_t = kLocalCleanup) { }
0218
0219 virtual void SetDragType(Int_t type);
0220 virtual void SetDropType(Int_t type);
0221 virtual Int_t GetDragType() const;
0222 virtual Int_t GetDropType() const;
0223
0224 UInt_t GetWidth() const { return fWidth; }
0225 UInt_t GetHeight() const { return fHeight; }
0226 UInt_t GetMinWidth() const { return fMinWidth; }
0227 UInt_t GetMinHeight() const { return fMinHeight; }
0228 UInt_t GetMaxWidth() const { return fMaxWidth; }
0229 UInt_t GetMaxHeight() const { return fMaxHeight; }
0230 TGDimension GetSize() const { return TGDimension(fWidth, fHeight); }
0231 Int_t GetX() const { return fX; }
0232 Int_t GetY() const { return fY; }
0233 Int_t GetBorderWidth() const { return fBorderWidth; }
0234
0235 TGFrameElement *GetFrameElement() const { return fFE; }
0236 void SetFrameElement(TGFrameElement *fe) { fFE = fe; }
0237
0238 Bool_t Contains(Int_t x, Int_t y) const
0239 { return ((x >= 0) && (x < (Int_t)fWidth) && (y >= 0) && (y < (Int_t)fHeight)); }
0240 virtual TGFrame *GetFrameFromPoint(Int_t x, Int_t y)
0241 { return Contains(x, y) ? this : nullptr; }
0242
0243
0244 virtual void SetX(Int_t x) { fX = x; }
0245 virtual void SetY(Int_t y) { fY = y; }
0246 virtual void SetWidth(UInt_t w) { fWidth = w; }
0247 virtual void SetHeight(UInt_t h) { fHeight = h; }
0248 virtual void SetMinWidth(UInt_t w) { fMinWidth = w; }
0249 virtual void SetMinHeight(UInt_t h) { fMinHeight = h; }
0250 virtual void SetMaxWidth(UInt_t w) { fMaxWidth = w; }
0251 virtual void SetMaxHeight(UInt_t h) { fMaxHeight = h; }
0252 virtual void SetSize(const TGDimension &s) { fWidth = s.fWidth; fHeight = s.fHeight; }
0253
0254
0255 void Print(Option_t *option="") const override;
0256 void SaveUserColor(std::ostream &out, Option_t *);
0257 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0258
0259
0260 void Delete(Option_t * ="") override {}
0261 TObject *DrawClone(Option_t * ="") const override { return nullptr; }
0262 void DrawClass() const override {}
0263 void Dump() const override {}
0264 void Inspect() const override {}
0265 void SetDrawOption(Option_t * ="") override {}
0266
0267
0268 void SetDNDSource(Bool_t onoff)
0269 { if (onoff) fDNDState |= kIsDNDSource; else fDNDState &= ~kIsDNDSource; }
0270 void SetDNDTarget(Bool_t onoff)
0271 { if (onoff) fDNDState |= kIsDNDTarget; else fDNDState &= ~kIsDNDTarget; }
0272 Bool_t IsDNDSource() const { return fDNDState & kIsDNDSource; }
0273 Bool_t IsDNDTarget() const { return fDNDState & kIsDNDTarget; }
0274
0275 virtual TDNDData *GetDNDData(Atom_t ) { return nullptr; }
0276 virtual Bool_t HandleDNDDrop(TDNDData * ) { return kFALSE; }
0277 virtual Atom_t HandleDNDPosition(Int_t , Int_t , Atom_t ,
0278 Int_t , Int_t ) { return kNone; }
0279 virtual Atom_t HandleDNDEnter(Atom_t * ) { return kNone; }
0280 virtual Bool_t HandleDNDLeave() { return kFALSE; }
0281 virtual Bool_t HandleDNDFinished() { return kFALSE; }
0282
0283 ClassDefOverride(TGFrame,0)
0284 };
0285
0286
0287 class TGCompositeFrame : public TGFrame {
0288
0289
0290 protected:
0291 TGLayoutManager *fLayoutManager;
0292 TList *fList;
0293 Bool_t fLayoutBroken;
0294 Int_t fMustCleanup;
0295 Bool_t fMapSubwindows;
0296
0297 static TGLayoutHints *fgDefaultHints;
0298
0299 private:
0300 TGCompositeFrame(const TGCompositeFrame&) = delete;
0301 TGCompositeFrame& operator=(const TGCompositeFrame&) = delete;
0302
0303 public:
0304 TGCompositeFrame(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
0305 UInt_t options = 0,
0306 Pixel_t back = GetDefaultFrameBackground());
0307 TGCompositeFrame(TGClient *c, Window_t id, const TGWindow *parent = nullptr);
0308 ~TGCompositeFrame() override;
0309
0310 virtual TList *GetList() const { return fList; }
0311
0312 UInt_t GetDefaultWidth() const override
0313 { return GetDefaultSize().fWidth; }
0314 UInt_t GetDefaultHeight() const override
0315 { return GetDefaultSize().fHeight; }
0316 TGDimension GetDefaultSize() const override
0317 { return (IsLayoutBroken() ? TGDimension(fWidth, fHeight) :
0318 fLayoutManager->GetDefaultSize()); }
0319 TGFrame *GetFrameFromPoint(Int_t x, Int_t y) override;
0320 virtual Bool_t TranslateCoordinates(TGFrame *child, Int_t x, Int_t y,
0321 Int_t &fx, Int_t &fy);
0322 void MapSubwindows() override;
0323 void Layout() override;
0324 Bool_t HandleButton(Event_t *) override { return kFALSE; }
0325 Bool_t HandleDoubleClick(Event_t *) override { return kFALSE; }
0326 Bool_t HandleCrossing(Event_t *) override { return kFALSE; }
0327 Bool_t HandleMotion(Event_t *) override { return kFALSE; }
0328 Bool_t HandleKey(Event_t *) override { return kFALSE; }
0329 Bool_t HandleFocusChange(Event_t *) override { return kFALSE; }
0330 Bool_t HandleSelection(Event_t *) override { return kFALSE; }
0331 Bool_t HandleDragEnter(TGFrame *) override;
0332 Bool_t HandleDragLeave(TGFrame *) override;
0333 Bool_t HandleDragMotion(TGFrame *) override;
0334 Bool_t HandleDragDrop(TGFrame *frame, Int_t x, Int_t y, TGLayoutHints *lo) override;
0335 void ChangeOptions(UInt_t options) override;
0336 Bool_t ProcessMessage(Longptr_t, Longptr_t, Longptr_t) override { return kFALSE; }
0337
0338 virtual TGLayoutManager *GetLayoutManager() const { return fLayoutManager; }
0339 virtual void SetLayoutManager(TGLayoutManager *l);
0340
0341 virtual TGFrameElement* FindFrameElement(TGFrame *f) const;
0342
0343 virtual void AddFrame(TGFrame *f, TGLayoutHints *l = nullptr);
0344 virtual void RemoveAll();
0345 virtual void RemoveFrame(TGFrame *f);
0346 virtual void ShowFrame(TGFrame *f);
0347 virtual void HideFrame(TGFrame *f);
0348 Int_t GetState(TGFrame *f) const;
0349 Bool_t IsVisible(TGFrame *f) const;
0350 Bool_t IsVisible(TGFrameElement *ptr) const { return (ptr->fState & kIsVisible); }
0351 Bool_t IsArranged(TGFrame *f) const;
0352 Bool_t IsArranged(TGFrameElement *ptr) const { return (ptr->fState & kIsArranged); }
0353 Bool_t IsComposite() const override { return kTRUE; }
0354 Bool_t IsEditable() const override;
0355 void SetEditable(Bool_t on = kTRUE) override;
0356 void SetLayoutBroken(Bool_t on = kTRUE) override;
0357 Bool_t IsLayoutBroken() const override { return fLayoutBroken || !fLayoutManager; }
0358 void SetEditDisabled(UInt_t on = 1) override;
0359 void SetCleanup(Int_t mode = kLocalCleanup) override;
0360 Int_t MustCleanup() const override { return fMustCleanup; }
0361 virtual void Cleanup();
0362 void SetMapSubwindows(Bool_t on) override { fMapSubwindows = on; }
0363 Bool_t IsMapSubwindows() const override { return fMapSubwindows; }
0364
0365 void Print(Option_t *option="") const override;
0366 virtual void ChangeSubframesBackground(Pixel_t back);
0367 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0368 virtual void SavePrimitiveSubframes(std::ostream &out, Option_t *option = "");
0369
0370 ClassDefOverride(TGCompositeFrame,0)
0371 };
0372
0373
0374 class TGVerticalFrame : public TGCompositeFrame {
0375 public:
0376 TGVerticalFrame(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
0377 UInt_t options = kChildFrame,
0378 Pixel_t back = GetDefaultFrameBackground()) :
0379 TGCompositeFrame(p, w, h, options | kVerticalFrame, back) { SetWindowName(); }
0380 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0381
0382 ClassDefOverride(TGVerticalFrame,0)
0383 };
0384
0385 class TGHorizontalFrame : public TGCompositeFrame {
0386 public:
0387 TGHorizontalFrame(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
0388 UInt_t options = kChildFrame,
0389 Pixel_t back = GetDefaultFrameBackground()) :
0390 TGCompositeFrame(p, w, h, options | kHorizontalFrame, back) { SetWindowName(); }
0391 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0392
0393 ClassDefOverride(TGHorizontalFrame,0)
0394 };
0395
0396
0397 class TGMainFrame : public TGCompositeFrame {
0398
0399 protected:
0400 enum { kDontCallClose = BIT(14) };
0401
0402
0403 class TGMapKey : public TObject {
0404 private:
0405 TGMapKey(const TGMapKey&);
0406 TGMapKey& operator=(const TGMapKey&);
0407 public:
0408 UInt_t fKeyCode;
0409 TGWindow *fWindow;
0410 TGMapKey(UInt_t keycode, TGWindow *w): fKeyCode(keycode), fWindow(w) { }
0411 };
0412
0413 Atom_t *fDNDTypeList;
0414 TList *fBindList;
0415 TString fWindowName;
0416 TString fIconName;
0417 TString fIconPixmap;
0418 TString fClassName;
0419 TString fResourceName;
0420 UInt_t fMWMValue;
0421 UInt_t fMWMFuncs;
0422 UInt_t fMWMInput;
0423 Int_t fWMX;
0424 Int_t fWMY;
0425 UInt_t fWMWidth;
0426 UInt_t fWMHeight;
0427 UInt_t fWMMinWidth;
0428 UInt_t fWMMinHeight;
0429 UInt_t fWMMaxWidth;
0430 UInt_t fWMMaxHeight;
0431 UInt_t fWMWidthInc;
0432 UInt_t fWMHeightInc;
0433 EInitialState fWMInitState;
0434
0435 TString GetMWMvalueString() const;
0436 TString GetMWMfuncString() const;
0437 TString GetMWMinpString() const;
0438
0439 private:
0440 TGMainFrame(const TGMainFrame&) = delete;
0441 TGMainFrame& operator=(const TGMainFrame&) = delete;
0442
0443 public:
0444 TGMainFrame(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
0445 UInt_t options = kVerticalFrame);
0446 ~TGMainFrame() override;
0447
0448 Bool_t HandleKey(Event_t *event) override;
0449 Bool_t HandleClientMessage(Event_t *event) override;
0450 Bool_t HandleSelection(Event_t *event) override;
0451 Bool_t HandleSelectionRequest(Event_t *event) override;
0452 Bool_t HandleButton(Event_t *event) override;
0453 Bool_t HandleMotion(Event_t *event) override;
0454 virtual Bool_t SaveFrameAsCodeOrImage();
0455 virtual Bool_t SaveFrameAsCodeOrImage(const TString &fileName);
0456 virtual void SendCloseMessage();
0457 virtual void CloseWindow();
0458
0459 void DontCallClose();
0460 void SetWindowName(const char *name = nullptr) override;
0461 void SetIconName(const char *name);
0462 const TGPicture *SetIconPixmap(const char *iconName);
0463 void SetIconPixmap(char **xpm_array);
0464 void SetClassHints(const char *className, const char *resourceName);
0465 void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input);
0466 void SetWMPosition(Int_t x, Int_t y);
0467 void SetWMSize(UInt_t w, UInt_t h);
0468 void SetWMSizeHints(UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax,
0469 UInt_t winc, UInt_t hinc);
0470 void SetWMState(EInitialState state);
0471
0472 virtual Bool_t BindKey(const TGWindow *w, Int_t keycode, Int_t modifier) const;
0473 virtual void RemoveBind(const TGWindow *w, Int_t keycode, Int_t modifier) const;
0474 TList *GetBindList() const { return fBindList; }
0475
0476 const char *GetWindowName() const { return fWindowName; }
0477 const char *GetIconName() const override { return fIconName; }
0478 const char *GetIconPixmap() const { return fIconPixmap; }
0479 void GetClassHints(const char *&className, const char *&resourceName) const
0480 { className = fClassName.Data(); resourceName = fResourceName.Data(); }
0481 void GetMWMHints(UInt_t &value, UInt_t &funcs, UInt_t &input) const
0482 { value = fMWMValue; funcs = fMWMFuncs; input = fMWMInput; }
0483 void GetWMPosition(Int_t &x, Int_t &y) const { x = fWMX; y = fWMY; }
0484 void GetWMSize(UInt_t &w, UInt_t &h) const { w = fWMWidth; h = fWMHeight; }
0485 void GetWMSizeHints(UInt_t &wmin, UInt_t &hmin, UInt_t &wmax, UInt_t &hmax,
0486 UInt_t &winc, UInt_t &hinc) const
0487 { wmin = fWMMinWidth; hmin = fWMMinHeight; wmax = fWMMaxWidth;
0488 hmax = fWMMaxHeight; winc = fWMWidthInc; hinc = fWMHeightInc; }
0489 EInitialState GetWMState() const { return fWMInitState; }
0490
0491 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0492 virtual void SaveSource(const char *filename = "Rootappl.C", Option_t *option = "");
0493
0494 ClassDefOverride(TGMainFrame,0)
0495 };
0496
0497
0498 class TGTransientFrame : public TGMainFrame {
0499
0500 protected:
0501 const TGWindow *fMain;
0502
0503 private:
0504 TGTransientFrame(const TGTransientFrame&) = delete;
0505 TGTransientFrame& operator=(const TGTransientFrame&) = delete;
0506
0507 public:
0508 TGTransientFrame(const TGWindow *p = nullptr, const TGWindow *main = nullptr, UInt_t w = 1, UInt_t h = 1,
0509 UInt_t options = kVerticalFrame);
0510
0511 enum EPlacement { kCenter, kLeft, kRight, kTop, kBottom, kTopLeft, kTopRight,
0512 kBottomLeft, kBottomRight };
0513 virtual void CenterOnParent(Bool_t croot = kTRUE, EPlacement pos = kCenter);
0514 const TGWindow *GetMain() const { return fMain; }
0515 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0516 void SaveSource(const char *filename = "Rootdlog.C", Option_t *option = "") override;
0517
0518 ClassDefOverride(TGTransientFrame,0)
0519 };
0520
0521
0522 class TGGroupFrame : public TGCompositeFrame {
0523
0524 protected:
0525 TGString *fText;
0526 FontStruct_t fFontStruct;
0527 GContext_t fNormGC;
0528 Int_t fTitlePos;
0529 Bool_t fHasOwnFont;
0530
0531 void DoRedraw() override;
0532
0533 static const TGFont *fgDefaultFont;
0534 static const TGGC *fgDefaultGC;
0535
0536 private:
0537 TGGroupFrame(const TGGroupFrame&) = delete;
0538 TGGroupFrame& operator=(const TGGroupFrame&) = delete;
0539
0540 public:
0541 enum ETitlePos { kLeft = -1, kCenter = 0, kRight = 1 };
0542
0543 static FontStruct_t GetDefaultFontStruct();
0544 static const TGGC &GetDefaultGC();
0545
0546 TGGroupFrame(const TGWindow *p, TGString *title,
0547 UInt_t options = kVerticalFrame,
0548 GContext_t norm = GetDefaultGC()(),
0549 FontStruct_t font = GetDefaultFontStruct(),
0550 Pixel_t back = GetDefaultFrameBackground());
0551 TGGroupFrame(const TGWindow *p = nullptr, const char *title = nullptr,
0552 UInt_t options = kVerticalFrame,
0553 GContext_t norm = GetDefaultGC()(),
0554 FontStruct_t font = GetDefaultFontStruct(),
0555 Pixel_t back = GetDefaultFrameBackground());
0556 ~TGGroupFrame() override;
0557
0558 TGDimension GetDefaultSize() const override;
0559 void DrawBorder() override;
0560 virtual void SetTitle(TGString *title);
0561 virtual void SetTitle(const char *title);
0562 virtual void Rename(const char *title) { SetTitle(title); }
0563 Int_t GetTitlePos() const { return fTitlePos; }
0564 virtual void SetTitlePos(ETitlePos pos = kLeft) { fTitlePos = pos; }
0565 virtual void SetTextColor(Pixel_t color, Bool_t local = kTRUE);
0566 virtual void SetTextFont(const char *fontName, Bool_t local = kTRUE);
0567 virtual void SetTextFont(FontStruct_t font, Bool_t local = kTRUE);
0568 GContext_t GetNormGC() const { return fNormGC; }
0569 FontStruct_t GetFontStruct() const { return fFontStruct; }
0570
0571 const char *GetTitle() const override { return fText->GetString(); }
0572 Bool_t HasOwnFont() const;
0573
0574 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0575
0576 ClassDefOverride(TGGroupFrame,0)
0577 };
0578
0579
0580 class TGHeaderFrame : public TGHorizontalFrame {
0581 private:
0582 TGHeaderFrame(const TGHeaderFrame&) = delete;
0583 TGHeaderFrame& operator=(const TGHeaderFrame&) = delete;
0584
0585 protected:
0586 Int_t fNColumns;
0587 TGTextButton **fColHeader;
0588 TGVFileSplitter **fSplitHeader;
0589 Cursor_t fSplitCursor;
0590 Bool_t fOverSplitter;
0591 Int_t fOverButton;
0592 Int_t fLastButton;
0593
0594 public:
0595 TGHeaderFrame(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
0596 UInt_t options = kChildFrame,
0597 Pixel_t back = GetDefaultFrameBackground());
0598
0599 Bool_t HandleButton(Event_t* event) override;
0600 Bool_t HandleMotion(Event_t* event) override;
0601 Bool_t HandleDoubleClick(Event_t *event) override;
0602
0603 void SetColumnsInfo(Int_t nColumns, TGTextButton **colHeader, TGVFileSplitter **splitHeader);
0604
0605 ClassDefOverride(TGHeaderFrame,0)
0606 };
0607
0608
0609 #endif