statusbr.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/univ/statusbr.h
  3. // Purpose: wxStatusBarUniv: wxStatusBar for wxUniversal declaration
  4. // Author: Vadim Zeitlin
  5. // Modified by:
  6. // Created: 14.10.01
  7. // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_UNIV_STATUSBR_H_
  11. #define _WX_UNIV_STATUSBR_H_
  12. #include "wx/univ/inpcons.h"
  13. #include "wx/arrstr.h"
  14. // ----------------------------------------------------------------------------
  15. // wxStatusBarUniv: a window near the bottom of the frame used for status info
  16. // ----------------------------------------------------------------------------
  17. class WXDLLIMPEXP_CORE wxStatusBarUniv : public wxStatusBarBase
  18. {
  19. public:
  20. wxStatusBarUniv() { Init(); }
  21. wxStatusBarUniv(wxWindow *parent,
  22. wxWindowID id = wxID_ANY,
  23. long style = wxSTB_DEFAULT_STYLE,
  24. const wxString& name = wxPanelNameStr)
  25. {
  26. Init();
  27. (void)Create(parent, id, style, name);
  28. }
  29. bool Create(wxWindow *parent,
  30. wxWindowID id = wxID_ANY,
  31. long style = wxSTB_DEFAULT_STYLE,
  32. const wxString& name = wxPanelNameStr);
  33. // implement base class methods
  34. virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
  35. virtual void SetStatusWidths(int n, const int widths[]);
  36. virtual bool GetFieldRect(int i, wxRect& rect) const;
  37. virtual void SetMinHeight(int height);
  38. virtual int GetBorderX() const;
  39. virtual int GetBorderY() const;
  40. // wxInputConsumer pure virtual
  41. virtual wxWindow *GetInputWindow() const
  42. { return const_cast<wxStatusBar*>(this); }
  43. protected:
  44. virtual void DoUpdateStatusText(int i);
  45. // recalculate the field widths
  46. void OnSize(wxSizeEvent& event);
  47. // draw the statusbar
  48. virtual void DoDraw(wxControlRenderer *renderer);
  49. // tell them about our preferred height
  50. virtual wxSize DoGetBestSize() const;
  51. // override DoSetSize() to prevent the status bar height from changing
  52. virtual void DoSetSize(int x, int y,
  53. int width, int height,
  54. int sizeFlags = wxSIZE_AUTO);
  55. // get the (fixed) status bar height
  56. wxCoord GetHeight() const;
  57. // get the rectangle containing all the fields and the border between them
  58. //
  59. // also updates m_widthsAbs if necessary
  60. wxRect GetTotalFieldRect(wxCoord *borderBetweenFields);
  61. // get the rect for this field without ani side effects (see code)
  62. wxRect DoGetFieldRect(int n) const;
  63. // common part of all ctors
  64. void Init();
  65. private:
  66. // the current status fields strings
  67. //wxArrayString m_statusText;
  68. // the absolute status fields widths
  69. wxArrayInt m_widthsAbs;
  70. DECLARE_DYNAMIC_CLASS(wxStatusBarUniv)
  71. DECLARE_EVENT_TABLE()
  72. WX_DECLARE_INPUT_CONSUMER()
  73. };
  74. #endif // _WX_UNIV_STATUSBR_H_