22 class GroupBox :
public TGGroupFrame {
28 GroupBox(
const TGWindow *p,
const char *name,
const char *title);
29 TGTextEntry *GetEntry()
const {
return fEntry; }
30 TGComboBox *GetCombo()
const {
return fCombo; }
36 GroupBox::GroupBox(
const TGWindow *p,
const char *name,
const char *title) :
41 TGHorizontalFrame *horz =
new TGHorizontalFrame(
this);
42 AddFrame(horz,
new TGLayoutHints(kLHintsExpandX | kLHintsCenterY));
43 TGLabel *label =
new TGLabel(horz, title);
44 horz->AddFrame(label,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
46 fCombo =
new TGComboBox(horz);
47 horz->AddFrame(fCombo,
new TGLayoutHints(kLHintsRight | kLHintsExpandY,
49 fCombo->Resize(100, 20);
51 fEntry =
new TGTextEntry(
this);
52 AddFrame(fEntry,
new TGLayoutHints(kLHintsExpandX | kLHintsCenterY));
56 class TextEntryWindow {
67 virtual ~TextEntryWindow() {
delete fMain; }
69 ClassDef(TextEntryWindow, 0);
74 TextEntryWindow::TextEntryWindow()
81 fMain =
new TGMainFrame(gClient->GetRoot(), 10, 10, kVerticalFrame);
84 fMain->SetCleanup(kDeepCleanup);
86 fEcho =
new GroupBox(fMain,
"Echo",
"Mode:");
87 fMain->AddFrame(fEcho,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 5, 5));
88 combo = fEcho->GetCombo();
89 entry = fEcho->GetEntry();
91 combo->AddEntry(
"Normal", TGTextEntry::kNormal);
92 combo->AddEntry(
"Password", TGTextEntry::kPassword);
93 combo->AddEntry(
"No Echo", TGTextEntry::kNoEcho);
94 combo->Connect(
"Selected(Int_t)",
"TGTextEntry", entry,
"SetEchoMode(TGTextEntry::EEchoMode)");
95 combo->Select(TGTextEntry::kNormal);
97 fAlign =
new GroupBox(fMain,
"Alignment",
"Type:");
98 fMain->AddFrame(fAlign,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 5, 5));
99 combo = fAlign->GetCombo();
100 entry = fAlign->GetEntry();
102 combo->AddEntry(
"Left", kTextLeft);
103 combo->AddEntry(
"Centered", kTextCenterX);
104 combo->AddEntry(
"Right", kTextRight);
105 combo->Connect(
"Selected(Int_t)",
"TGTextEntry", entry,
"SetAlignment(ETextJustification)");
106 combo->Select(kTextLeft);
108 fAccess =
new GroupBox(fMain,
"Access",
"Read-only:");
109 fMain->AddFrame(fAccess,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 5, 5));
110 combo = fAccess->GetCombo();
111 entry = fAccess->GetEntry();
113 combo->AddEntry(
"False", 1);
114 combo->AddEntry(
"True", 0);
115 combo->Connect(
"Selected(Int_t)",
"TGTextEntry", entry,
"SetEnabled(Int_t)");
118 fBorder =
new GroupBox(fMain,
"Border",
"Drawn:");
119 fMain->AddFrame(fBorder,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 5, 5));
120 combo = fBorder->GetCombo();
121 entry = fBorder->GetEntry();
123 combo->AddEntry(
"False", 0);
124 combo->AddEntry(
"True", 1);
125 combo->Connect(
"Selected(Int_t)",
"TGTextEntry", entry,
"SetFrameDrawn(Int_t)");
129 fMain->Connect(
"CloseWindow()",
"TApplication", gApplication,
"Terminate()");
130 fMain->DontCallClose();
132 fMain->MapSubwindows();
136 fMain->SetWMSizeHints(fMain->GetDefaultWidth(), fMain->GetDefaultHeight(),
138 fMain->SetWindowName(
"Text Entries");
148 new TextEntryWindow();