~ubuntu-branches/ubuntu/oneiric/codeblocks/oneiric

« back to all changes in this revision

Viewing changes to src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsmultichoicedialog.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) 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: 4504 $
 
19
* $Id: wxsMultiChoiceDialog.cpp 4504 2007-10-02 21:52:30Z byo $
 
20
* $HeadURL: svn+ssh://byo@svn.berlios.de/svnroot/repos/codeblocks/trunk/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsMultiChoiceDialog.cpp $
 
21
*/
 
22
 
 
23
#include "wxsmultichoicedialog.h"
 
24
#include "../wxsitemresdata.h"
 
25
#include <wx/choicdlg.h>
 
26
 
 
27
namespace
 
28
{
 
29
    wxsRegisterItem<wxsMultiChoiceDialog> Reg(_T("MultiChoiceDialog"),wxsTTool,_T("Dialogs"),50,false);
 
30
 
 
31
    WXS_ST_BEGIN(wxsMultiChoiceDialogStyles,_T("wxCHOICEDLG_STYLE"))
 
32
        WXS_ST_CATEGORY("wxMultiChoiceDialog")
 
33
        WXS_ST(wxCHOICEDLG_STYLE)
 
34
        WXS_ST(wxOK)
 
35
        WXS_ST(wxCANCEL)
 
36
        WXS_ST(wxCENTRE)
 
37
        WXS_ST_DEFAULTS()
 
38
    WXS_ST_END()
 
39
}
 
40
 
 
41
wxsMultiChoiceDialog::wxsMultiChoiceDialog(wxsItemResData* Data):
 
42
    wxsTool(Data,&Reg.Info,0,wxsMultiChoiceDialogStyles)
 
43
{
 
44
    m_Message = _("Select items");
 
45
}
 
46
 
 
47
void wxsMultiChoiceDialog::OnBuildCreatingCode()
 
48
{
 
49
    switch ( GetLanguage() )
 
50
    {
 
51
        case wxsCPP:
 
52
        {
 
53
            AddHeader(_T("<wx/choicdlg.h>"),GetInfo().ClassName,hfInPCH);
 
54
 
 
55
            wxString ChoicesName;
 
56
            if ( m_Content.GetCount() > 0 )
 
57
            {
 
58
                ChoicesName = GetCoderContext()->GetUniqueName(_T("__wxMultiChoiceDialogChoices"));
 
59
                Codef(_T("wxString %s[%d] = \n{\n"),ChoicesName.c_str(),(int)m_Content.GetCount());
 
60
                for ( size_t i = 0; i < m_Content.GetCount(); ++i )
 
61
                {
 
62
                    Codef(_T("\t%t%s\n"),m_Content[i].c_str(),((i!=m_Content.GetCount()-1)?_T(","):_T("")));
 
63
                }
 
64
                Codef(_T("};\n"));
 
65
            }
 
66
 
 
67
            Codef(_T("%C(%W, %t, %t, %d, %s, %T, %P);\n"),
 
68
                m_Message.c_str(),
 
69
                m_Caption.c_str(),
 
70
                (int)m_Content.GetCount(),
 
71
                (m_Content.IsEmpty()?_T("0"):ChoicesName.c_str()));
 
72
 
 
73
            BuildSetupWindowCode();
 
74
            return;
 
75
        }
 
76
 
 
77
        default:
 
78
        {
 
79
            wxsCodeMarks::Unknown(_T("wxsMultiChoiceDialog::OnBuildCreatingCode"),GetLanguage());
 
80
        }
 
81
    }
 
82
}
 
83
 
 
84
void wxsMultiChoiceDialog::OnEnumToolProperties(long Flags)
 
85
{
 
86
    WXS_SHORT_STRING(wxsMultiChoiceDialog,m_Message,_("Message"),_T("message"),_T(""),false);
 
87
    WXS_SHORT_STRING(wxsMultiChoiceDialog,m_Caption,_("Caption"),_T("caption"),_T(""),false);
 
88
    WXS_ARRAYSTRING (wxsMultiChoiceDialog,m_Content,_("Items"),  _T("content"),_T("item"));
 
89
}