15 #include "TGComboBox.h"
16 #include "KeySymbols.h"
19 #include "TVirtualX.h"
37 : TGTextEntry(
parent,
text,
id), m_popup(nullptr), m_list(nullptr), m_validator(nullptr), m_listHeight(100) {
38 m_popup =
new TGComboBoxPopup(
fClient->GetDefaultRoot(), 100, 100, kVerticalFrame);
42 m_list->GetScrollBar()->GrabPointer(kFALSE);
43 m_popup->AddFrame(
m_list,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
46 m_list->GetContainer()->AddInput(kButtonPressMask | kButtonReleaseMask | kPointerMotionMask);
47 m_list->SetEditDisabled(kEditDisable);
48 m_list->GetContainer()->Connect(
"KeyPressed(TGFrame*,UInt_t,UInt_t)",
49 "FWGUIValidatingTextEntry",
51 "keyPressedInPopup(TGFrame*,UInt_t,UInt_t)");
52 m_list->GetContainer()->SetEditDisabled(kEditDisable);
53 Connect(
"TabPressed()",
"FWGUIValidatingTextEntry",
this,
"showOptions()");
82 switch (GET_MSG(
msg)) {
84 switch (GET_SUBMSG(
msg)) {
114 const TGLBEntry*
entry = dynamic_cast<TGLBEntry*>(
f);
125 class ChangeFocusTimer :
public TTimer {
127 ChangeFocusTimer(TGWindow* iWindow) : TTimer(100), m_window(iWindow) {}
128 Bool_t Notify()
override {
130 m_window->RequestFocus();
141 const char*
text = GetText();
160 unsigned int h =
m_list->GetNumberOfEntries() *
m_list->GetItemVsize();
171 gVirtualX->TranslateCoordinates(GetId(),
m_popup->GetParent()->GetId(), 0, GetHeight(), ax, ay, wdummy);
174 std::unique_ptr<TTimer> timer(
new ChangeFocusTimer(
m_list->GetContainer()));
178 m_popup->PlacePopup(ax, ay, GetWidth() - 2,
m_popup->GetDefaultHeight());
188 long pos = GetCursorPosition();
189 InsertText(iOption.c_str(),
pos);
190 SetCursorPosition(
pos + iOption.size());