]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/scrolwin.h
5586fd5a3cab454e1eae24d4eae793eb5963a0f5
[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 // ----------------------------------------------------------------------------
16 // headers and constants
17 // ----------------------------------------------------------------------------
18
19 #include "wx/window.h"
20 #include "wx/panel.h"
21
22 extern WXDLLEXPORT_DATA(const wxChar*) wxPanelNameStr;
23
24 // default scrolled window style
25 #ifndef wxScrolledWindowStyle
26 #define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL)
27 #endif
28
29 // ----------------------------------------------------------------------------
30 // wxGenericScrolledWindow
31 // ----------------------------------------------------------------------------
32
33 class WXDLLEXPORT wxGenericScrolledWindow : public wxPanel,
34 public wxScrollHelper
35 {
36 public:
37 wxGenericScrolledWindow() : wxScrollHelper(this) { }
38 wxGenericScrolledWindow(wxWindow *parent,
39 wxWindowID winid = wxID_ANY,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 long style = wxScrolledWindowStyle,
43 const wxString& name = wxPanelNameStr)
44 : wxScrollHelper(this)
45 {
46 Create(parent, winid, pos, size, style, name);
47 }
48
49 virtual ~wxGenericScrolledWindow();
50
51 bool Create(wxWindow *parent,
52 wxWindowID winid,
53 const wxPoint& pos = wxDefaultPosition,
54 const wxSize& size = wxDefaultSize,
55 long style = wxScrolledWindowStyle,
56 const wxString& name = wxPanelNameStr);
57
58 virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); }
59
60 // lay out the window and its children
61 virtual bool Layout();
62
63 virtual void DoSetVirtualSize(int x, int y);
64
65 // wxWindow's GetBestVirtualSize returns the actual window size,
66 // whereas we want to return the virtual size
67 virtual wxSize GetBestVirtualSize() const;
68
69 // Return the size best suited for the current window
70 // (this isn't a virtual size, this is a sensible size for the window)
71 virtual wxSize DoGetBestSize() const;
72
73 protected:
74 // this is needed for wxEVT_PAINT processing hack described in
75 // wxScrollHelperEvtHandler::ProcessEvent()
76 void OnPaint(wxPaintEvent& event);
77
78 // we need to return a special WM_GETDLGCODE value to process just the
79 // arrows but let the other navigation characters through
80 #ifdef __WXMSW__
81 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
82 #endif // __WXMSW__
83
84 private:
85 DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericScrolledWindow)
86 DECLARE_EVENT_TABLE()
87 };
88
89 #endif // _WX_GENERIC_SCROLLWIN_H_
90