5
// For compilers that support precompilation, includes "wx/wx.h".
12
// for all others, include the necessary headers (this file is usually all you
13
// need because it includes almost all "standard" wxWidgets headers)
16
#include "wx/imaglist.h"
17
#include "wx/listctrl.h"
20
#include "Windows/Control/Dialog.h"
27
_IsMain = wxThread::IsMain();
29
// DEBUG printf("GuiEnter(0x%lx)\n",wxThread::GetCurrentId());
36
// DEBUG printf("GuiLeave(0x%lx)\n",wxThread::GetCurrentId());
40
/////////////////////////
45
void CDialogChildControl::SetText(LPCWSTR s)
48
((wxTextCtrl *)_window)->SetValue(s);
51
bool CDialogChildControl::GetText(CSysString &s)
56
str = ((wxTextCtrl *)_window)->GetValue();
64
///////////////////////// Windows/Control/ComboBox.cpp
65
#include "Windows/Control/ComboBox.h"
70
void CComboBox::Attach(wxWindow * newWindow) { _choice = (wxComboBox*)newWindow; }
72
wxWindow * CComboBox::Detach()
74
wxWindow * window = _choice;
79
int CComboBox::AddString(const TCHAR * txt) {
82
return _choice->Append(item);
85
void CComboBox::SetText(LPCTSTR s) {
88
_choice->SetValue(str);
91
void CComboBox::GetText(CSysString &s) {
93
wxString str = _choice->GetValue();
97
int CComboBox::GetCount() const {
99
return _choice->GetCount();
102
void CComboBox::GetLBText(int index, CSysString &s) {
104
wxString str = _choice->GetString(index);
108
void CComboBox::SetCurSel(int index) {
110
_choice->SetSelection(index);
113
int CComboBox::GetCurSel() {
115
return _choice->GetSelection();
118
void CComboBox::SetItemData(int index, int val) {
120
_choice->SetClientData( index, (void *)(((char *)0) + val));
123
int CComboBox::GetItemData(int index)
126
void * data = _choice->GetClientData(index);
127
int ret = (int)(((char *)data) - ((char *)0));
131
void CComboBox::Enable(bool state) {
133
_choice->Enable(state);
136
void CComboBox::ResetContent() {
143
///////////////////////// Windows/Control/Edit.cpp
144
#include "Windows/Control/Edit.h"
149
void CEdit::SetPasswordChar(WPARAM c) // Warning : does not work for wxMSW
152
long style = _window->GetWindowStyle();
153
if ( c == 0 ) style &= ~(wxTE_PASSWORD);
154
else style |= wxTE_PASSWORD;
155
_window->SetWindowStyle(style);
160
void CEdit::Show(int cmdShow)
163
// FIXME _window->Show(cmdShow != SW_HIDE);
164
_window->Enable(cmdShow != SW_HIDE);
167
void CEdit::SetText(LPCWSTR s)
170
((wxTextCtrl *)_window)->SetValue(s);
173
bool CEdit::GetText(CSysString &s)
178
str = ((wxTextCtrl *)_window)->GetValue();
187
///////////////////////// Windows/Control/ProgressBar.cpp
188
#include "Windows/Control/ProgressBar.h"
193
CProgressBar::CProgressBar(wxWindow* newWindow):
194
_window((wxGauge *)newWindow) , _minValue(0), _range(0) { }
196
void CProgressBar::Attach(wxWindow* newWindow) {
197
_window = (wxGauge *)newWindow;
202
void CProgressBar::SetRange32(int minValue, int maxValue) {
203
int range = maxValue - minValue;
207
_minValue = minValue;
209
_window->SetRange(_range);
213
void CProgressBar::SetPos(int pos) {
217
int value = pos - _minValue;
218
if ((value >= 0) && (value <= _range)) _window->SetValue(value);
225
///////////////////////// Windows/Control/StatusBar.cpp
226
#include "Windows/Control/StatusBar.h"
231
void CStatusBar::Attach(wxWindow * newWindow) { _statusBar = (wxStatusBar*)newWindow; }
233
wxWindow * CStatusBar::Detach()
235
wxWindow * window = _statusBar;
240
void CStatusBar::SetText(int index, LPCTSTR text)
242
_statusBar->SetStatusText(text,index);
249
///////////////////////// Windows/Control/ListView.cpp
250
#include "Windows/Control/ListView.h"
255
void CListView::Attach(wxWindow * newWindow) { _list = (wxListCtrl *)newWindow; }
257
CListView::operator HWND() const { return (HWND)_list; }
259
int CListView::GetItemCount() const {return _list->GetItemCount(); }
261
int CListView::InsertItem(int index, LPCTSTR text) { return _list->InsertItem(index, text); }
262
int CListView::InsertItem(const LVITEM* item) {
264
int col = item->iSubItem;
266
if (item->mask & LVIF_TEXT) text = item->pszText;
268
// printf("%p->InsertItem(id=%d,%ls)\n",_list,item->iItem, (const wchar_t *)text);
269
return _list->InsertItem(item->iItem, text);
273
info.SetId(item->iItem);
274
if (item->mask & LVIF_TEXT)
276
info.SetText(item->pszText);
277
mask |= wxLIST_MASK_TEXT;
279
if (item->mask & LVIF_PARAM)
281
info.SetData(item->lParam);
282
mask |= wxLIST_MASK_DATA;
284
if (item->mask & LVIF_STATE)
286
info.SetState(item->state);
287
mask |= wxLIST_MASK_STATE;
289
// FIXME if (item->mask & LVIF_IMAGE)
293
return _list->InsertItem(info);
296
void CListView::SetItem(const LVITEM* item) {
297
int col = item->iSubItem;
299
if (item->mask & LVIF_TEXT) text = item->pszText;
300
// printf("%p->SetItem(id=%d,col=%d,%ls)\n",_list,item->iItem, col,(const wchar_t *)text);
301
_list->SetItem(item->iItem, col, text);
304
int CListView::SetSubItem(int index, int subIndex, LPCTSTR text)
306
return _list->SetItem(index, subIndex, text);
309
void SetUnicodeFormat(bool fUnicode) { return ; }
311
void CListView::InsertColumn(int columnIndex, LPCTSTR text, int width)
313
_list->InsertColumn(columnIndex, text, wxLIST_FORMAT_LEFT, width);
316
void CListView::InsertColumn(int columnIndex, const LVCOLUMNW *columnInfo)
319
int format = wxLIST_FORMAT_LEFT;
321
if (columnInfo->mask & LVCF_FMT)
323
if (columnInfo->fmt == LVCFMT_LEFT) format = wxLIST_FORMAT_LEFT;
324
if (columnInfo->fmt == LVCFMT_RIGHT) format = wxLIST_FORMAT_RIGHT;
326
if (columnInfo->mask & LVCF_TEXT) text = columnInfo->pszText;
327
if (columnInfo->mask & LVCF_WIDTH) width = columnInfo->cx;
328
// FIXME LVCF_SUBITEM
329
// printf("%p->InsertColumn(%d,%ls)\n",_list,columnIndex,(const wchar_t *)heading);
330
_list->InsertColumn(columnIndex, text, format, width);
333
void CListView::DeleteAllItems() { _list->DeleteAllItems(); printf("%p->DeleteAllItems()\n",_list); }
335
void CListView::SetRedraw(bool b) {
336
if (b) _list->Thaw();
337
else _list->Freeze();
338
printf(" %p->SetRedraw()\n",_list);
341
void CListView::SetItemCount(int count) {
342
_list->SetItemCount(count);
343
printf(" %p->SetItemCount(%d)\n",_list,count);
346
void CListView::InvalidateRect(void *, bool) { printf("FIXME %p->InvalidateRect()\n",_list);/* FIXME */ }
348
int CListView::GetSelectedCount() const {
349
int nb = _list->GetSelectedItemCount();
350
printf(" %p->GetSelectedCount()=>%d\n",_list,nb);
354
void /* bool */ CListView::EnsureVisible(int index, bool partialOK) {
355
_list->EnsureVisible(index);
356
printf(" %p->EnsureVisible(%d)\n",_list,index);
360
void CListView::SetItemState(int index, UINT state, UINT mask) {
361
// don't work _list->SetItemState(index, state, mask); !?
366
info.m_mask = wxLIST_MASK_STATE;
367
info.m_itemId = index;
369
info.m_state = state;
372
_list->SetItem(info);
374
if (mask & LVIS_FOCUSED) {
375
_list->SetItemState(index, state & LVIS_FOCUSED, mask & LVIS_FOCUSED);
378
if (mask & LVIS_SELECTED) {
379
_list->SetItemState(index, state & LVIS_SELECTED, mask & LVIS_SELECTED);
382
printf("FIXME %p->SetItemState(index=%d,state=0x%x,mask=0x%x)\n",_list,index,(unsigned)state,(unsigned)mask); /* FIXME */
385
UINT CListView::GetItemState(int index, UINT mask) const
387
UINT state = _list->GetItemState(index, mask);
388
printf("FIXME %p->GetItemState(index=%d,mask=0x%x)=0x%x\n",_list,index,(unsigned)mask,(unsigned)state); /* FIXME */
393
void /* bool */ CListView::Update() { printf("FIXME %p->Update()\n",_list); /* FIXME */ }
395
bool CListView::DeleteColumn(int columnIndex) {
396
// printf("%p->DeleteColumn()\n",_list);
397
if (_list->GetColumnCount() < 1) return false;
398
return _list->DeleteColumn(columnIndex); // always return true !?
401
bool CListView::GetItemParam(int itemIndex, LPARAM ¶m) const
403
param = _list->GetItemData(itemIndex);
405
// printf(" %p->GetItemParam(%d) => %ld\n",_list,itemIndex,(long)param);
410
int CListView::GetNextItem(int startIndex, UINT flags) const
412
int item = _list->GetNextItem(startIndex, wxLIST_NEXT_ALL, flags);
413
printf(" %p->GetNextItem(%d) => %d\n",_list,startIndex,item);
418
int CListView::GetFocusedItem() const
420
int item = _list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED);
421
printf(" %p->GetFocusedItem() => %d\n",_list,item);
425
void CListView::RedrawAllItems()
427
printf("FIXME %p->RedrawAllItems()\n",_list);
431
int CListView::GetColumnCount()
433
return _list->GetColumnCount();
436
void CListView::SetFocus() { /* FIXME */ }
438
void CListView::RedrawItem(int item) { /* FIXME */ }
440
bool CListView::SortItems(PFNLVCOMPARE compareFunction, LPARAM dataParam) {
441
printf(" %p->SortItems()\n",_list);
442
return _list->SortItems(compareFunction, dataParam);
445
bool CListView::GetColumn(int columnIndex, LVCOLUMN* columnInfo)
448
bool ret = _list->GetColumn(columnIndex, item);
452
columnInfo->iOrder = 0; // FIXME
453
columnInfo->cx = item.GetWidth();
460
// HWND EditLabel(int itemIndex)
461
void CListView::EditLabel(int itemIndex)