~efargaspro/+junk/codeblocks-16.01-release

« back to all changes in this revision

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

  • Committer: damienlmoore at gmail
  • Date: 2016-02-02 02:43:22 UTC
  • Revision ID: damienlmoore@gmail.com-20160202024322-yql5qmtbwdyamdwd
Code::BlocksĀ 16.01

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** \file wxssinglechoicedialog.cpp
 
2
*
 
3
* This file is part of wxSmith plugin for Code::Blocks Studio
 
4
* Copyright (C) 2007  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
* $Revision: 8335 $
 
20
* $Id: wxssinglechoicedialog.cpp 8335 2012-09-03 07:43:04Z ollydbg $
 
21
* $HeadURL: http://svn.code.sf.net/p/codeblocks/code/branches/release-16.xx/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxssinglechoicedialog.cpp $
 
22
*/
 
23
 
 
24
#include "wxssinglechoicedialog.h"
 
25
#include "../wxsitemresdata.h"
 
26
#include <wx/choicdlg.h>
 
27
 
 
28
namespace
 
29
{
 
30
    wxsRegisterItem<wxsSingleChoiceDialog> Reg(_T("SingleChoiceDialog"),wxsTTool,_T("Dialogs"),70,false);
 
31
 
 
32
    WXS_ST_BEGIN(wxsSingleChoiceDialogStyles,_T("wxCHOICEDLG_STYLE"))
 
33
        WXS_ST_CATEGORY("wxSingleChoiceDialog")
 
34
        WXS_ST(wxCHOICEDLG_STYLE)
 
35
        WXS_ST(wxOK)
 
36
        WXS_ST(wxCANCEL)
 
37
        WXS_ST(wxCENTRE)
 
38
        WXS_ST_DEFAULTS()
 
39
    WXS_ST_END()
 
40
}
 
41
 
 
42
wxsSingleChoiceDialog::wxsSingleChoiceDialog(wxsItemResData* Data):
 
43
    wxsTool(Data,&Reg.Info,0,wxsSingleChoiceDialogStyles)
 
44
{
 
45
    m_Message = _("Select items");
 
46
}
 
47
 
 
48
void wxsSingleChoiceDialog::OnBuildCreatingCode()
 
49
{
 
50
    switch ( GetLanguage() )
 
51
    {
 
52
        case wxsCPP:
 
53
        {
 
54
            AddHeader(_T("<wx/choicdlg.h>"),GetInfo().ClassName,hfInPCH);
 
55
 
 
56
            wxString ChoicesName;
 
57
            if ( m_Content.GetCount() > 0 )
 
58
            {
 
59
                ChoicesName = GetCoderContext()->GetUniqueName(_T("__wxSingleChoiceDialogChoices"));
 
60
                Codef(_T("wxString %s[%d] = \n{\n"),ChoicesName.wx_str(),(int)m_Content.GetCount());
 
61
                for ( size_t i = 0; i < m_Content.GetCount(); ++i )
 
62
                {
 
63
                    Codef(_T("\t%t%s\n"),m_Content[i].wx_str(),((i!=m_Content.GetCount()-1)?_T(","):_T("")));
 
64
                }
 
65
                Codef(_T("};\n"));
 
66
            }
 
67
 
 
68
            Codef(_T("%C(%W, %t, %t, %d, %s, 0, %T, %P);\n"),
 
69
                  m_Message.wx_str(),
 
70
                  m_Caption.wx_str(),
 
71
                  (int)m_Content.GetCount(),
 
72
                  (m_Content.IsEmpty()?_T("0"):ChoicesName.wx_str()));
 
73
 
 
74
            BuildSetupWindowCode();
 
75
            return;
 
76
        }
 
77
 
 
78
        default:
 
79
        {
 
80
            wxsCodeMarks::Unknown(_T("wxsSingleChoiceDialog::OnBuildCreatingCode"),GetLanguage());
 
81
        }
 
82
    }
 
83
}
 
84
 
 
85
void wxsSingleChoiceDialog::OnEnumToolProperties(long Flags)
 
86
{
 
87
    WXS_SHORT_STRING(wxsSingleChoiceDialog,m_Message,_("Message"),_T("message"),_T(""),false);
 
88
    WXS_SHORT_STRING(wxsSingleChoiceDialog,m_Caption,_("Caption"),_T("caption"),_T(""),false);
 
89
    WXS_ARRAYSTRING (wxsSingleChoiceDialog,m_Content,_("Items"),  _T("content"),_T("item"));
 
90
}