]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/scrolwin.h
Applied patch [ 1212208 ] Fix a bug in wxTreeCtrl with wxTR_MULTIPLE
[wxWidgets.git] / include / wx / generic / scrolwin.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/scrolwin.h
3 // Purpose: wxGenericScrolledWindow class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_GENERIC_SCROLLWIN_H_
13 #define _WX_GENERIC_SCROLLWIN_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "genscrolwin.h"
17 #endif
18
19 // ----------------------------------------------------------------------------
20 // headers and constants
21 // ----------------------------------------------------------------------------
22
23 #include "wx/window.h"
24 #include "wx/panel.h"
25
26 extern WXDLLEXPORT_DATA(const wxChar*) wxPanelNameStr;
27
28 // default scrolled window style
29 #ifndef wxScrolledWindowStyle
30 #define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL)
31 #endif
32
33 // avoid triggering this stupid VC++ warning
34 #ifdef __VISUALC__
35 #pragma warning(push)
36 #pragma warning(disable:4355) // 'this' used in base member initializer list
37 #endif
38
39 // ----------------------------------------------------------------------------
40 // wxGenericScrolledWindow
41 // ----------------------------------------------------------------------------
42
43 class WXDLLEXPORT wxGenericScrolledWindow : public wxPanel,
44 public wxScrollHelper
45 {
46 public:
47 wxGenericScrolledWindow() : wxScrollHelper(this) { }
48 wxGenericScrolledWindow(wxWindow *parent,
49 wxWindowID winid = wxID_ANY,
50 const wxPoint& pos = wxDefaultPosition,
51 const wxSize& size = wxDefaultSize,
52 long style = wxScrolledWindowStyle,
53 const wxString& name = wxPanelNameStr)
54 : wxScrollHelper(this)
55 {
56 Create(parent, winid, pos, size, style, name);
57 }
58
59 virtual ~wxGenericScrolledWindow();
60
61 bool Create(wxWindow *parent,
62 wxWindowID winid,
63 const wxPoint& pos = wxDefaultPosition,
64 const wxSize& size = wxDefaultSize,
65 long style = wxScrolledWindowStyle,
66 const wxString& name = wxPanelNameStr);
67
68 virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); }
69
70 // lay out the window and its children
71 virtual bool Layout();
72
73 virtual void DoSetVirtualSize(int x, int y);
74
75 // wxWindow's GetBestVirtualSize returns the actual window size,
76 // whereas we want to return the virtual size
77 virtual wxSize GetBestVirtualSize() const;
78
79 // Return the size best suited for the current window
80 // (this isn't a virtual size, this is a sensible size for the window)
81 virtual wxSize DoGetBestSize() const;
82
83 protected:
84 // this is needed for wxEVT_PAINT processing hack described in
85 // wxScrollHelperEvtHandler::ProcessEvent()
86 void OnPaint(wxPaintEvent& event);
87
88 // we need to return a special WM_GETDLGCODE value to process just the
89 // arrows but let the other navigation characters through
90 #ifdef __WXMSW__
91 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
92 #endif // __WXMSW__
93
94 private:
95 DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericScrolledWindow)
96 DECLARE_EVENT_TABLE()
97 };
98
99 #ifdef __VISUALC__
100 #pragma warning(pop)
101 #endif
102
103 #endif
104 // _WX_GENERIC_SCROLLWIN_H_
105