File indexing completed on 2025-09-16 09:09:34
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 TString SaveCtorArgs(std::ostream &out, UInt_t dflt_options = kChildFrame, Bool_t check_white_pixel = kFALSE);
0132
0133 private:
0134 TGFrame(const TGFrame&) = delete;
0135 TGFrame& operator=(const TGFrame&) = delete;
0136
0137 public:
0138
0139 static Pixel_t GetDefaultFrameBackground();
0140 static Pixel_t GetDefaultSelectedBackground();
0141 static Pixel_t GetWhitePixel();
0142 static Pixel_t GetBlackPixel();
0143 static const TGGC &GetBlackGC();
0144 static const TGGC &GetWhiteGC();
0145 static const TGGC &GetHilightGC();
0146 static const TGGC &GetShadowGC();
0147 static const TGGC &GetBckgndGC();
0148
0149 TGFrame(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
0150 UInt_t options = 0, Pixel_t back = GetDefaultFrameBackground());
0151 TGFrame(TGClient *c, Window_t id, const TGWindow *parent = nullptr);
0152 ~TGFrame() override;
0153
0154 virtual void DeleteWindow();
0155 virtual void ReallyDelete() { delete this; }
0156
0157 UInt_t GetEventMask() const { return fEventMask; }
0158 void AddInput(UInt_t emask);
0159 void RemoveInput(UInt_t emask);
0160
0161 Bool_t HandleEvent(Event_t *event) override;
0162 virtual Bool_t HandleConfigureNotify(Event_t *event);
0163 virtual Bool_t HandleButton(Event_t *) { return kFALSE; }
0164 virtual Bool_t HandleDoubleClick(Event_t *) { return kFALSE; }
0165 virtual Bool_t HandleCrossing(Event_t *) { return kFALSE; }
0166 virtual Bool_t HandleMotion(Event_t *) { return kFALSE; }
0167 virtual Bool_t HandleKey(Event_t *) { return kFALSE; }
0168 virtual Bool_t HandleFocusChange(Event_t *) { return kFALSE; }
0169 virtual Bool_t HandleClientMessage(Event_t *event);
0170 virtual Bool_t HandleSelection(Event_t *) { return kFALSE; }
0171 virtual Bool_t HandleSelectionRequest(Event_t *) { return kFALSE; }
0172 virtual Bool_t HandleSelectionClear(Event_t *) { return kFALSE; }
0173 virtual Bool_t HandleColormapChange(Event_t *) { return kFALSE; }
0174 virtual Bool_t HandleDragEnter(TGFrame *) { return kFALSE; }
0175 virtual Bool_t HandleDragLeave(TGFrame *) { return kFALSE; }
0176 virtual Bool_t HandleDragMotion(TGFrame *) { return kFALSE; }
0177 virtual Bool_t HandleDragDrop(TGFrame *, Int_t , Int_t , TGLayoutHints*)
0178 { return kFALSE; }
0179 virtual void ProcessedConfigure(Event_t *event)
0180 { Emit("ProcessedConfigure(Event_t*)", (Longptr_t)event); }
0181 virtual void ProcessedEvent(Event_t *event)
0182 { Emit("ProcessedEvent(Event_t*)", (Longptr_t)event); }
0183
0184 virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2);
0185 virtual Bool_t ProcessMessage(Longptr_t, Longptr_t, Longptr_t) { return kFALSE; }
0186
0187 virtual TGDimension GetDefaultSize() const ;
0188 void Move(Int_t x, Int_t y) override;
0189 void Resize(UInt_t w = 0, UInt_t h = 0) override;
0190 virtual void Resize(TGDimension size);
0191 void MoveResize(Int_t x, Int_t y, UInt_t w = 0, UInt_t h = 0) override;
0192 virtual UInt_t GetDefaultWidth() const { return GetDefaultSize().fWidth; }
0193 virtual UInt_t GetDefaultHeight() const { return GetDefaultSize().fHeight; }
0194 virtual Pixel_t GetBackground() const { return fBackground; }
0195 virtual void ChangeBackground(Pixel_t back);
0196 void SetBackgroundColor(Pixel_t back) override;
0197 virtual Pixel_t GetForeground() const;
0198 virtual void SetForegroundColor(Pixel_t ) { }
0199 virtual UInt_t GetOptions() const { return fOptions; }
0200 virtual void ChangeOptions(UInt_t options);
0201 virtual void Layout() { }
0202 void MapSubwindows() override {}
0203
0204 void ReparentWindow(const TGWindow *p, Int_t x = 0, Int_t y = 0) override
0205 { TGWindow::ReparentWindow(p, x, y); Move(x, y); }
0206 void MapWindow() override { TGWindow::MapWindow(); if (fFE) fFE->fState |= kIsVisible; }
0207 void MapRaised() override { TGWindow::MapRaised(); if (fFE) fFE->fState |= kIsVisible; }
0208 void UnmapWindow() override { TGWindow::UnmapWindow(); if (fFE) fFE->fState &= ~kIsVisible; }
0209
0210 virtual void DrawBorder();
0211 virtual void DrawCopy(Handle_t , Int_t , Int_t ) { }
0212 virtual void Activate(Bool_t) { }
0213 virtual Bool_t IsActive() const { return kFALSE; }
0214 virtual Bool_t IsComposite() const { return kFALSE; }
0215 Bool_t IsEditable() const override { return kFALSE; }
0216 void SetEditable(Bool_t) override {}
0217 virtual void SetLayoutBroken(Bool_t = kTRUE) {}
0218 virtual Bool_t IsLayoutBroken() const { return kFALSE; }
0219 virtual void SetCleanup(Int_t = kLocalCleanup) { }
0220
0221 virtual void SetDragType(Int_t type);
0222 virtual void SetDropType(Int_t type);
0223 virtual Int_t GetDragType() const;
0224 virtual Int_t GetDropType() const;
0225
0226 UInt_t GetWidth() const { return fWidth; }
0227 UInt_t GetHeight() const { return fHeight; }
0228 UInt_t GetMinWidth() const { return fMinWidth; }
0229 UInt_t GetMinHeight() const { return fMinHeight; }
0230 UInt_t GetMaxWidth() const { return fMaxWidth; }
0231 UInt_t GetMaxHeight() const { return fMaxHeight; }
0232 TGDimension GetSize() const { return TGDimension(fWidth, fHeight); }
0233 Int_t GetX() const { return fX; }
0234 Int_t GetY() const { return fY; }
0235 Int_t GetBorderWidth() const { return fBorderWidth; }
0236
0237 TGFrameElement *GetFrameElement() const { return fFE; }
0238 void SetFrameElement(TGFrameElement *fe) { fFE = fe; }
0239
0240 Bool_t Contains(Int_t x, Int_t y) const
0241 { return ((x >= 0) && (x < (Int_t)fWidth) && (y >= 0) && (y < (Int_t)fHeight)); }
0242 virtual TGFrame *GetFrameFromPoint(Int_t x, Int_t y)
0243 { return Contains(x, y) ? this : nullptr; }
0244
0245
0246 virtual void SetX(Int_t x) { fX = x; }
0247 virtual void SetY(Int_t y) { fY = y; }
0248 virtual void SetWidth(UInt_t w) { fWidth = w; }
0249 virtual void SetHeight(UInt_t h) { fHeight = h; }
0250 virtual void SetMinWidth(UInt_t w) { fMinWidth = w; }
0251 virtual void SetMinHeight(UInt_t h) { fMinHeight = h; }
0252 virtual void SetMaxWidth(UInt_t w) { fMaxWidth = w; }
0253 virtual void SetMaxHeight(UInt_t h) { fMaxHeight = h; }
0254 virtual void SetSize(const TGDimension &s) { fWidth = s.fWidth; fHeight = s.fHeight; }
0255
0256
0257 void Print(Option_t *option="") const override;
0258 void SaveUserColor(std::ostream &out, Option_t *);
0259 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0260
0261
0262 void Delete(Option_t * ="") override {}
0263 TObject *DrawClone(Option_t * ="") const override { return nullptr; }
0264 void DrawClass() const override {}
0265 void Dump() const override {}
0266 void Inspect() const override {}
0267 void SetDrawOption(Option_t * ="") override {}
0268
0269
0270 void SetDNDSource(Bool_t onoff)
0271 { if (onoff) fDNDState |= kIsDNDSource; else fDNDState &= ~kIsDNDSource; }
0272 void SetDNDTarget(Bool_t onoff)
0273 { if (onoff) fDNDState |= kIsDNDTarget; else fDNDState &= ~kIsDNDTarget; }
0274 Bool_t IsDNDSource() const { return fDNDState & kIsDNDSource; }
0275 Bool_t IsDNDTarget() const { return fDNDState & kIsDNDTarget; }
0276
0277 virtual TDNDData *GetDNDData(Atom_t ) { return nullptr; }
0278 virtual Bool_t HandleDNDDrop(TDNDData * ) { return kFALSE; }
0279 virtual Atom_t HandleDNDPosition(Int_t , Int_t , Atom_t ,
0280 Int_t , Int_t ) { return kNone; }
0281 virtual Atom_t HandleDNDEnter(Atom_t * ) { return kNone; }
0282 virtual Bool_t HandleDNDLeave() { return kFALSE; }
0283 virtual Bool_t HandleDNDFinished() { return kFALSE; }
0284
0285 ClassDefOverride(TGFrame,0)
0286 };
0287
0288
0289 class TGCompositeFrame : public TGFrame {
0290
0291
0292 protected:
0293 TGLayoutManager *fLayoutManager;
0294 TList *fList;
0295 Bool_t fLayoutBroken;
0296 Int_t fMustCleanup;
0297 Bool_t fMapSubwindows;
0298
0299 static TGLayoutHints *fgDefaultHints;
0300
0301 private:
0302 TGCompositeFrame(const TGCompositeFrame&) = delete;
0303 TGCompositeFrame& operator=(const TGCompositeFrame&) = delete;
0304
0305 public:
0306 TGCompositeFrame(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
0307 UInt_t options = 0,
0308 Pixel_t back = GetDefaultFrameBackground());
0309 TGCompositeFrame(TGClient *c, Window_t id, const TGWindow *parent = nullptr);
0310 ~TGCompositeFrame() override;
0311
0312 virtual TList *GetList() const { return fList; }
0313
0314 UInt_t GetDefaultWidth() const override
0315 { return GetDefaultSize().fWidth; }
0316 UInt_t GetDefaultHeight() const override
0317 { return GetDefaultSize().fHeight; }
0318 TGDimension GetDefaultSize() const override
0319 { return (IsLayoutBroken() ? TGDimension(fWidth, fHeight) :
0320 fLayoutManager->GetDefaultSize()); }
0321 TGFrame *GetFrameFromPoint(Int_t x, Int_t y) override;
0322 virtual Bool_t TranslateCoordinates(TGFrame *child, Int_t x, Int_t y,
0323 Int_t &fx, Int_t &fy);
0324 void MapSubwindows() override;
0325 void Layout() override;
0326 Bool_t HandleButton(Event_t *) override { return kFALSE; }
0327 Bool_t HandleDoubleClick(Event_t *) override { return kFALSE; }
0328 Bool_t HandleCrossing(Event_t *) override { return kFALSE; }
0329 Bool_t HandleMotion(Event_t *) override { return kFALSE; }
0330 Bool_t HandleKey(Event_t *) override { return kFALSE; }
0331 Bool_t HandleFocusChange(Event_t *) override { return kFALSE; }
0332 Bool_t HandleSelection(Event_t *) override { return kFALSE; }
0333 Bool_t HandleDragEnter(TGFrame *) override;
0334 Bool_t HandleDragLeave(TGFrame *) override;
0335 Bool_t HandleDragMotion(TGFrame *) override;
0336 Bool_t HandleDragDrop(TGFrame *frame, Int_t x, Int_t y, TGLayoutHints *lo) override;
0337 void ChangeOptions(UInt_t options) override;
0338 Bool_t ProcessMessage(Longptr_t, Longptr_t, Longptr_t) override { return kFALSE; }
0339
0340 virtual TGLayoutManager *GetLayoutManager() const { return fLayoutManager; }
0341 virtual void SetLayoutManager(TGLayoutManager *l);
0342
0343 virtual TGFrameElement* FindFrameElement(TGFrame *f) const;
0344
0345 virtual void AddFrame(TGFrame *f, TGLayoutHints *l = nullptr);
0346 virtual void RemoveAll();
0347 virtual void RemoveFrame(TGFrame *f);
0348 virtual void ShowFrame(TGFrame *f);
0349 virtual void HideFrame(TGFrame *f);
0350 Int_t GetState(TGFrame *f) const;
0351 Bool_t IsVisible(TGFrame *f) const;
0352 Bool_t IsVisible(TGFrameElement *ptr) const { return (ptr->fState & kIsVisible); }
0353 Bool_t IsArranged(TGFrame *f) const;
0354 Bool_t IsArranged(TGFrameElement *ptr) const { return (ptr->fState & kIsArranged); }
0355 Bool_t IsComposite() const override { return kTRUE; }
0356 Bool_t IsEditable() const override;
0357 void SetEditable(Bool_t on = kTRUE) override;
0358 void SetLayoutBroken(Bool_t on = kTRUE) override;
0359 Bool_t IsLayoutBroken() const override { return fLayoutBroken || !fLayoutManager; }
0360 void SetEditDisabled(UInt_t on = 1) override;
0361 void SetCleanup(Int_t mode = kLocalCleanup) override;
0362 Int_t MustCleanup() const override { return fMustCleanup; }
0363 virtual void Cleanup();
0364 void SetMapSubwindows(Bool_t on) override { fMapSubwindows = on; }
0365 Bool_t IsMapSubwindows() const override { return fMapSubwindows; }
0366
0367 void Print(Option_t *option="") const override;
0368 virtual void ChangeSubframesBackground(Pixel_t back);
0369 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0370 virtual void SavePrimitiveSubframes(std::ostream &out, Option_t *option = "");
0371
0372 ClassDefOverride(TGCompositeFrame,0)
0373 };
0374
0375
0376 class TGVerticalFrame : public TGCompositeFrame {
0377 public:
0378 TGVerticalFrame(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
0379 UInt_t options = kChildFrame,
0380 Pixel_t back = GetDefaultFrameBackground()) :
0381 TGCompositeFrame(p, w, h, options | kVerticalFrame, back) { SetWindowName(); }
0382 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0383
0384 ClassDefOverride(TGVerticalFrame,0)
0385 };
0386
0387 class TGHorizontalFrame : public TGCompositeFrame {
0388 public:
0389 TGHorizontalFrame(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
0390 UInt_t options = kChildFrame,
0391 Pixel_t back = GetDefaultFrameBackground()) :
0392 TGCompositeFrame(p, w, h, options | kHorizontalFrame, back) { SetWindowName(); }
0393 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0394
0395 ClassDefOverride(TGHorizontalFrame,0)
0396 };
0397
0398
0399 class TGMainFrame : public TGCompositeFrame {
0400
0401 protected:
0402 enum { kDontCallClose = BIT(14) };
0403
0404
0405 class TGMapKey : public TObject {
0406 private:
0407 TGMapKey(const TGMapKey&);
0408 TGMapKey& operator=(const TGMapKey&);
0409 public:
0410 UInt_t fKeyCode;
0411 TGWindow *fWindow;
0412 TGMapKey(UInt_t keycode, TGWindow *w): fKeyCode(keycode), fWindow(w) { }
0413 };
0414
0415 Atom_t *fDNDTypeList;
0416 TList *fBindList;
0417 TString fWindowName;
0418 TString fIconName;
0419 TString fIconPixmap;
0420 TString fClassName;
0421 TString fResourceName;
0422 UInt_t fMWMValue;
0423 UInt_t fMWMFuncs;
0424 UInt_t fMWMInput;
0425 Int_t fWMX;
0426 Int_t fWMY;
0427 UInt_t fWMWidth;
0428 UInt_t fWMHeight;
0429 UInt_t fWMMinWidth;
0430 UInt_t fWMMinHeight;
0431 UInt_t fWMMaxWidth;
0432 UInt_t fWMMaxHeight;
0433 UInt_t fWMWidthInc;
0434 UInt_t fWMHeightInc;
0435 EInitialState fWMInitState;
0436
0437 TString GetMWMvalueString() const;
0438 TString GetMWMfuncString() const;
0439 TString GetMWMinpString() const;
0440
0441 private:
0442 TGMainFrame(const TGMainFrame&) = delete;
0443 TGMainFrame& operator=(const TGMainFrame&) = delete;
0444
0445 public:
0446 TGMainFrame(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
0447 UInt_t options = kVerticalFrame);
0448 ~TGMainFrame() override;
0449
0450 Bool_t HandleKey(Event_t *event) override;
0451 Bool_t HandleClientMessage(Event_t *event) override;
0452 Bool_t HandleSelection(Event_t *event) override;
0453 Bool_t HandleSelectionRequest(Event_t *event) override;
0454 Bool_t HandleButton(Event_t *event) override;
0455 Bool_t HandleMotion(Event_t *event) override;
0456 virtual Bool_t SaveFrameAsCodeOrImage();
0457 virtual Bool_t SaveFrameAsCodeOrImage(const TString &fileName);
0458 virtual void SendCloseMessage();
0459 virtual void CloseWindow();
0460
0461 void DontCallClose();
0462 void SetWindowName(const char *name = nullptr) override;
0463 void SetIconName(const char *name);
0464 const TGPicture *SetIconPixmap(const char *iconName);
0465 void SetIconPixmap(char **xpm_array);
0466 void SetClassHints(const char *className, const char *resourceName);
0467 void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input);
0468 void SetWMPosition(Int_t x, Int_t y);
0469 void SetWMSize(UInt_t w, UInt_t h);
0470 void SetWMSizeHints(UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax,
0471 UInt_t winc, UInt_t hinc);
0472 void SetWMState(EInitialState state);
0473
0474 virtual Bool_t BindKey(const TGWindow *w, Int_t keycode, Int_t modifier) const;
0475 virtual void RemoveBind(const TGWindow *w, Int_t keycode, Int_t modifier) const;
0476 TList *GetBindList() const { return fBindList; }
0477
0478 const char *GetWindowName() const { return fWindowName; }
0479 const char *GetIconName() const override { return fIconName; }
0480 const char *GetIconPixmap() const { return fIconPixmap; }
0481 void GetClassHints(const char *&className, const char *&resourceName) const
0482 { className = fClassName.Data(); resourceName = fResourceName.Data(); }
0483 void GetMWMHints(UInt_t &value, UInt_t &funcs, UInt_t &input) const
0484 { value = fMWMValue; funcs = fMWMFuncs; input = fMWMInput; }
0485 void GetWMPosition(Int_t &x, Int_t &y) const { x = fWMX; y = fWMY; }
0486 void GetWMSize(UInt_t &w, UInt_t &h) const { w = fWMWidth; h = fWMHeight; }
0487 void GetWMSizeHints(UInt_t &wmin, UInt_t &hmin, UInt_t &wmax, UInt_t &hmax,
0488 UInt_t &winc, UInt_t &hinc) const
0489 { wmin = fWMMinWidth; hmin = fWMMinHeight; wmax = fWMMaxWidth;
0490 hmax = fWMMaxHeight; winc = fWMWidthInc; hinc = fWMHeightInc; }
0491 EInitialState GetWMState() const { return fWMInitState; }
0492
0493 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0494 virtual void SaveSource(const char *filename = "Rootappl.C", Option_t *option = "");
0495
0496 ClassDefOverride(TGMainFrame,0)
0497 };
0498
0499
0500 class TGTransientFrame : public TGMainFrame {
0501
0502 protected:
0503 const TGWindow *fMain;
0504
0505 private:
0506 TGTransientFrame(const TGTransientFrame&) = delete;
0507 TGTransientFrame& operator=(const TGTransientFrame&) = delete;
0508
0509 public:
0510 TGTransientFrame(const TGWindow *p = nullptr, const TGWindow *main = nullptr, UInt_t w = 1, UInt_t h = 1,
0511 UInt_t options = kVerticalFrame);
0512
0513 enum EPlacement { kCenter, kLeft, kRight, kTop, kBottom, kTopLeft, kTopRight,
0514 kBottomLeft, kBottomRight };
0515 virtual void CenterOnParent(Bool_t croot = kTRUE, EPlacement pos = kCenter);
0516 const TGWindow *GetMain() const { return fMain; }
0517 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0518 void SaveSource(const char *filename = "Rootdlog.C", Option_t *option = "") override;
0519
0520 ClassDefOverride(TGTransientFrame,0)
0521 };
0522
0523
0524 class TGGroupFrame : public TGCompositeFrame {
0525
0526 protected:
0527 TGString *fText;
0528 FontStruct_t fFontStruct;
0529 GContext_t fNormGC;
0530 Int_t fTitlePos;
0531 Bool_t fHasOwnFont;
0532
0533 void DoRedraw() override;
0534
0535 static const TGFont *fgDefaultFont;
0536 static const TGGC *fgDefaultGC;
0537
0538 private:
0539 TGGroupFrame(const TGGroupFrame&) = delete;
0540 TGGroupFrame& operator=(const TGGroupFrame&) = delete;
0541
0542 public:
0543 enum ETitlePos { kLeft = -1, kCenter = 0, kRight = 1 };
0544
0545 static FontStruct_t GetDefaultFontStruct();
0546 static const TGGC &GetDefaultGC();
0547
0548 TGGroupFrame(const TGWindow *p, TGString *title,
0549 UInt_t options = kVerticalFrame,
0550 GContext_t norm = GetDefaultGC()(),
0551 FontStruct_t font = GetDefaultFontStruct(),
0552 Pixel_t back = GetDefaultFrameBackground());
0553 TGGroupFrame(const TGWindow *p = nullptr, const char *title = nullptr,
0554 UInt_t options = kVerticalFrame,
0555 GContext_t norm = GetDefaultGC()(),
0556 FontStruct_t font = GetDefaultFontStruct(),
0557 Pixel_t back = GetDefaultFrameBackground());
0558 ~TGGroupFrame() override;
0559
0560 TGDimension GetDefaultSize() const override;
0561 void DrawBorder() override;
0562 virtual void SetTitle(TGString *title);
0563 virtual void SetTitle(const char *title);
0564 virtual void Rename(const char *title) { SetTitle(title); }
0565 Int_t GetTitlePos() const { return fTitlePos; }
0566 virtual void SetTitlePos(ETitlePos pos = kLeft) { fTitlePos = pos; }
0567 virtual void SetTextColor(Pixel_t color, Bool_t local = kTRUE);
0568 virtual void SetTextFont(const char *fontName, Bool_t local = kTRUE);
0569 virtual void SetTextFont(FontStruct_t font, Bool_t local = kTRUE);
0570 GContext_t GetNormGC() const { return fNormGC; }
0571 FontStruct_t GetFontStruct() const { return fFontStruct; }
0572
0573 const char *GetTitle() const override { return fText->GetString(); }
0574 Bool_t HasOwnFont() const;
0575
0576 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0577
0578 ClassDefOverride(TGGroupFrame,0)
0579 };
0580
0581
0582 class TGHeaderFrame : public TGHorizontalFrame {
0583 private:
0584 TGHeaderFrame(const TGHeaderFrame&) = delete;
0585 TGHeaderFrame& operator=(const TGHeaderFrame&) = delete;
0586
0587 protected:
0588 Int_t fNColumns;
0589 TGTextButton **fColHeader;
0590 TGVFileSplitter **fSplitHeader;
0591 Cursor_t fSplitCursor;
0592 Bool_t fOverSplitter;
0593 Int_t fOverButton;
0594 Int_t fLastButton;
0595
0596 public:
0597 TGHeaderFrame(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
0598 UInt_t options = kChildFrame,
0599 Pixel_t back = GetDefaultFrameBackground());
0600
0601 Bool_t HandleButton(Event_t* event) override;
0602 Bool_t HandleMotion(Event_t* event) override;
0603 Bool_t HandleDoubleClick(Event_t *event) override;
0604
0605 void SetColumnsInfo(Int_t nColumns, TGTextButton **colHeader, TGVFileSplitter **splitHeader);
0606
0607 ClassDefOverride(TGHeaderFrame,0)
0608 };
0609
0610
0611 #endif