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