]> git.saurik.com Git - wxWidgets.git/blob - src/ribbon/control.cpp
adding more infos, links
[wxWidgets.git] / src / ribbon / control.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/ribbon/control.cpp
3 // Purpose: Extension of wxControl with common ribbon methods
4 // Author: Peter Cawley
5 // Modified by:
6 // Created: 2009-06-05
7 // RCS-ID: $Id$
8 // Copyright: (C) Peter Cawley
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17
18 #if wxUSE_RIBBON
19
20 #include "wx/ribbon/control.h"
21
22 #ifndef WX_PRECOMP
23 #endif
24
25 #ifdef __WXMSW__
26 #include "wx/msw/private.h"
27 #endif
28
29 IMPLEMENT_CLASS(wxRibbonControl, wxControl)
30
31 bool wxRibbonControl::Create(wxWindow *parent, wxWindowID id,
32 const wxPoint& pos,
33 const wxSize& size, long style,
34 const wxValidator& validator,
35 const wxString& name)
36 {
37 if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
38 return false;
39
40 wxRibbonControl *ribbon_parent = wxDynamicCast(parent, wxRibbonControl);
41 if(ribbon_parent)
42 {
43 m_art = ribbon_parent->GetArtProvider();
44 }
45
46 return true;
47 }
48
49 void wxRibbonControl::SetArtProvider(wxRibbonArtProvider* art)
50 {
51 m_art = art;
52 }
53
54 wxSize wxRibbonControl::DoGetNextSmallerSize(wxOrientation direction,
55 wxSize size) const
56 {
57 // Dummy implementation for code which doesn't check for IsSizingContinuous() == true
58 wxSize minimum(GetMinSize());
59 if((direction & wxHORIZONTAL) && size.x > minimum.x)
60 {
61 size.x--;
62 }
63 if((direction & wxVERTICAL) && size.y > minimum.y)
64 {
65 size.y--;
66 }
67 return size;
68 }
69
70 wxSize wxRibbonControl::DoGetNextLargerSize(wxOrientation direction,
71 wxSize size) const
72 {
73 // Dummy implementation for code which doesn't check for IsSizingContinuous() == true
74 if(direction & wxHORIZONTAL)
75 {
76 size.x++;
77 }
78 if(direction & wxVERTICAL)
79 {
80 size.y++;
81 }
82 return size;
83 }
84
85 wxSize wxRibbonControl::GetNextSmallerSize(wxOrientation direction,
86 wxSize relative_to) const
87 {
88 return DoGetNextSmallerSize(direction, relative_to);
89 }
90
91 wxSize wxRibbonControl::GetNextLargerSize(wxOrientation direction,
92 wxSize relative_to) const
93 {
94 return DoGetNextLargerSize(direction, relative_to);
95 }
96
97 wxSize wxRibbonControl::GetNextSmallerSize(wxOrientation direction) const
98 {
99 return DoGetNextSmallerSize(direction, GetSize());
100 }
101
102 wxSize wxRibbonControl::GetNextLargerSize(wxOrientation direction) const
103 {
104 return DoGetNextLargerSize(direction, GetSize());
105 }
106
107 bool wxRibbonControl::Realize()
108 {
109 return true;
110 }
111
112 #endif // wxUSE_RIBBON