#include <Fireworks/Core/interface/FWGUIValidatingTextEntry.h>
Public Member Functions | |
ClassDef (FWGUIValidatingTextEntry, 0) | |
FWGUIValidatingTextEntry (const TGWindow *parent=0, const char *text=0, Int_t id=-1) | |
void | hideOptions () |
void | keyPressedInPopup (TGFrame *, UInt_t keysym, UInt_t mask) |
virtual Bool_t | ProcessMessage (Long_t msg, Long_t parm1, Long_t parm2) |
void | setValidator (FWValidatorBase *) |
void | showOptions () |
virtual | ~FWGUIValidatingTextEntry () |
Private Member Functions | |
FWGUIValidatingTextEntry (const FWGUIValidatingTextEntry &) | |
void | insertTextOption (const std::string &) |
const FWGUIValidatingTextEntry & | operator= (const FWGUIValidatingTextEntry &) |
Private Attributes | |
TGListBox * | m_list |
std::vector< std::pair < boost::shared_ptr < std::string >, std::string > > | m_options |
TGComboBoxPopup * | m_popup |
FWValidatorBase * | m_validator |
Description: <one line="" class="" summary>="">
Usage: <usage>
Definition at line 36 of file FWGUIValidatingTextEntry.h.
FWGUIValidatingTextEntry::FWGUIValidatingTextEntry | ( | const TGWindow * | parent = 0 , |
const char * | text = 0 , |
||
Int_t | id = -1 |
||
) |
Definition at line 37 of file FWGUIValidatingTextEntry.cc.
References m_list, and m_popup.
: TGTextEntry(parent,text,id), m_validator(0) { m_popup = new TGComboBoxPopup(fClient->GetDefaultRoot(), 100, 100, kVerticalFrame); m_list = new TGListBox(m_popup, 1 /*widget id*/, kChildFrame); m_list->Resize(100,100); m_list->Associate(this); m_list->GetScrollBar()->GrabPointer(kFALSE); m_popup->AddFrame(m_list, new TGLayoutHints(kLHintsExpandX| kLHintsExpandY)); m_popup->MapSubwindows(); m_popup->Resize(m_popup->GetDefaultSize()); m_list->GetContainer()->AddInput(kButtonPressMask | kButtonReleaseMask | kPointerMotionMask); m_list->SetEditDisabled(kEditDisable); m_list->GetContainer()->Connect("KeyPressed(TGFrame*,UInt_t,UInt_t)", "FWGUIValidatingTextEntry", this, "keyPressedInPopup(TGFrame*,UInt_t,UInt_t)"); m_list->GetContainer()->SetEditDisabled(kEditDisable); Connect("TabPressed()", "FWGUIValidatingTextEntry", this, "showOptions()"); }
FWGUIValidatingTextEntry::~FWGUIValidatingTextEntry | ( | ) | [virtual] |
Definition at line 64 of file FWGUIValidatingTextEntry.cc.
{ }
FWGUIValidatingTextEntry::FWGUIValidatingTextEntry | ( | const FWGUIValidatingTextEntry & | ) | [private] |
FWGUIValidatingTextEntry::ClassDef | ( | FWGUIValidatingTextEntry | , |
0 | |||
) |
void FWGUIValidatingTextEntry::hideOptions | ( | ) |
Definition at line 202 of file FWGUIValidatingTextEntry.cc.
References m_popup.
Referenced by keyPressedInPopup(), and ProcessMessage().
{ m_popup->EndPopup(); fClient->NeedRedraw(this); }
void FWGUIValidatingTextEntry::insertTextOption | ( | const std::string & | iOption | ) | [private] |
Definition at line 208 of file FWGUIValidatingTextEntry.cc.
References pos.
Referenced by keyPressedInPopup(), ProcessMessage(), and showOptions().
void FWGUIValidatingTextEntry::keyPressedInPopup | ( | TGFrame * | , |
UInt_t | keysym, | ||
UInt_t | mask | ||
) |
Definition at line 113 of file FWGUIValidatingTextEntry.cc.
References hideOptions(), insertTextOption(), m_list, and m_options.
{ switch(keysym) { case kKey_Tab: case kKey_Escape: RequestFocus(); hideOptions(); break; case kKey_Return: RequestFocus(); //NOTE: If chosen from the keyboard, m_list->GetSelected() does not work, however // m_list->GetSelectedEntries does work TList selected; m_list->GetSelectedEntries(&selected); assert(selected.GetEntries() == 1); const TGLBEntry* entry = dynamic_cast<TGLBEntry*> (selected.First()); assert(0!=entry); insertTextOption(m_options[entry->EntryId()].second); hideOptions(); break; } }
const FWGUIValidatingTextEntry& FWGUIValidatingTextEntry::operator= | ( | const FWGUIValidatingTextEntry & | ) | [private] |
Bool_t FWGUIValidatingTextEntry::ProcessMessage | ( | Long_t | msg, |
Long_t | parm1, | ||
Long_t | parm2 | ||
) | [virtual] |
Definition at line 91 of file FWGUIValidatingTextEntry.cc.
References hideOptions(), insertTextOption(), m_list, and m_options.
{ //STOLEN FROM TGComboBox.cxx switch (GET_MSG(msg)) { case kC_COMMAND: switch (GET_SUBMSG(msg)) { case kCM_LISTBOX: RequestFocus(); insertTextOption(m_options[m_list->GetSelected()].second); hideOptions(); break; } break; default: break; } return kTRUE; }
void FWGUIValidatingTextEntry::setValidator | ( | FWValidatorBase * | iValidator | ) |
Definition at line 84 of file FWGUIValidatingTextEntry.cc.
References m_validator.
Referenced by CmsShowEDI::CmsShowEDI(), FWGUIEventSelector::FWGUIEventSelector(), and FWTableView::FWTableView().
{ m_validator = iValidator; }
void FWGUIValidatingTextEntry::showOptions | ( | ) |
Definition at line 155 of file FWGUIValidatingTextEntry.cc.
References FWValidatorBase::fillOptions(), h, getHLTprescales::index, insertTextOption(), m_list, m_options, m_popup, m_validator, and runonSM::text.
{ if(0!=m_validator) { const char* text = GetText(); std::string subText(text,text+GetCursorPosition()); //std::cout <<subText<<std::endl; typedef std::vector<std::pair<boost::shared_ptr<std::string>, std::string> > Options; m_validator->fillOptions(text, text+GetCursorPosition(), m_options); if(m_options.empty()) { return;} if(m_options.size()==1) { insertTextOption(m_options.front().second); return; } m_list->RemoveAll(); int index = 0; for(Options::iterator it = m_options.begin(), itEnd = m_options.end(); it != itEnd; ++it,++index) { m_list->AddEntry(it->first->c_str(),index); } { unsigned int h = m_list->GetNumberOfEntries()* m_list->GetItemVsize(); if(h && (h<100)) { m_list->Resize(m_list->GetWidth(),h); } else { m_list->Resize(m_list->GetWidth(),100); } } m_list->Select(0,kTRUE); int ax,ay; Window_t wdummy; gVirtualX->TranslateCoordinates(GetId(), m_popup->GetParent()->GetId(), 0, GetHeight(), ax, ay, wdummy); //Wait to change focus for when the popup has already openned std::auto_ptr<TTimer> timer( new ChangeFocusTimer(m_list->GetContainer()) ); timer->TurnOn(); //NOTE: this call has its own internal GUI event loop and will not return // until the popup has been shut down m_popup->PlacePopup(ax, ay, GetWidth()-2, m_popup->GetDefaultHeight()); } }
TGListBox* FWGUIValidatingTextEntry::m_list [private] |
Definition at line 65 of file FWGUIValidatingTextEntry.h.
Referenced by FWGUIValidatingTextEntry(), keyPressedInPopup(), ProcessMessage(), and showOptions().
std::vector<std::pair<boost::shared_ptr<std::string>, std::string> > FWGUIValidatingTextEntry::m_options [private] |
Definition at line 69 of file FWGUIValidatingTextEntry.h.
Referenced by keyPressedInPopup(), ProcessMessage(), and showOptions().
TGComboBoxPopup* FWGUIValidatingTextEntry::m_popup [private] |
Definition at line 64 of file FWGUIValidatingTextEntry.h.
Referenced by FWGUIValidatingTextEntry(), hideOptions(), and showOptions().
Definition at line 67 of file FWGUIValidatingTextEntry.h.
Referenced by setValidator(), and showOptions().