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