]>
Commit | Line | Data |
---|---|---|
b4354db1 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/gtk/anybutton.h | |
3 | // Purpose: wxGTK wxAnyButton class declaration | |
4 | // Author: Robert Roebling | |
5 | // Created: 1998-05-20 (extracted from button.h) | |
6 | // Id: $Id: anybutton.h 67066 2011-02-27 12:48:30Z VZ $ | |
7 | // Copyright: (c) 1998 Robert Roebling | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_GTK_ANYBUTTON_H_ | |
12 | #define _WX_GTK_ANYBUTTON_H_ | |
13 | ||
14 | //----------------------------------------------------------------------------- | |
15 | // wxAnyButton | |
16 | //----------------------------------------------------------------------------- | |
17 | ||
18 | class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase | |
19 | { | |
20 | public: | |
21 | wxAnyButton() | |
22 | { | |
23 | m_isCurrent = | |
24 | m_isPressed = false; | |
25 | } | |
26 | ||
27 | virtual bool Enable( bool enable = true ); | |
28 | ||
29 | // implementation | |
30 | // -------------- | |
31 | ||
32 | static wxVisualAttributes | |
33 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
34 | ||
35 | // called from GTK callbacks: they update the button state and call | |
36 | // GTKUpdateBitmap() | |
37 | void GTKMouseEnters(); | |
38 | void GTKMouseLeaves(); | |
39 | void GTKPressed(); | |
40 | void GTKReleased(); | |
41 | ||
42 | protected: | |
43 | virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; | |
44 | ||
45 | virtual wxBitmap DoGetBitmap(State which) const; | |
46 | virtual void DoSetBitmap(const wxBitmap& bitmap, State which); | |
47 | virtual void DoSetBitmapPosition(wxDirection dir); | |
48 | ||
49 | private: | |
50 | typedef wxAnyButtonBase base_type; | |
51 | ||
52 | // focus event handler: calls GTKUpdateBitmap() | |
53 | void GTKOnFocus(wxFocusEvent& event); | |
54 | ||
55 | // update the bitmap to correspond to the current button state | |
56 | void GTKUpdateBitmap(); | |
57 | ||
58 | // return the current button state from m_isXXX flags (which means that it | |
59 | // might not correspond to the real current state as e.g. m_isCurrent will | |
60 | // never be true if we don't have a valid current bitmap) | |
61 | State GTKGetCurrentState() const; | |
62 | ||
63 | // show the given bitmap (must be valid) | |
64 | void GTKDoShowBitmap(const wxBitmap& bitmap); | |
65 | ||
66 | ||
67 | // the bitmaps for the different state of the buttons, all of them may be | |
68 | // invalid and the button only shows a bitmap at all if State_Normal bitmap | |
69 | // is valid | |
70 | wxBitmap m_bitmaps[State_Max]; | |
71 | ||
72 | // true iff mouse is currently over the button | |
73 | bool m_isCurrent; | |
74 | ||
75 | // true iff the button is in pressed state | |
76 | bool m_isPressed; | |
77 | ||
78 | wxDECLARE_NO_COPY_CLASS(wxAnyButton); | |
79 | }; | |
80 | ||
81 | #endif // _WX_GTK_ANYBUTTON_H_ |