~ubuntu-branches/ubuntu/hardy/codeblocks/hardy-backports

« back to all changes in this revision

Viewing changes to src/plugins/contrib/wxSmith/wxwidgets/defitems/wxspanel.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Casadevall
  • Date: 2008-07-17 04:39:23 UTC
  • Revision ID: james.westby@ubuntu.com-20080717043923-gmsy5cwkdjswghkm
Tags: upstream-8.02
ImportĀ upstreamĀ versionĀ 8.02

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* This file is part of wxSmith plugin for Code::Blocks Studio
 
3
* Copyright (C) 2006-2007  Bartlomiej Swiecki
 
4
*
 
5
* wxSmith is free software; you can redistribute it and/or modify
 
6
* it under the terms of the GNU General Public License as published by
 
7
* the Free Software Foundation; either version 3 of the License, or
 
8
* (at your option) any later version.
 
9
*
 
10
* wxSmith is distributed in the hope that it will be useful,
 
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
13
* GNU General Public License for more details.
 
14
*
 
15
* You should have received a copy of the GNU General Public License
 
16
* along with wxSmith. If not, see <http://www.gnu.org/licenses/>.
 
17
*
 
18
* $Revision: 4850 $
 
19
* $Id: wxspanel.cpp 4850 2008-01-29 21:45:49Z byo $
 
20
* $HeadURL: svn://svn.berlios.de/codeblocks/tags/8.02/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxspanel.cpp $
 
21
*/
 
22
 
 
23
#include <wx/settings.h> // wxSystemSettings, wxSYS_COLOUR_BTNFACE
 
24
#include "wxspanel.h"
 
25
#include "../wxsgridpanel.h"
 
26
 
 
27
namespace
 
28
{
 
29
    wxsRegisterItem<wxsPanel> Reg(_T("Panel"),wxsTContainer, _T("Standard"), 75);
 
30
 
 
31
    WXS_ST_BEGIN(wxsPanelStyles,_T("wxTAB_TRAVERSAL"))
 
32
        WXS_ST_CATEGORY("wxPanel")
 
33
        WXS_ST_DEFAULTS()
 
34
    WXS_ST_END()
 
35
 
 
36
    WXS_EV_BEGIN(wxsPanelEvents)
 
37
        WXS_EV_DEFAULTS()
 
38
    WXS_EV_END()
 
39
 
 
40
    class PanelPreview: public wxsGridPanel
 
41
    {
 
42
        public:
 
43
 
 
44
            PanelPreview(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size,long style,bool IsRoot):
 
45
                wxsGridPanel(parent,id,pos,size,style),
 
46
                m_IsRoot(IsRoot)
 
47
            {}
 
48
 
 
49
        private:
 
50
 
 
51
            bool DrawBorder()
 
52
            {
 
53
                return !m_IsRoot;
 
54
            }
 
55
 
 
56
            bool m_IsRoot;
 
57
    };
 
58
}
 
59
 
 
60
wxsPanel::wxsPanel(wxsItemResData* Data):
 
61
    wxsContainer(
 
62
        Data,
 
63
        &Reg.Info,
 
64
        wxsPanelEvents,
 
65
        wxsPanelStyles)
 
66
{}
 
67
 
 
68
void wxsPanel::OnBuildCreatingCode()
 
69
{
 
70
    switch ( GetLanguage() )
 
71
    {
 
72
        case wxsCPP:
 
73
        {
 
74
            AddHeader(_T("<wx/panel.h>"),GetInfo().ClassName,hfInPCH);
 
75
            Codef(_T("%C(%W, %I, %P, %S, %T, %N);\n"));
 
76
            BuildSetupWindowCode();
 
77
            AddChildrenCode();
 
78
            return;
 
79
        }
 
80
 
 
81
        default:
 
82
        {
 
83
            wxsCodeMarks::Unknown(_T("wxsPanel::OnBuildCreatingCode"),GetLanguage());
 
84
        }
 
85
    }
 
86
}
 
87
 
 
88
wxObject* wxsPanel::OnBuildPreview(wxWindow* Parent,long Flags)
 
89
{
 
90
    wxWindow* NewItem = 0;
 
91
    if ( Flags & pfExact )
 
92
    {
 
93
        NewItem = new wxPanel(Parent,GetId(),Pos(Parent),Size(Parent),Style());
 
94
    }
 
95
    else
 
96
    {
 
97
        NewItem = new PanelPreview(Parent,GetId(),Pos(Parent),Size(Parent),Style(),IsRootItem());
 
98
    }
 
99
    NewItem->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
 
100
    SetupWindow(NewItem,Flags);
 
101
    AddChildrenPreview(NewItem,Flags);
 
102
    return NewItem;
 
103
}
 
104
 
 
105
void wxsPanel::OnEnumContainerProperties(long Flags)
 
106
{
 
107
}