]> git.saurik.com Git - wxWidgets.git/blame - src/ribbon/control.cpp
Test whether GTK+ is 2.18 or newer in configure.
[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///////////////////////////////////////////////////////////////////////////////
11#include "wx/wxprec.h"
12
13#ifdef __BORLANDC__
14 #pragma hdrstop
15#endif
16
17#include "wx/ribbon/control.h"
18
19#if wxUSE_RIBBON
20
21#ifndef WX_PRECOMP
22#endif
23
24#ifdef __WXMSW__
25#include "wx/msw/private.h"
26#endif
27
28IMPLEMENT_CLASS(wxRibbonControl, wxControl)
29
30wxRibbonControl::wxRibbonControl(wxWindow *parent, wxWindowID id,
31 const wxPoint& pos,
32 const wxSize& size, long style,
33 const wxValidator& validator,
34 const wxString& name)
35 : wxControl(parent, id, pos, size, style, validator, name)
36{
37 m_art = NULL;
38
39 wxRibbonControl *ribbon_parent = wxDynamicCast(parent, wxRibbonControl);
40 if(ribbon_parent)
41 {
42 m_art = ribbon_parent->GetArtProvider();
43 }
44}
45
46void wxRibbonControl::SetArtProvider(wxRibbonArtProvider* art)
47{
48 m_art = art;
49}
50
51wxSize wxRibbonControl::DoGetNextSmallerSize(wxOrientation direction,
52 wxSize size) const
53{
54 // Dummy implementation for code which doesn't check for IsSizingContinuous() == true
55 wxSize minimum(GetMinSize());
56 if((direction & wxHORIZONTAL) && size.x > minimum.x)
57 {
58 size.x--;
59 }
60 if((direction & wxVERTICAL) && size.y > minimum.y)
61 {
62 size.y--;
63 }
64 return size;
65}
66
67wxSize wxRibbonControl::DoGetNextLargerSize(wxOrientation direction,
68 wxSize size) const
69{
70 // Dummy implementation for code which doesn't check for IsSizingContinuous() == true
71 if(direction & wxHORIZONTAL)
72 {
73 size.x++;
74 }
75 if(direction & wxVERTICAL)
76 {
77 size.y++;
78 }
79 return size;
80}
81
82wxSize wxRibbonControl::GetNextSmallerSize(wxOrientation direction,
83 wxSize relative_to) const
84{
85 return DoGetNextSmallerSize(direction, relative_to);
86}
87
88wxSize wxRibbonControl::GetNextLargerSize(wxOrientation direction,
89 wxSize relative_to) const
90{
91 return DoGetNextLargerSize(direction, relative_to);
92}
93
94wxSize wxRibbonControl::GetNextSmallerSize(wxOrientation direction) const
95{
96 return DoGetNextSmallerSize(direction, GetSize());
97}
98
99wxSize wxRibbonControl::GetNextLargerSize(wxOrientation direction) const
100{
101 return DoGetNextLargerSize(direction, GetSize());
102}
103
104bool wxRibbonControl::Realize()
105{
106 return true;
107}
108
109#endif // wxUSE_RIBBON