00001 00002 // 00003 // $Id: GuiTextEntry.h,v 1.4 2005/07/21 20:26:36 bv Exp $ 00004 // 00005 // GuiTextEntry 00006 // 00007 // Package: MIDAD 00008 // 00009 // A text entry widget. 00010 // 00011 // Contact: bv@bnl.gov 00012 // 00013 // Created on: Tue Jan 1 11:46:49 2002 00014 // 00016 00017 #ifndef MIDAD_GUITEXTENTRY_H 00018 #define MIDAD_GUITEXTENTRY_H 00019 00020 #include <Midad/Gui/GuiBase.h> 00021 #include <TGTextEntry.h> 00022 00023 class GuiTextEntry : public TGTextEntry, public GuiBase 00024 { 00025 00026 public: 00027 00028 GuiTextEntry(TGWindow& parent, const char* initial_text=" ") : 00029 TGTextEntry(&parent,initial_text) 00030 { SetLayoutHints(kLHintsExpandX); } 00031 00032 virtual ~GuiTextEntry() { } 00033 00034 SigC::Signal0<void> activated; // emitted when <enter> is hit 00035 SigC::Signal1<void,const char*> text_changed; 00036 00037 // provided by TGTextEntry: 00038 // const char* GetText(); 00039 // void SetText(const char*); 00040 00041 protected: 00042 00043 virtual void ReturnPressed() 00044 { this->TGTextEntry::ReturnPressed(); activated(); } 00045 virtual void TextChanged(const char*) 00046 { this->TGTextEntry::TextChanged(); text_changed(GetText()); } 00047 00048 private: 00049 00050 }; // end of class GuiTextEntry 00051 00052 #endif // MIDAD_GUITEXTENTRY_H