2
* This file is part of wxSmith plugin for Code::Blocks Studio
3
* Copyright (C) 2006-2007 Bartlomiej Swiecki
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.
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.
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/>.
19
* $Id: wxsslider.cpp 8307 2012-08-31 21:05:19Z mortenmacfly $
20
* $HeadURL: svn://svn.code.sf.net/p/codeblocks/code/trunk/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsslider.cpp $
23
#include <wx/slider.h>
24
#include "wxsslider.h"
27
// TODO: Add some flag like "Using Selection range" to note when using selmin / selmax (current comparision to 0 isn't enough)
30
wxsRegisterItem<wxsSlider> Reg(_T("Slider"),wxsTWidget,_T("Standard"),110);
32
WXS_ST_BEGIN(wxsSliderStyles,_T(""))
33
WXS_ST(wxSL_HORIZONTAL)
35
WXS_ST(wxSL_AUTOTICKS)
48
WXS_EV_BEGIN(wxsSliderEvents)
49
WXS_EVI(EVT_COMMAND_SCROLL,wxEVT_SCROLL_TOP|wxEVT_SCROLL_BOTTOM|wxEVT_SCROLL_LINEUP|wxEVT_SCROLL_LINEDOWN|wxEVT_SCROLL_PAGEUP|wxEVT_SCROLL_PAGEDOWN|wxEVT_SCROLL_THUMBTRACK|wxEVT_SCROLL_THUMBRELEASE|wxEVT_SCROLL_CHANGED,wxScrollEvent,CmdScroll)
50
WXS_EVI(EVT_COMMAND_SCROLL_TOP,wxEVT_SCROLL_TOP,wxScrollEvent,ScrollTop)
51
WXS_EVI(EVT_COMMAND_SCROLL_BOTTOM,wxEVT_SCROLL_BOTTOM,wxScrollEvent,CmdScrollBottom)
52
WXS_EVI(EVT_COMMAND_SCROLL_LINEUP,wxEVT_SCROLL_LINEUP,wxScrollEvent,CmdScrollLineUp)
53
WXS_EVI(EVT_COMMAND_SCROLL_LINEDOWN,wxEVT_SCROLL_LINEDOWN,wxScrollEvent,CmdScrollLineDown)
54
WXS_EVI(EVT_COMMAND_SCROLL_PAGEUP,wxEVT_SCROLL_PAGEUP,wxScrollEvent,CmdScrollPageUp)
55
WXS_EVI(EVT_COMMAND_SCROLL_PAGEDOWN,wxEVT_SCROLL_PAGEDOWN,wxScrollEvent,CmdScrollPageDown)
56
WXS_EVI(EVT_COMMAND_SCROLL_THUMBTRACK,wxEVT_SCROLL_THUMBTRACK,wxScrollEvent,CmdScrollThumbTrack)
57
WXS_EVI(EVT_COMMAND_SCROLL_THUMBRELEASE,wxEVT_SCROLL_THUMBRELEASE,wxScrollEvent,CmdScrollThumbRelease)
58
WXS_EVI(EVT_COMMAND_SCROLL_CHANGED,wxEVT_SCROLL_CHANGED,wxScrollEvent,CmdScrollChanged)
59
WXS_EVI(EVT_COMMAND_SLIDER_UPDATED,wxEVT_COMMAND_SLIDER_UPDATED,wxScrollEvent,CmdSliderUpdated)
65
wxsSlider::wxsSlider(wxsItemResData* Data):
83
void wxsSlider::OnBuildCreatingCode()
85
switch ( GetLanguage() )
89
AddHeader(_T("<wx/slider.h>"),GetInfo().ClassName,hfInPCH);
90
Codef(_T("%C(%W, %I, %d, %d, %d, %P, %S, %T, %V, %N);\n"),Value,Min,Max);
92
if ( TickFrequency ) Codef( _T("%ASetTickFreq(%d);\n"), TickFrequency);
93
if ( PageSize ) Codef( _T("%ASetPageSize(%d);\n"), PageSize);
94
if ( LineSize ) Codef( _T("%ASetLineSize(%d);\n"), LineSize);
95
if ( ThumbLength ) Codef( _T("%ASetThumbLength(%d);\n"), ThumbLength);
96
if ( Tick ) Codef( _T("%ASetTick(%d);\n"), Tick);
97
if ( SelMin || SelMax ) Codef( _T("%ASetSelection(%d, %d);\n"), SelMin, SelMax);
98
BuildSetupWindowCode();
104
wxsCodeMarks::Unknown(_T("wxsSlider::OnBuildCreatingCode"),GetLanguage());
109
wxObject* wxsSlider::OnBuildPreview(wxWindow* Parent,long Flags)
111
wxSlider* Preview = new wxSlider(Parent,GetId(),Value,Min,Max,Pos(Parent),Size(Parent),Style());
112
#if wxCHECK_VERSION(2, 9, 0)
113
if ( TickFrequency ) Preview->SetTickFreq(TickFrequency);
115
if ( TickFrequency ) Preview->SetTickFreq(TickFrequency,0);
117
if ( PageSize ) Preview->SetPageSize(PageSize);
118
if ( LineSize ) Preview->SetLineSize(LineSize);
119
if ( ThumbLength ) Preview->SetThumbLength(ThumbLength);
120
if ( Tick ) Preview->SetTick(Tick);
121
if ( SelMin || SelMax ) Preview->SetSelection(SelMin,SelMax);
122
return SetupWindow(Preview,Flags);
125
void wxsSlider::OnEnumWidgetProperties(long Flags)
127
WXS_LONG(wxsSlider,Value,_("Value"),_T("value"),0)
128
WXS_LONG(wxsSlider,Min,_("Min"),_T("min"),0)
129
WXS_LONG(wxsSlider,Max,_("Max"),_T("max"),100)
130
WXS_LONG(wxsSlider,TickFrequency,_("Tick Frequency"),_T("tickfreq"),0)
131
WXS_LONG(wxsSlider,PageSize,_("Page Size"),_T("pagesize"),0)
132
WXS_LONG(wxsSlider,LineSize,_("Line Size"),_T("linesize"),0)
133
WXS_LONG(wxsSlider,ThumbLength,_("Thumb Length"),_T("thumb"),0)
134
WXS_LONG(wxsSlider,Tick,_("Tick"),_T("tick"),0)
135
WXS_LONG(wxsSlider,SelMin,_("Selection Min"),_T("selmin"),0)
136
WXS_LONG(wxsSlider,SelMax,_("Selection Max"),_T("selmax"),0)