control.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/motif/control.h
  3. // Purpose: wxControl class
  4. // Author: Julian Smart
  5. // Modified by:
  6. // Created: 17/09/98
  7. // Copyright: (c) Julian Smart
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_CONTROL_H_
  11. #define _WX_CONTROL_H_
  12. #include "wx/window.h"
  13. #include "wx/list.h"
  14. #include "wx/validate.h"
  15. // General item class
  16. class WXDLLIMPEXP_CORE wxControl: public wxControlBase
  17. {
  18. DECLARE_ABSTRACT_CLASS(wxControl)
  19. public:
  20. wxControl();
  21. wxControl( wxWindow *parent,
  22. wxWindowID id,
  23. const wxPoint &pos = wxDefaultPosition,
  24. const wxSize &size = wxDefaultSize,
  25. long style = 0,
  26. const wxValidator& validator = wxDefaultValidator,
  27. const wxString &name = wxControlNameStr )
  28. {
  29. Create(parent, id, pos, size, style, validator, name);
  30. }
  31. bool Create(wxWindow *parent, wxWindowID id,
  32. const wxPoint& pos = wxDefaultPosition,
  33. const wxSize& size = wxDefaultSize, long style = 0,
  34. const wxValidator& validator = wxDefaultValidator,
  35. const wxString& name = wxControlNameStr);
  36. // simulates the event, returns true if the event was processed
  37. virtual void Command(wxCommandEvent& WXUNUSED(event)) { }
  38. // calls the callback and appropriate event handlers, returns true if
  39. // event was processed
  40. virtual bool ProcessCommand(wxCommandEvent& event);
  41. virtual void SetLabel(const wxString& label);
  42. virtual wxString GetLabel() const ;
  43. bool InSetValue() const { return m_inSetValue; }
  44. protected:
  45. // calls wxControlBase::CreateControl, also sets foreground, background and
  46. // font to parent's values
  47. bool CreateControl(wxWindow *parent,
  48. wxWindowID id,
  49. const wxPoint& pos,
  50. const wxSize& size,
  51. long style,
  52. const wxValidator& validator,
  53. const wxString& name);
  54. // native implementation using XtQueryGeometry
  55. virtual wxSize DoGetBestSize() const;
  56. // Motif: prevent callbacks being called while in SetValue
  57. bool m_inSetValue;
  58. DECLARE_EVENT_TABLE()
  59. };
  60. #endif // _WX_CONTROL_H_