15 #include "TGComboBox.h" 16 #include "KeySymbols.h" 36 : TGTextEntry(parent, text, id), m_popup(
nullptr), m_list(
nullptr), m_validator(
nullptr), m_listHeight(100) {
37 m_popup =
new TGComboBoxPopup(
fClient->GetDefaultRoot(), 100, 100, kVerticalFrame);
40 m_list->Associate(
this);
41 m_list->GetScrollBar()->GrabPointer(kFALSE);
42 m_popup->AddFrame(m_list,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
45 m_list->GetContainer()->AddInput(kButtonPressMask | kButtonReleaseMask | kPointerMotionMask);
46 m_list->SetEditDisabled(kEditDisable);
47 m_list->GetContainer()->Connect(
"KeyPressed(TGFrame*,UInt_t,UInt_t)",
48 "FWGUIValidatingTextEntry",
50 "keyPressedInPopup(TGFrame*,UInt_t,UInt_t)");
51 m_list->GetContainer()->SetEditDisabled(kEditDisable);
52 Connect(
"TabPressed()",
"FWGUIValidatingTextEntry",
this,
"showOptions()");
81 switch (GET_MSG(msg)) {
83 switch (GET_SUBMSG(msg)) {
113 const TGLBEntry*
entry =
dynamic_cast<TGLBEntry*
>(
f);
116 m_list->Selected(entry->EntryId());
124 class ChangeFocusTimer :
public TTimer {
126 ChangeFocusTimer(TGWindow* iWindow) : TTimer(100), m_window(iWindow) {}
127 Bool_t Notify()
override {
129 m_window->RequestFocus();
140 const char*
text = GetText();
141 std::string subText(text, text + GetCursorPosition());
159 unsigned int h =
m_list->GetNumberOfEntries() *
m_list->GetItemVsize();
170 gVirtualX->TranslateCoordinates(GetId(),
m_popup->GetParent()->GetId(), 0, GetHeight(), ax, ay, wdummy);
173 std::unique_ptr<TTimer> timer(
new ChangeFocusTimer(
m_list->GetContainer()));
177 m_popup->PlacePopup(ax, ay, GetWidth() - 2,
m_popup->GetDefaultHeight());
187 long pos = GetCursorPosition();
188 InsertText(iOption.c_str(), pos);
189 SetCursorPosition(pos + iOption.size());
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::vector< std::pair< std::shared_ptr< std::string >, std::string > > m_options
FWGUIValidatingTextEntry(const TGWindow *parent=nullptr, const char *text=nullptr, Int_t id=-1)
void insertTextOption(const std::string &)
virtual void fillOptions(const char *iBegin, const char *iEnd, std::vector< std::pair< std::shared_ptr< std::string >, std::string > > &oOptions) const =0
void setValidator(FWValidatorBase *)
std::vector< std::shared_ptr< fireworks::OptionNode > > Options
FWValidatorBase * m_validator
TGComboBoxPopup * m_popup
~FWGUIValidatingTextEntry() override
Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) override
void keyPressedInPopup(TGFrame *, UInt_t keysym, UInt_t mask)