control.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/ribbon/control.h
  3. // Purpose: Extension of wxControl with common ribbon methods
  4. // Author: Peter Cawley
  5. // Modified by:
  6. // Created: 2009-06-05
  7. // Copyright: (C) Peter Cawley
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_RIBBON_CONTROL_H_
  11. #define _WX_RIBBON_CONTROL_H_
  12. #include "wx/defs.h"
  13. #if wxUSE_RIBBON
  14. #include "wx/control.h"
  15. #include "wx/dynarray.h"
  16. class wxRibbonBar;
  17. class wxRibbonArtProvider;
  18. class WXDLLIMPEXP_RIBBON wxRibbonControl : public wxControl
  19. {
  20. public:
  21. wxRibbonControl() { Init(); }
  22. wxRibbonControl(wxWindow *parent, wxWindowID id,
  23. const wxPoint& pos = wxDefaultPosition,
  24. const wxSize& size = wxDefaultSize, long style = 0,
  25. const wxValidator& validator = wxDefaultValidator,
  26. const wxString& name = wxControlNameStr)
  27. {
  28. Init();
  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. virtual void SetArtProvider(wxRibbonArtProvider* art);
  37. wxRibbonArtProvider* GetArtProvider() const {return m_art;}
  38. virtual bool IsSizingContinuous() const {return true;}
  39. wxSize GetNextSmallerSize(wxOrientation direction, wxSize relative_to) const;
  40. wxSize GetNextLargerSize(wxOrientation direction, wxSize relative_to) const;
  41. wxSize GetNextSmallerSize(wxOrientation direction) const;
  42. wxSize GetNextLargerSize(wxOrientation direction) const;
  43. virtual bool Realize();
  44. bool Realise() {return Realize();}
  45. virtual wxRibbonBar* GetAncestorRibbonBar()const;
  46. // Finds the best width and height given the parent's width and height
  47. virtual wxSize GetBestSizeForParentSize(const wxSize& WXUNUSED(parentSize)) const { return GetBestSize(); }
  48. protected:
  49. wxRibbonArtProvider* m_art;
  50. virtual wxSize DoGetNextSmallerSize(wxOrientation direction,
  51. wxSize relative_to) const;
  52. virtual wxSize DoGetNextLargerSize(wxOrientation direction,
  53. wxSize relative_to) const;
  54. private:
  55. void Init() { m_art = NULL; }
  56. #ifndef SWIG
  57. DECLARE_CLASS(wxRibbonControl)
  58. #endif
  59. };
  60. WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxRibbonControl*, wxArrayRibbonControl, class WXDLLIMPEXP_RIBBON);
  61. #endif // wxUSE_RIBBON
  62. #endif // _WX_RIBBON_CONTROL_H_