74#include "RConfigure.h"
202 menuTitle->
GetMenu()->
Connect(
"PoppedUp()",
"TGMenuBar",
this,
"PopupConnection()");
223 beforeMenu = beforeMenuTitle->
GetMenu();
292 const char* signal_name = connlist->GetName();
293 TIter next2(connlist);
295 const char* slot_name = conn->GetName();
296 void* receiver = conn->GetReceiver();
297 fMenuMore->Disconnect(signal_name, receiver, slot_name);
313 const char* signal_name = connlist->GetName();
314 if (strcmp(signal_name,
"Activated(int)") == 0) {
315 TIter next2(connlist);
318 const char* slot_name = conn->GetName();
319 const char* class_name = conn->GetClassName();
320 void* receiver = conn->GetReceiver();
321 fMenuMore->Connect(signal_name, class_name, receiver, slot_name);
361 hot =
e->GetLabel()->GetHotChar();
383 if (!
main || !
main->InheritsFrom(
"TGMainFrame"))
return;
438 if ((keycode = title->GetHotKeyCode()) != 0) {
502 if (!
f->InheritsFrom(
"TGMenuTitle")) {
503 Error(
"AddFrameBefore",
"may only add TGMenuTitle objects to a menu bar");
524 fList->AddBefore(el, nw);
598 dummy, dummy, wtarget);
631 dummy, dummy, wtarget);
695 gVirtualX->LookupString(event, tmp,
sizeof(tmp), keysym);
706 if (el == 0) target = 0;
729 while ( currentEntry ) {
731 currentMenu = currentEntry->
GetPopup();
732 if ( currentEntry != currentMenu->
GetCurrent() )
743 if (!hot || (hot != keysym))
continue;
973 gClient->UnregisterPopup(
this);
1016 UInt_t tw, ph = 0, pw = 0;
1028 Int_t max_ascent, max_descent;
1029 nw->
fEw = tw + pw +18+12;
1111 UInt_t tw, ph = 0, pw = 0;
1119 Int_t max_ascent, max_descent;
1120 nw->
fEw = tw + pw +18+12;
1177 Int_t max_ascent, max_descent;
1178 nw->
fEw = tw + pw+18+12;
1251 if (
gVirtualX->InheritsFrom(
"TGWin32")) {
1299 id =
fCurrent->fPopup->EndMenu(userData);
1320 gClient->UnregisterPopup(
this);
1393 static Int_t twice = 0;
1471 (
fCurrent->fPopup->GetParent())->GetId(),
1521 int max_ascent, max_descent;
1522 gVirtualX->GetFontProperties(font, max_ascent, max_descent);
1523 int tx = entry->
fEx +
fXl;
1525 int offset = (entry->
fEh - (max_ascent + max_descent)) / 2;
1526 int ty = entry->
fEy + max_ascent + offset - 1;
1530 switch (entry->
fType) {
1546 if (entry->
fPic != 0)
1566 if (entry->
fPic != 0)
1602 if (
gClient->GetStyle() > 0) {
1632 int m = (t +
b) >> 1;
1651 t = (t +
b - 8) >> 1; ++t;
1653 seg[0].
fX1 = 1+
l; seg[0].
fY1 = 3+t; seg[0].
fX2 = 3+
l; seg[0].
fY2 = 5+t;
1654 seg[1].
fX1 = 1+
l; seg[1].
fY1 = 4+t; seg[1].
fX2 = 3+
l; seg[1].
fY2 = 6+t;
1655 seg[2].
fX1 = 1+
l; seg[2].
fY1 = 5+t; seg[2].
fX2 = 3+
l; seg[2].
fY2 = 7+t;
1656 seg[3].
fX1 = 3+
l; seg[3].
fY1 = 5+t; seg[3].
fX2 = 7+
l; seg[3].
fY2 = 1+t;
1657 seg[4].
fX1 = 3+
l; seg[4].
fY1 = 6+t; seg[4].
fX2 = 7+
l; seg[4].
fY2 = 2+t;
1658 seg[5].
fX1 = 3+
l; seg[5].
fY1 = 7+t; seg[5].
fX2 = 7+
l; seg[5].
fY2 = 3+t;
1670 t = (t +
b - 5) >> 1; ++t;
1671 l = (
l +
r - 5) >> 1; ++
l;
1673 seg[0].
fX1 = 1+
l; seg[0].
fY1 = 0+t; seg[0].
fX2 = 3+
l; seg[0].
fY2 = 0+t;
1674 seg[1].
fX1 = 0+
l; seg[1].
fY1 = 1+t; seg[1].
fX2 = 4+
l; seg[1].
fY2 = 1+t;
1675 seg[2].
fX1 = 0+
l; seg[2].
fY1 = 2+t; seg[2].
fX2 = 4+
l; seg[2].
fY2 = 2+t;
1676 seg[3].
fX1 = 0+
l; seg[3].
fY1 = 3+t; seg[3].
fX2 = 4+
l; seg[3].
fY2 = 3+t;
1677 seg[4].
fX1 = 1+
l; seg[4].
fY1 = 4+t; seg[4].
fX2 = 3+
l; seg[4].
fY2 = 4+t;
2039 Int_t max_ascent, max_descent;
2044 Resize(tw + 8, max_ascent + max_descent + 7);
2048 fMenu->SetMenuBar(bar);
2064 0, 0, ax, ay, wdummy);
2088 int x,
y, max_ascent, max_descent;
2095 if (
gClient->GetStyle() > 1) {
2107 if (
fMenu &&
fMenu->fMenuBar &&
fMenu->fMenuBar->GetBackground() != back)
2108 back =
fMenu->fMenuBar->GetBackground();
2110 if (
gClient->GetStyle() > 1) {
2172 out <<
" TGPopupMenu *" <<
GetName() <<
" = new TGPopupMenu(gClient->GetDefaultRoot()"
2176 Int_t r_first, r_last, r_active;
2177 r_active = r_first = r_last = -1;
2181 while (
auto mentry =
static_cast<TGMenuEntry *
> (next())) {
2182 Int_t hotpos = mentry->fLabel ? mentry->fLabel->GetHotPos() : 0;
2183 TString outtext = mentry->GetName(), pic_prefix;
2184 if ((hotpos > 0) && (hotpos < outtext.
Length()))
2185 outtext.
Insert(hotpos - 1,
"&");
2186 if (mentry->fShortcut) {
2188 outtext.
Append(mentry->fShortcut->GetString());
2192 switch (mentry->GetType()) {
2194 out <<
" " <<
GetName() <<
"->AddEntry(\"" << outtext <<
"\", " << mentry->GetEntryId();
2195 pic_prefix =
", nullptr, ";
2198 out <<
"\n // cascaded menu \"" << mentry->GetName() <<
"\"\n";
2199 mentry->fPopup->SavePrimitive(out, option);
2200 out <<
" " <<
GetName() <<
"->AddPopup(\"" << outtext <<
"\", " << mentry->fPopup->GetName();
2201 pic_prefix =
", nullptr, ";
2204 out <<
" " <<
GetName() <<
"->AddLabel(\"" << outtext <<
"\"";
2209 if (pic_prefix.Length() && mentry->fPic) {
2210 TString picname =
gSystem->UnixPathName(mentry->fPic->GetName());
2211 gSystem->ExpandPathName(picname);
2217 out <<
" " <<
GetName() <<
"->DisableEntry(" << mentry->GetEntryId() <<
");\n";
2219 out <<
" " <<
GetName() <<
"->HideEntry(" << mentry->GetEntryId() <<
");\n";
2221 out <<
" " <<
GetName() <<
"->CheckEntry(" << mentry->GetEntryId() <<
");\n";
2223 out <<
" " <<
GetName() <<
"->DefaultEntry(" << mentry->GetEntryId() <<
");\n";
2226 r_last = mentry->GetEntryId();
2228 r_active = mentry->GetEntryId();
2230 r_first = mentry->GetEntryId();
2233 r_active = mentry->GetEntryId();
2235 }
else if (hasradio) {
2236 out <<
" " <<
GetName() <<
"->RCheckEntry(" << r_active <<
"," << r_first <<
"," << r_last <<
");\n";
2238 r_active = r_first = r_last = -1;
2248 out <<
"\n // \"" <<
fLabel->GetString() <<
"\" menu\n";
2250 fMenu->SavePrimitive(out, option);
2255 outtext.
Insert(hotpos - 1,
"&");
2257 <<
fMenu->GetName();
2265 out <<
"\n // menu bar\n";
2266 out <<
" TGMenuBar *" <<
GetName() <<
" = new TGMenuBar(" <<
fParent->GetName() <<
"," <<
GetWidth() <<
","
2268 if (option && strstr(option,
"keep_names"))
2269 out <<
" " <<
GetName() <<
"->SetName(\"" <<
GetName() <<
"\");\n";
2277 el->fFrame->SavePrimitive(out, option);
2278 el->fLayout->SavePrimitive(out, option);
const Mask_t kWAOverrideRedirect
const Mask_t kKeyLockMask
const Mask_t kButtonPressMask
const Mask_t kKeyMod1Mask
typically the Alt key
const Mask_t kWASaveUnder
const Mask_t kAnyModifier
const Mask_t kButton1Mask
const Mask_t kPointerMotionMask
const Mask_t kKeyShiftMask
const Mask_t kKeyMod2Mask
typically mod on numeric keys
const Mask_t kLeaveWindowMask
Handle_t GContext_t
Graphics context handle.
const Mask_t kButtonReleaseMask
const Mask_t kEnterWindowMask
Handle_t FontStruct_t
Pointer to font structure.
ULong_t Pixel_t
Pixel value.
Handle_t Window_t
Window handle.
int Int_t
Signed integer 4 bytes (int).
long Longptr_t
Integer large enough to hold a pointer (platform-dependent).
int Ssiz_t
String size (currently int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
bool Bool_t
Boolean (0=false, 1=true) (bool).
const char Option_t
Option string (const char).
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
virtual TList * GetList() const
UInt_t GetDefaultWidth() const override
Int_t MustCleanup() const override
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
TList * fList
container of frame elements
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
static TGLayoutHints * fgDefaultHints
Encapsulate fonts used in the GUI system.
static Pixel_t GetDefaultSelectedBackground()
Get default selected frame background.
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
static const TGGC & GetBlackGC()
Get black graphics context.
UInt_t fOptions
frame options
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
TGFrame(const TGFrame &)=delete
UInt_t fHeight
frame height
Int_t fBorderWidth
frame border width
TGDimension GetSize() const
void DoRedraw() override
Redraw the frame.
virtual Pixel_t GetForeground() const
Return frame foreground color.
static const TGGC & GetHilightGC()
Get highlight color graphics context.
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
void Move(Int_t x, Int_t y) override
Move frame.
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
void UnmapWindow() override
unmap window
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
static const TGGC & GetShadowGC()
Get shadow color graphics context.
virtual Bool_t HandleMotion(Event_t *)
static const TGGC & GetBckgndGC()
Get background color graphics context.
void MapRaised() override
map raised
Encapsulate a graphics context used in the low level graphics.
TGHorizontalFrame(const TGWindow *p=nullptr, UInt_t w=1, UInt_t h=1, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
TGHotString is a string with a "hot" character underlined.
void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y) override
Draw a hot string and underline the hot character.
This class describes layout hints used by the layout classes.
Int_t GetPadRight() const
ULong_t GetLayoutHints() const
Defines top level windows that interact with the system Window Manager.
TGClient * fClient
Connection to display server.
Handle_t fId
X11/Win32 Window identifier.
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
void Draw(Option_t *="") override
Default Draw method for all objects.
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
const char * GetString() const
virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y)
Draw string.
ROOT GUI Window base class.
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
virtual void RequestFocus()
request focus
const TGWindow * fParent
Parent window.
virtual void DestroyWindow()
destroy window
const TGWindow * GetParent() const
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
TObject * After(const TObject *obj) const override
Returns the object after object obj.
TObject * Before(const TObject *obj) const override
Returns the object before object obj.
TObject * Last() const override
Return the last object in the list. Returns 0 when list is empty.
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Named parameter, streamable and storable.
TQConnection class is an internal class, used in the object communication mechanism.
TList * GetListOfSignals() const
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Bool_t Disconnect(const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
TString & Insert(Ssiz_t pos, const char *s)
TString & ReplaceSpecialCppChars()
Find special characters which are typically used in printf() calls and replace them by appropriate es...
const char * Data() const
TString & Remove(Ssiz_t pos)
TString & Append(const char *cs)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Handles synchronous and a-synchronous timer events.
void Reset()
Reset the timer.
TTimer(const TTimer &)=delete
int main(int argc, char **argv)
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
EGEventType fType
of event (see EGEventType)
Int_t fY
pointer x, y coordinates in event window
Window_t fWindow
window reported event is relative to
UInt_t fState
key or button mask
UInt_t fCode
key or button code
Graphics context structure.
Mask_t fMask
bit mask specifying which fields are valid
FontH_t fFont
default text font for text operations
Point structure (maps to the X11 XPoint structure).
Used for drawing line segments (maps to the X11 XSegments structure).
Attributes that can be used when creating or changing a window.
Bool_t fOverrideRedirect
boolean value for override-redirect
Mask_t fMask
bit mask specifying which fields are valid
Bool_t fSaveUnder
should bits under be saved (popups)?