GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
GPopup.cxx
Go to the documentation of this file.
1#include <sys/stat.h>
2#include <cstdio>
3#include <iostream>
4
5#include "TGButton.h"
6#include "TGListView.h"
7
8#include "GPopup.h"
9
10GPopup::GPopup(const TGWindow* p, const TGWindow* main, UInt_t w, UInt_t h, UInt_t options)
11 : TGTransientFrame(p, main, w, h, options)
12{
13 SetCleanup(kDeepCleanup);
14
15 auto* vframe = new TGVerticalFrame(this, 500, 200);
16
17 auto* listv = new TGListView(vframe, 500, 200);
18 auto* listc = new TGLVContainer(listv->GetViewPort(), 500, 200, kHorizontalFrame, fgWhitePixel);
19 listv->SetContainer(listc);
20 listv->GetViewPort()->SetBackgroundColor(fgWhitePixel);
21 listv->SetViewMode(kLVList);
22
23 vframe->AddFrame(listv, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
24
25 auto* hframe = new TGHorizontalFrame(vframe, 500, 20);
26 auto* b1 = new TGTextButton(hframe, "&button1");
27 auto* b2 = new TGTextButton(hframe, "&button2");
28 b1->Connect("Clicked()", "GPopup", this, "Print()");
29 b2->Connect("Clicked()", "GPopup", this, "Print()");
30
31 hframe->AddFrame(b1, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
32 hframe->AddFrame(b2, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
33
34 vframe->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX));
35
36 AddFrame(vframe, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
37
38 MapSubwindows();
39 Resize(); // resize to default size
40 // position relative to the parent's window
41 CenterOnParent();
42 MapWindow();
43}
44
45void GPopup::Print(Option_t*) const
46{
47 std::cout << __PRETTY_FUNCTION__ << " was called." << std::endl; // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay)
48}
49
51{
52 DeleteWindow();
53}
54
55Bool_t GPopup::ProcessMessage(Long_t, Long_t, Long_t)
56{
57 return true;
58}
int main(int argc, char **argv)
GPopup(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h, UInt_t options=kVerticalFrame)
Definition GPopup.cxx:10
Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) override
Definition GPopup.cxx:55
void Print(Option_t *opt="") const override
Definition GPopup.cxx:45
void CloseWindow() override
Definition GPopup.cxx:50