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);
41 m_list->Associate(
this);
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);
117 m_list->Selected(entry->EntryId());
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();
142 std::string subText(text, text + GetCursorPosition());
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());
virtual void fillOptions(const char *iBegin, const char *iEnd, std::vector< std::pair< std::shared_ptr< std::string >, std::string > > &oOptions) const =0
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 &)
void setValidator(FWValidatorBase *)
std::vector< std::shared_ptr< fireworks::OptionNode > > Options
FWValidatorBase * m_validator
TGComboBoxPopup * m_popup
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
~FWGUIValidatingTextEntry() override
Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) override
void keyPressedInPopup(TGFrame *, UInt_t keysym, UInt_t mask)