IconShape.h
gehe zur Dokumentation dieser Datei
00001 // -*- C++ -*-
00002 
00055 #ifndef ICONSHAPE_H
00056 #define ICONSHAPE_H
00057 
00058 
00059 
00060 //#include <map>
00061 
00062 #include "wx/defs.h"
00063 #include "wx/icon.h"
00064 #include "wx/stattext.h"
00065 
00066 #include "Panel.h"
00067 #include "MutIcon.h"
00068 //#include "Device.h"
00069 
00071 class MutIconShape:public MutPanel
00072 {
00073 protected:
00075         MutIcon Icon;
00076         wxStaticText * staticText;
00077         
00078 public:
00079         
00080         MutIconShape():MutPanel(),Icon(),staticText(NULL) { }
00081 
00082         MutIconShape(wxWindow * parent, wxWindowID id):MutPanel(),
00083                                                                   Icon(),
00084                                                                   staticText(NULL)
00085         {
00086                 Create(parent, id);
00087         }
00088         
00089         bool Create (wxWindow * parent, wxWindowID id = wxID_ANY);
00090         
00091         virtual ~MutIconShape() {}
00092         
00093 
00094         void SetIcon(const MutIcon & icon) {
00095                 Icon = icon;
00096         }
00097 
00098         const MutIcon & GetIcon () const {
00099                 return Icon;
00100         }
00101 
00102         void SetLabel(const wxString & st ) {
00103           if (!staticText) staticText = new wxStaticText(this,wxID_ANY,_T(""));
00104           wxASSERT(staticText);
00105           if (!staticText) return;
00106           wxControl::SetLabel(st);
00107           staticText->SetLabel(st);
00108         }
00110         virtual MutIcon & GetMutIcon ()  { return MutNullIcon; }
00111   
00112         virtual wxSize DoGetBestSize() const;
00113 
00114         void OnGetFocus(wxFocusEvent & event) ;
00115         virtual void SetFocus() ;
00116         void OnKillFocus(wxFocusEvent & event); 
00117 
00118         void         OnPaint( wxPaintEvent &event ) ;
00119         virtual void OnDraw (wxDC & dc);
00120         virtual wxPoint GetPerimeterPoint(const wxPoint &i,
00121                                           const wxPoint &o) const;
00122         virtual wxRect GetIconRect() const 
00123         {
00124                 wxRect r = GetRect();
00125                 int iw = Icon.GetWidth();
00126                 return wxRect(r.x + (r.width - iw)/2, r.y,
00127                               iw,Icon.GetHeight());
00128         }
00129         
00130         virtual void LineTo(wxDC & dc , const wxPoint & p) const;
00131         virtual bool Recompute();
00132         
00133         virtual bool Layout();
00134 
00135         //  virtual bool AcceptsFocus() const { return true; }
00136         void DeleteSelf();
00137         void DeleteSelfEvent(wxCloseEvent & event) {
00138                 DEBUGLOG(other, _T("Destroying"));
00139                 Destroy();
00140         }       
00141 private:
00142         DECLARE_DYNAMIC_CLASS_NO_COPY(MutIconShape)
00143         DECLARE_EVENT_TABLE() 
00144 };
00145 
00146 
00147 
00148 #endif                          /* ICONSHAPE_H */
00149 /*
00150  * \}
00151  */

Erzeugt am Sun Aug 21 2011 10:51:54 für Mutabor von doxygen 1.7.4