]> git.saurik.com Git - wxWidgets.git/blame - src/ribbon/control.cpp
fixing osx_cocoa, there's a reason m_peer is private in the base class
[wxWidgets.git] / src / ribbon / control.cpp
CommitLineData
3c3ead1d
PC
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///////////////////////////////////////////////////////////////////////////////
4cf018e1 11
3c3ead1d
PC
12#include "wx/wxprec.h"
13
14#ifdef __BORLANDC__
15 #pragma hdrstop
16#endif
17
3c3ead1d
PC
18#if wxUSE_RIBBON
19
4cf018e1
PC
20#include "wx/ribbon/control.h"
21
3c3ead1d
PC
22#ifndef WX_PRECOMP
23#endif
24
25#ifdef __WXMSW__
26#include "wx/msw/private.h"
27#endif
28
29IMPLEMENT_CLASS(wxRibbonControl, wxControl)
30
fd6e1597 31bool wxRibbonControl::Create(wxWindow *parent, wxWindowID id,
3c3ead1d
PC
32 const wxPoint& pos,
33 const wxSize& size, long style,
34 const wxValidator& validator,
35 const wxString& name)
3c3ead1d 36{
fd6e1597
VZ
37 if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
38 return false;
3c3ead1d
PC
39
40 wxRibbonControl *ribbon_parent = wxDynamicCast(parent, wxRibbonControl);
41 if(ribbon_parent)
42 {
43 m_art = ribbon_parent->GetArtProvider();
44 }
fd6e1597
VZ
45
46 return true;
3c3ead1d
PC
47}
48
49void wxRibbonControl::SetArtProvider(wxRibbonArtProvider* art)
50{
51 m_art = art;
52}
53
54wxSize 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
70wxSize 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
85wxSize wxRibbonControl::GetNextSmallerSize(wxOrientation direction,
86 wxSize relative_to) const
87{
88 return DoGetNextSmallerSize(direction, relative_to);
89}
90
91wxSize wxRibbonControl::GetNextLargerSize(wxOrientation direction,
92 wxSize relative_to) const
93{
94 return DoGetNextLargerSize(direction, relative_to);
95}
96
97wxSize wxRibbonControl::GetNextSmallerSize(wxOrientation direction) const
98{
99 return DoGetNextSmallerSize(direction, GetSize());
100}
101
102wxSize wxRibbonControl::GetNextLargerSize(wxOrientation direction) const
103{
104 return DoGetNextLargerSize(direction, GetSize());
105}
106
107bool wxRibbonControl::Realize()
108{
109 return true;
110}
111
112#endif // wxUSE_RIBBON