statusbar.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/msw/statusbar.h
  3. // Purpose: native implementation of wxStatusBar
  4. // Author: Vadim Zeitlin
  5. // Modified by:
  6. // Created: 04.04.98
  7. // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_MSW_STATUSBAR_H_
  11. #define _WX_MSW_STATUSBAR_H_
  12. #if wxUSE_NATIVE_STATUSBAR
  13. #include "wx/vector.h"
  14. #include "wx/tooltip.h"
  15. class WXDLLIMPEXP_FWD_CORE wxClientDC;
  16. class WXDLLIMPEXP_CORE wxStatusBar : public wxStatusBarBase
  17. {
  18. public:
  19. // ctors and such
  20. wxStatusBar();
  21. wxStatusBar(wxWindow *parent,
  22. wxWindowID id = wxID_ANY,
  23. long style = wxSTB_DEFAULT_STYLE,
  24. const wxString& name = wxStatusBarNameStr)
  25. {
  26. m_pDC = NULL;
  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 = wxStatusBarNameStr);
  33. virtual ~wxStatusBar();
  34. // implement base class methods
  35. virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
  36. virtual void SetStatusWidths(int n, const int widths_field[]);
  37. virtual void SetStatusStyles(int n, const int styles[]);
  38. virtual void SetMinHeight(int height);
  39. virtual bool GetFieldRect(int i, wxRect& rect) const;
  40. virtual int GetBorderX() const;
  41. virtual int GetBorderY() const;
  42. // override some wxWindow virtual methods too
  43. virtual bool SetFont(const wxFont& font);
  44. virtual WXLRESULT MSWWindowProc(WXUINT nMsg,
  45. WXWPARAM wParam,
  46. WXLPARAM lParam);
  47. protected:
  48. // implement base class pure virtual method
  49. virtual void DoUpdateStatusText(int number);
  50. // override some base class virtuals
  51. virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
  52. virtual wxSize DoGetBestSize() const;
  53. virtual void DoMoveWindow(int x, int y, int width, int height);
  54. #if wxUSE_TOOLTIPS
  55. virtual bool MSWProcessMessage(WXMSG* pMsg);
  56. virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result);
  57. #endif
  58. // implementation of the public SetStatusWidths()
  59. void MSWUpdateFieldsWidths();
  60. // used by DoUpdateStatusText()
  61. wxClientDC *m_pDC;
  62. #if wxUSE_TOOLTIPS
  63. // the tooltips used when wxSTB_SHOW_TIPS is given
  64. wxVector<wxToolTip*> m_tooltips;
  65. #endif
  66. private:
  67. struct MSWBorders
  68. {
  69. int horz,
  70. vert,
  71. between;
  72. };
  73. // retrieve all status bar borders using SB_GETBORDERS
  74. MSWBorders MSWGetBorders() const;
  75. // return the size of the border between the fields
  76. int MSWGetBorderWidth() const;
  77. struct MSWMetrics
  78. {
  79. int gripWidth,
  80. textMargin;
  81. };
  82. // return the various status bar metrics
  83. static const MSWMetrics& MSWGetMetrics();
  84. DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBar)
  85. };
  86. #endif // wxUSE_NATIVE_STATUSBAR
  87. #endif // _WX_MSW_STATUSBAR_H_