~ubuntu-branches/ubuntu/raring/codeblocks/raring-proposed

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-08-09 04:38:38 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100809043838-a59ygguym4eg0jgw
Tags: 10.05-0ubuntu1
* New upstream release. Closes (LP: #322350)
 - Switch to dpkg-source 3.0 (quilt) format
 - Remove unneeded README.source
 - Add debian/get-source-orig script that removes all
   Windows prebuilt binaries
* Bump Standards-Version to 3.9.1
 - Stop shipping *.la files
* debian/control
 - Add cdbs package as Build-Depend
 - Add libbz2-dev and zlib1g-dev packages as
   Build-Depends (needed by libhelp_plugin.so)
 - Remove dpatch package of Build-Depends
 - Add codeblocks-contrib-debug package
 - Split architecture-independent files of codeblocks
   package in codeblocks-common package
* debian/rules
 - Switch to CDBS rules system
 - Add parallel build support
 - Add a call to debian/get-source-orig script
 - Use lzma compression (saves 23,5 MB of free space)
* debian/patches
 - Refresh 01_codeblocks_plugin_path
 - Add 02_no_Makefiles_in_debian_dir to remove any link
   in codeblocks build system to deleted Makefiles of debian directory
 - Drop 02_ftbfs_gcc44 and 03_ftbfs_glib221 (merged in upstream)
* debian/watch
 - Update to use the new host (berlios.de)

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) 2008 Ron Collins
 
4
* Copyright (C) 2008 Bartlomiej Swiecki
 
5
*
 
6
* wxSmith is free software; you can redistribute it and/or modify
 
7
* it under the terms of the GNU General Public License as published by
 
8
* the Free Software Foundation; either version 3 of the License, or
 
9
* (at your option) any later version.
 
10
*
 
11
* wxSmith is distributed in the hope that it will be useful,
 
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
14
* GNU General Public License for more details.
 
15
*
 
16
* You should have received a copy of the GNU General Public License
 
17
* along with wxSmith. If not, see <http://www.gnu.org/licenses/>.
 
18
*
 
19
*/
 
20
 
 
21
#include "wxssashlayoutwindow.h"
 
22
#include <wx/sashwin.h>
 
23
#include <wx/laywin.h>
 
24
 
 
25
 
 
26
//------------------------------------------------------------------------------
 
27
 
 
28
namespace
 
29
{
 
30
 
 
31
    wxsRegisterItem<wxsSashLayoutWindow> Reg(
 
32
        _T("SashLayoutWindow"),
 
33
        wxsTContainer,
 
34
        _T("Layout"),
 
35
        10,
 
36
        false);
 
37
 
 
38
 
 
39
    WXS_ST_BEGIN(wxsSashLayoutWindowStyles,_T("wxSW_3D|wxCLIP_CHILDREN"))
 
40
        WXS_ST_CATEGORY("wxSashLayoutWindow")
 
41
        WXS_ST(wxSW_3D)
 
42
        WXS_ST(wxSW_3DSASH)
 
43
        WXS_ST(wxSW_3DBORDER)
 
44
        WXS_ST(wxSW_BORDER)
 
45
        WXS_ST_DEFAULTS()
 
46
    WXS_ST_END()
 
47
 
 
48
    WXS_EV_BEGIN(wxsSashLayoutWindowEvents)
 
49
        WXS_EVI(EVT_SASH_DRAGGED,      wxEVT_SASH_DRAGGED,      wxSashEvent, SashDragged)
 
50
        WXS_EVI(EVT_QUERY_LAYOUT_INFO, wxEVT_QUERY_LAYOUT_INFO, wxQueryLayoutInfoEvent, SashQueryLayout)
 
51
        WXS_EVI(EVT_CALCULATE_LAYOUT,  wxEVT_CALCULATE_LAYOUT,  wxCalculateLayoutEvent, SashCalculateLayout)
 
52
        WXS_EV_DEFAULTS()
 
53
    WXS_EV_END()
 
54
}
 
55
 
 
56
//------------------------------------------------------------------------------
 
57
 
 
58
wxsSashLayoutWindow::wxsSashLayoutWindow(wxsItemResData* Data):
 
59
    wxsContainer(Data,&Reg.Info,wxsSashLayoutWindowEvents,wxsSashLayoutWindowStyles)
 
60
{
 
61
    mTop    = true;
 
62
    mBottom = true;
 
63
    mLeft   = true;
 
64
    mRight  = true;
 
65
    mAlign  = wxLAYOUT_LEFT;
 
66
    mOrient = wxLAYOUT_HORIZONTAL;
 
67
}
 
68
 
 
69
//------------------------------------------------------------------------------
 
70
 
 
71
wxObject* wxsSashLayoutWindow::OnBuildPreview(wxWindow* Parent,long Flags)
 
72
{
 
73
// make a thing to display
 
74
 
 
75
    wxSashLayoutWindow* swin = new wxSashLayoutWindow(Parent,GetId(),Pos(Parent),Size(Parent),Style());
 
76
    SetupWindow(swin, Flags);
 
77
 
 
78
// for now, a sash on all edges
 
79
 
 
80
    swin->SetSashVisible(wxSASH_TOP,    mTop);
 
81
    swin->SetSashVisible(wxSASH_BOTTOM, mBottom);
 
82
    swin->SetSashVisible(wxSASH_LEFT,   mLeft);
 
83
    swin->SetSashVisible(wxSASH_RIGHT,  mRight);
 
84
 
 
85
// set the alignment
 
86
 
 
87
    if      (mAlign == wxLAYOUT_TOP)    swin->SetAlignment(wxLAYOUT_TOP);
 
88
    else if (mAlign == wxLAYOUT_BOTTOM) swin->SetAlignment(wxLAYOUT_BOTTOM);
 
89
    else if (mAlign == wxLAYOUT_LEFT)   swin->SetAlignment(wxLAYOUT_LEFT);
 
90
    else if (mAlign == wxLAYOUT_RIGHT)  swin->SetAlignment(wxLAYOUT_RIGHT);
 
91
 
 
92
// orientation
 
93
 
 
94
    if (mOrient == wxLAYOUT_HORIZONTAL) swin->SetOrientation(wxLAYOUT_HORIZONTAL);
 
95
    else                                swin->SetOrientation(wxLAYOUT_VERTICAL);
 
96
 
 
97
// don't forget the kids
 
98
 
 
99
    AddChildrenPreview(swin, Flags);
 
100
 
 
101
// done
 
102
 
 
103
    return swin;
 
104
}
 
105
 
 
106
//------------------------------------------------------------------------------
 
107
 
 
108
void wxsSashLayoutWindow::OnBuildCreatingCode()
 
109
{
 
110
    switch ( GetLanguage() )
 
111
    {
 
112
        case wxsCPP:
 
113
            AddHeader(_T("<wx/sashwin.h>"),GetInfo().ClassName, 0);
 
114
            AddHeader(_T("<wx/laywin.h>"), GetInfo().ClassName, 0);
 
115
 
 
116
            Codef(_T("%C(%W, %I, %P, %S, %T, %N);\n"));
 
117
            BuildSetupWindowCode();
 
118
            AddChildrenCode();
 
119
 
 
120
            Codef( _T("%ASetSashVisible(wxSASH_TOP,    %b);\n"), mTop);
 
121
            Codef( _T("%ASetSashVisible(wxSASH_BOTTOM, %b);\n"), mBottom);
 
122
            Codef( _T("%ASetSashVisible(wxSASH_LEFT,   %b);\n"), mLeft);
 
123
            Codef( _T("%ASetSashVisible(wxSASH_RIGHT,  %b);\n"), mRight);
 
124
 
 
125
            if      (mAlign == wxLAYOUT_TOP)    Codef( _T("%ASetAlignment(wxLAYOUT_TOP);\n"));
 
126
            else if (mAlign == wxLAYOUT_BOTTOM) Codef( _T("%ASetAlignment(wxLAYOUT_BOTTOM);\n"));
 
127
            else if (mAlign == wxLAYOUT_LEFT)   Codef( _T("%ASetAlignment(wxLAYOUT_LEFT);\n"));
 
128
            else if (mAlign == wxLAYOUT_RIGHT)  Codef( _T("%ASetAlignment(wxLAYOUT_RIGHT);\n"));
 
129
 
 
130
            if (mOrient == wxLAYOUT_HORIZONTAL) Codef(_T("%ASetOrientation(wxLAYOUT_HORIZONTAL);\n"));
 
131
            else                                Codef(_T("%ASetOrientation(wxLAYOUT_VERTICAL);\n"));
 
132
 
 
133
            break;
 
134
 
 
135
        default:
 
136
            wxsCodeMarks::Unknown(_T("wxsSashLayoutWindow::OnBuildCreatingCode"),GetLanguage());
 
137
    }
 
138
}
 
139
 
 
140
//------------------------------------------------------------------------------
 
141
 
 
142
void wxsSashLayoutWindow::OnEnumContainerProperties(long Flags)
 
143
{
 
144
    static const long    valign[] = {    wxLAYOUT_TOP,       wxLAYOUT_LEFT,       wxLAYOUT_RIGHT,       wxLAYOUT_BOTTOM,   0};
 
145
    static const wxChar *nalign[] = {_T("wxLAYOUT_TOP"), _T("wxLAYOUT_LEFT"), _T("wxLAYOUT_RIGHT"), _T("wxLAYOUT_BOTTOM"), 0};
 
146
 
 
147
    static const long    vorient[] = {    wxLAYOUT_HORIZONTAL,       wxLAYOUT_VERTICAL,   0};
 
148
    static const wxChar *norient[] = {_T("wxLAYOUT_HORIZONTAL"), _T("wxLAYOUT_VERTICAL"), 0};
 
149
 
 
150
 
 
151
    WXS_BOOL(wxsSashLayoutWindow, mTop,    _("Drag Top"),    _("dragtop"),    true);
 
152
    WXS_BOOL(wxsSashLayoutWindow, mBottom, _("Drag Bottom"), _("dragbottom"), true);
 
153
    WXS_BOOL(wxsSashLayoutWindow, mLeft,   _("Drag Left"),   _("dragleft"),   true);
 
154
    WXS_BOOL(wxsSashLayoutWindow, mRight,  _("Drag Right"),  _("dragright"),  true);
 
155
 
 
156
    WXS_ENUM(wxsSashLayoutWindow, mAlign,  _("Alignment"),   _T("alignment"),   valign,  nalign,  wxLAYOUT_LEFT);
 
157
    WXS_ENUM(wxsSashLayoutWindow, mOrient, _("Orientation"), _T("orientation"), vorient, norient, wxLAYOUT_HORIZONTAL);
 
158
 
 
159
}
 
160
 
 
161
//------------------------------------------------------------------------------
 
162
 
 
163
bool wxsSashLayoutWindow::OnCanAddChild(wxsItem* Item,bool ShowMessage)
 
164
{
 
165
    return true;
 
166
}