statusbr.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/generic/statusbr.h
  3. // Purpose: wxStatusBarGeneric class
  4. // Author: Julian Smart
  5. // Modified by: VZ at 05.02.00 to derive from wxStatusBarBase
  6. // Created: 01/02/97
  7. // Copyright: (c) Julian Smart
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_GENERIC_STATUSBR_H_
  11. #define _WX_GENERIC_STATUSBR_H_
  12. #include "wx/defs.h"
  13. #if wxUSE_STATUSBAR
  14. #include "wx/pen.h"
  15. #include "wx/arrstr.h"
  16. // ----------------------------------------------------------------------------
  17. // wxStatusBarGeneric
  18. // ----------------------------------------------------------------------------
  19. class WXDLLIMPEXP_CORE wxStatusBarGeneric : public wxStatusBarBase
  20. {
  21. public:
  22. wxStatusBarGeneric() { Init(); }
  23. wxStatusBarGeneric(wxWindow *parent,
  24. wxWindowID winid = wxID_ANY,
  25. long style = wxSTB_DEFAULT_STYLE,
  26. const wxString& name = wxStatusBarNameStr)
  27. {
  28. Init();
  29. Create(parent, winid, style, name);
  30. }
  31. virtual ~wxStatusBarGeneric();
  32. bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY,
  33. long style = wxSTB_DEFAULT_STYLE,
  34. const wxString& name = wxStatusBarNameStr);
  35. // implement base class methods
  36. virtual void SetStatusWidths(int n, const int widths_field[]);
  37. virtual bool GetFieldRect(int i, wxRect& rect) const;
  38. virtual void SetMinHeight(int height);
  39. virtual int GetBorderX() const { return m_borderX; }
  40. virtual int GetBorderY() const { return m_borderY; }
  41. // implementation only (not part of wxStatusBar public API):
  42. int GetFieldFromPoint(const wxPoint& point) const;
  43. protected:
  44. virtual void DoUpdateStatusText(int number);
  45. // event handlers
  46. void OnPaint(wxPaintEvent& event);
  47. void OnSize(wxSizeEvent& event);
  48. void OnLeftDown(wxMouseEvent& event);
  49. void OnRightDown(wxMouseEvent& event);
  50. // Responds to colour changes
  51. void OnSysColourChanged(wxSysColourChangedEvent& event);
  52. protected:
  53. virtual void DrawFieldText(wxDC& dc, const wxRect& rc, int i, int textHeight);
  54. virtual void DrawField(wxDC& dc, int i, int textHeight);
  55. void SetBorderX(int x);
  56. void SetBorderY(int y);
  57. virtual void InitColours();
  58. // true if the status bar shows the size grip: for this it must have
  59. // wxSTB_SIZEGRIP style and the window it is attached to must be resizable
  60. // and not maximized
  61. bool ShowsSizeGrip() const;
  62. // returns the position and the size of the size grip
  63. wxRect GetSizeGripRect() const;
  64. // common part of all ctors
  65. void Init();
  66. // the last known size, fields widths must be updated whenever it's out of
  67. // date
  68. wxSize m_lastClientSize;
  69. // the absolute widths of the status bar panes in pixels
  70. wxArrayInt m_widthsAbs;
  71. int m_borderX;
  72. int m_borderY;
  73. wxPen m_mediumShadowPen;
  74. wxPen m_hilightPen;
  75. virtual wxSize DoGetBestSize() const;
  76. private:
  77. // Update m_lastClientSize and m_widthsAbs from the current size.
  78. void DoUpdateFieldWidths();
  79. DECLARE_EVENT_TABLE()
  80. DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBarGeneric)
  81. };
  82. #endif // wxUSE_STATUSBAR
  83. #endif
  84. // _WX_GENERIC_STATUSBR_H_