]> git.saurik.com Git - wxWidgets.git/blame - src/ribbon/control.cpp
non PCH compilation
[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
31wxRibbonControl::wxRibbonControl(wxWindow *parent, wxWindowID id,
32 const wxPoint& pos,
33 const wxSize& size, long style,
34 const wxValidator& validator,
35 const wxString& name)
36 : wxControl(parent, id, pos, size, style, validator, name)
37{
38 m_art = NULL;
39
40 wxRibbonControl *ribbon_parent = wxDynamicCast(parent, wxRibbonControl);
41 if(ribbon_parent)
42 {
43 m_art = ribbon_parent->GetArtProvider();
44 }
45}
46
47void wxRibbonControl::SetArtProvider(wxRibbonArtProvider* art)
48{
49 m_art = art;
50}
51
52wxSize wxRibbonControl::DoGetNextSmallerSize(wxOrientation direction,
53 wxSize size) const
54{
55 // Dummy implementation for code which doesn't check for IsSizingContinuous() == true
56 wxSize minimum(GetMinSize());
57 if((direction & wxHORIZONTAL) && size.x > minimum.x)
58 {
59 size.x--;
60 }
61 if((direction & wxVERTICAL) && size.y > minimum.y)
62 {
63 size.y--;
64 }
65 return size;
66}
67
68wxSize wxRibbonControl::DoGetNextLargerSize(wxOrientation direction,
69 wxSize size) const
70{
71 // Dummy implementation for code which doesn't check for IsSizingContinuous() == true
72 if(direction & wxHORIZONTAL)
73 {
74 size.x++;
75 }
76 if(direction & wxVERTICAL)
77 {
78 size.y++;
79 }
80 return size;
81}
82
83wxSize wxRibbonControl::GetNextSmallerSize(wxOrientation direction,
84 wxSize relative_to) const
85{
86 return DoGetNextSmallerSize(direction, relative_to);
87}
88
89wxSize wxRibbonControl::GetNextLargerSize(wxOrientation direction,
90 wxSize relative_to) const
91{
92 return DoGetNextLargerSize(direction, relative_to);
93}
94
95wxSize wxRibbonControl::GetNextSmallerSize(wxOrientation direction) const
96{
97 return DoGetNextSmallerSize(direction, GetSize());
98}
99
100wxSize wxRibbonControl::GetNextLargerSize(wxOrientation direction) const
101{
102 return DoGetNextLargerSize(direction, GetSize());
103}
104
105bool wxRibbonControl::Realize()
106{
107 return true;
108}
109
110#endif // wxUSE_RIBBON