forked from OlioEngr/wxd
/
HtmlListBox.d
247 lines (199 loc) · 9.08 KB
/
HtmlListBox.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
//-----------------------------------------------------------------------------
// wxD - HtmlListBox.d
// (C) 2005 bero <berobero@users.sourceforge.net>
// based on
// wx.NET - HtmlListBox.cs
//
/// The wxHtmlListBox wrapper class.
//
// Written by Alexander Olk (xenomorph2@onlinehome.de)
// (C) 2004 by Alexander Olk
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id$
//-----------------------------------------------------------------------------
module wx.HtmlListBox;
public import wx.common;
public import wx.VLBox;
//-----------------------------------------------------------------------------
//! \cond EXTERN
extern (C) {
alias void function(HtmlListBox obj) Virtual_VoidNoParams;
alias void function(HtmlListBox obj, int n) Virtual_VoidSizeT;
alias string function(HtmlListBox obj, int n) Virtual_wxStringSizeT;
alias IntPtr function(HtmlListBox obj, IntPtr colour) Virtual_wxColourwxColour;
alias void function(HtmlListBox obj, IntPtr dc, inout Rectangle rect, int n) Virtual_OnDrawItem;
alias int function(HtmlListBox obj, int n) Virtual_OnMeasureItem;
}
static extern (C) IntPtr wxHtmlListBox_ctor2(IntPtr parent, int id, inout Point pos, inout Size size, uint style, string name);
static extern (C) void wxHtmlListBox_RegisterVirtual(IntPtr self,HtmlListBox obj,
Virtual_VoidNoParams refreshAll,
Virtual_VoidSizeT setItemCount,
Virtual_wxStringSizeT onGetItem,
Virtual_wxStringSizeT onGetItemMarkup,
Virtual_wxColourwxColour getSelectedTextColour,
Virtual_wxColourwxColour getSelectedTextBgColour,
Virtual_OnDrawItem onDrawItem,
Virtual_OnMeasureItem onMeasureItem,
Virtual_OnDrawItem onDrawSeparator,
Virtual_OnDrawItem onDrawBackground,
Virtual_OnMeasureItem onGetLineHeight);
static extern (C) bool wxHtmlListBox_Create(IntPtr self, IntPtr parent, int id, inout Point pos, inout Size size, int style, string name);
static extern (C) void wxHtmlListBox_RefreshAll(IntPtr self);
static extern (C) void wxHtmlListBox_SetItemCount(IntPtr self, int count);
static extern (C) IntPtr wxHtmlListBox_OnGetItemMarkup(IntPtr self, int n);
static extern (C) IntPtr wxHtmlListBox_GetSelectedTextColour(IntPtr self, IntPtr colFg);
static extern (C) IntPtr wxHtmlListBox_GetSelectedTextBgColour(IntPtr self, IntPtr colBg);
static extern (C) void wxHtmlListBox_OnDrawItem(IntPtr self, IntPtr dc, inout Rectangle rect, int n);
static extern (C) int wxHtmlListBox_OnMeasureItem(IntPtr self, int n);
static extern (C) void wxHtmlListBox_OnSize(IntPtr self, IntPtr evt);
static extern (C) void wxHtmlListBox_Init(IntPtr self);
static extern (C) void wxHtmlListBox_CacheItem(IntPtr self, int n);
static extern (C) void wxHtmlListBox_OnDrawSeparator(IntPtr self, IntPtr dc, inout Rectangle rect, int n);
static extern (C) void wxHtmlListBox_OnDrawBackground(IntPtr self, IntPtr dc, inout Rectangle rect, int n);
static extern (C) int wxHtmlListBox_OnGetLineHeight(IntPtr self, int line);
//! \endcond
//-----------------------------------------------------------------------------
public abstract class HtmlListBox : VListBox
{
public this(IntPtr wxobj)
{ super(wxobj); }
public this()
{ this(null, Window.UniqueID, wxDefaultPosition, wxDefaultSize, 0, "");}
public this(Window parent, int id /*= wxID_ANY*/, Point pos = wxDefaultPosition, Size size = wxDefaultSize, int style = 0, string name=wxVListBoxNameStr)
{
this(wxHtmlListBox_ctor2(wxObject.SafePtr(parent), id, pos, size, style, name));
wxHtmlListBox_RegisterVirtual(wxobj, this,
&staticRefreshAll,
&staticSetItemCount,
&staticOnGetItem,
&staticOnGetItemMarkup,
&staticDoGetSelectedTextColour,
&staticDoGetSelectedTextBgColour,
&staticDoOnDrawItem,
&staticOnMeasureItem,
&staticDoOnDrawSeparator,
&staticDoOnDrawBackground,
&staticOnGetLineHeight);
}
//---------------------------------------------------------------------
// ctors with self created id
public this(Window parent, Point pos = wxDefaultPosition, Size size = wxDefaultSize, int style = 0, string name=wxVListBoxNameStr)
{ this(parent, Window.UniqueID, pos, size, style, name);}
//-----------------------------------------------------------------------------
public bool Create(Window parent, int id, inout Point pos, inout Size size, int style, string name)
{
return wxHtmlListBox_Create(wxobj, wxObject.SafePtr(parent), id, pos, size, style, name);
}
//-----------------------------------------------------------------------------
static extern(C) private void staticRefreshAll(HtmlListBox obj)
{
return obj.RefreshAll();
}
public override void RefreshAll()
{
wxHtmlListBox_RefreshAll(wxobj);
}
//-----------------------------------------------------------------------------
static extern(C) private void staticSetItemCount(HtmlListBox obj,int count)
{
obj.SetItemCount(count);
}
public /+virtual+/ void SetItemCount(int count)
{
wxHtmlListBox_SetItemCount(wxobj, count);
}
//-----------------------------------------------------------------------------
static extern(C) private string staticOnGetItem(HtmlListBox obj,int n)
{
return obj.OnGetItem(n);
}
protected abstract string OnGetItem(int n);
//-----------------------------------------------------------------------------
static extern(C) private string staticOnGetItemMarkup(HtmlListBox obj,int n)
{
return obj.OnGetItem(n);
}
protected /+virtual+/ string OnGetItemMarkup(int n)
{
return cast(string) new wxString(wxHtmlListBox_OnGetItemMarkup(wxobj, n), true);
}
//-----------------------------------------------------------------------------
static extern(C) private IntPtr staticDoGetSelectedTextColour(HtmlListBox obj,IntPtr colFg)
{
return wxObject.SafePtr(obj.GetSelectedTextColour(cast(Colour)FindObject(colFg, &Colour.New)));
}
protected /+virtual+/ Colour GetSelectedTextColour(Colour colFg)
{
return new Colour(wxHtmlListBox_GetSelectedTextColour(wxobj, wxObject.SafePtr(colFg)), true);
}
//-----------------------------------------------------------------------------
static extern(C) private IntPtr staticDoGetSelectedTextBgColour(HtmlListBox obj, IntPtr colBg)
{
return wxObject.SafePtr(obj.GetSelectedTextBgColour(cast(Colour)FindObject(colBg, &Colour.New)));
}
protected /+virtual+/ Colour GetSelectedTextBgColour(Colour colBg)
{
return new Colour(wxHtmlListBox_GetSelectedTextBgColour(wxobj, wxObject.SafePtr(colBg)), true);
}
//-----------------------------------------------------------------------------
static extern(C) private void staticDoOnDrawItem(HtmlListBox obj, IntPtr dc, inout Rectangle rect, int n)
{
obj.OnDrawItem(cast(DC)FindObject(dc, &DC.New), rect, n);
}
protected override void OnDrawItem(DC dc, Rectangle rect, int n)
{
wxHtmlListBox_OnDrawItem(wxobj, wxObject.SafePtr(dc), rect, n);
}
//-----------------------------------------------------------------------------
static extern(C) private int staticOnMeasureItem(HtmlListBox obj, int n)
{
return obj.OnMeasureItem(n);
}
protected override int OnMeasureItem(int n)
{
return wxHtmlListBox_OnMeasureItem(wxobj, n);
}
//-----------------------------------------------------------------------------
protected void OnSize(SizeEvent evt)
{
wxHtmlListBox_OnSize(wxobj, wxObject.SafePtr(evt));
}
//-----------------------------------------------------------------------------
protected void Init()
{
wxHtmlListBox_Init(wxobj);
}
//-----------------------------------------------------------------------------
protected void CacheItem(int n)
{
wxHtmlListBox_CacheItem(wxobj, n);
}
//-----------------------------------------------------------------------------
protected override void OnDrawSeparator(DC dc, Rectangle rect, int n)
{
wxHtmlListBox_OnDrawSeparator(wxobj, wxObject.SafePtr(dc), rect, n);
}
static extern(C) private void staticDoOnDrawSeparator(HtmlListBox obj,IntPtr dc, inout Rectangle rect, int n)
{
obj.OnDrawSeparator(cast(DC)FindObject(dc, &DC.New), rect, n);
}
//-----------------------------------------------------------------------------
protected override void OnDrawBackground(DC dc, Rectangle rect, int n)
{
wxHtmlListBox_OnDrawBackground(wxobj, wxObject.SafePtr(dc), rect, n);
}
static extern(C) private void staticDoOnDrawBackground(HtmlListBox obj,IntPtr dc, inout Rectangle rect, int n)
{
obj.OnDrawBackground(cast(DC)FindObject(dc, &DC.New), rect, n);
}
//-----------------------------------------------------------------------------
protected override int OnGetLineHeight(int line)
{
return wxHtmlListBox_OnGetLineHeight(wxobj, line);
}
static extern(C) private int staticOnGetLineHeight(HtmlListBox obj, int line)
{
return obj.OnGetLineHeight(line);
}
}