]> git.saurik.com Git - wxWidgets.git/blob - src/msw/tbar95.cpp
added dcpsg.cpp
[wxWidgets.git] / src / msw / tbar95.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: tbar95.cpp
3 // Purpose: wxToolBar95
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "tbar95.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 #ifndef WX_PRECOMP
24 #include "wx/wx.h"
25 #endif
26
27 #if wxUSE_BUTTONBAR && wxUSE_TOOLBAR && defined(__WIN95__)
28
29 #if !defined(__GNUWIN32__) && !defined(__SALFORDC__)
30 #include "malloc.h"
31 #endif
32
33 #include <windows.h>
34
35 #if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__)
36 #include <commctrl.h>
37 #endif
38
39 #ifndef __TWIN32__
40 #ifdef __GNUWIN32__
41 #include "wx/msw/gnuwin32/extra.h"
42 #endif
43 #endif
44
45 #include "wx/msw/dib.h"
46 #include "wx/tbar95.h"
47 #include "wx/app.h"
48 #include "wx/msw/private.h"
49
50 // Styles
51 #ifndef TBSTYLE_FLAT
52 #define TBSTYLE_LIST 0x1000
53 #define TBSTYLE_FLAT 0x0800
54 #define TBSTYLE_TRANSPARENT 0x8000
55 #endif
56 // use TBSTYLE_TRANSPARENT if you use TBSTYLE_FLAT
57
58 // Messages
59 #ifndef TB_GETSTYLE
60 #define TB_GETSTYLE (WM_USER + 57)
61 #define TB_SETSTYLE (WM_USER + 56)
62 #endif
63
64 /* Hint from a newsgroup for custom flatbar drawing:
65 Set the TBSTYLE_CUSTOMERASE style, then handle the
66 NM_CUSTOMDRAW message and do your custom drawing.
67 */
68
69 #define DEFAULTBITMAPX 16
70 #define DEFAULTBITMAPY 15
71 #define DEFAULTBUTTONX 24
72 #define DEFAULTBUTTONY 24
73 #define DEFAULTBARHEIGHT 27
74
75 #if !USE_SHARED_LIBRARY
76 IMPLEMENT_DYNAMIC_CLASS(wxToolBar95, wxToolBarBase)
77 #endif
78
79 BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase)
80 EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent)
81 EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged)
82 END_EVENT_TABLE()
83
84 static void wxMapBitmap(HBITMAP hBitmap, int width, int height);
85
86 wxToolBar95::wxToolBar95()
87 {
88 m_maxWidth = -1;
89 m_maxHeight = -1;
90 m_hBitmap = 0;
91 m_defaultWidth = DEFAULTBITMAPX;
92 m_defaultHeight = DEFAULTBITMAPY;
93 }
94
95 bool wxToolBar95::Create(wxWindow *parent,
96 wxWindowID id,
97 const wxPoint& pos,
98 const wxSize& size,
99 long style,
100 const wxString& name)
101 {
102 m_hWnd = 0;
103
104 m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
105 GetGValue(GetSysColor(COLOR_BTNFACE)),
106 GetBValue(GetSysColor(COLOR_BTNFACE)));
107 m_foregroundColour = *wxBLACK ;
108
109 wxASSERT_MSG( (style & wxTB_VERTICAL) == 0,
110 _T("Sorry, wxToolBar95 under Windows 95 only "
111 "supports horizontal orientation.") );
112
113 m_maxWidth = -1;
114 m_maxHeight = -1;
115
116 m_hBitmap = 0;
117
118 m_defaultWidth = DEFAULTBITMAPX;
119 m_defaultHeight = DEFAULTBITMAPY;
120 SetName(name);
121
122 m_windowStyle = style;
123
124 SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
125 SetParent(parent);
126
127 int x = pos.x;
128 int y = pos.y;
129 int width = size.x;
130 int height = size.y;
131
132 if (width <= 0)
133 width = 100;
134 if (height <= 0)
135 height = 30;
136 if (x < 0)
137 x = 0;
138 if (y < 0)
139 y = 0;
140
141 m_windowId = (id < 0 ? NewControlId() : id);
142 DWORD msflags = 0;
143 if (style & wxBORDER)
144 msflags |= WS_BORDER;
145 msflags |= WS_CHILD | WS_VISIBLE | TBSTYLE_TOOLTIPS;
146
147 if (style & wxTB_FLAT)
148 {
149 if (wxTheApp->GetComCtl32Version() > 400)
150 msflags |= TBSTYLE_FLAT;
151 }
152
153 bool want3D;
154 WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
155
156 // Even with extended styles, need to combine with WS_BORDER
157 // for them to look right.
158 if ( want3D || wxStyleHasBorder(m_windowStyle) )
159 msflags |= WS_BORDER;
160
161 // Create the toolbar control.
162 HWND hWndToolbar = CreateWindowEx
163 (
164 exStyle, // Extended styles.
165 TOOLBARCLASSNAME, // Class name for the toolbar.
166 _T(""), // No default text.
167 msflags, // Styles
168 x, y, width, height, // Standard toolbar size and position.
169 (HWND) parent->GetHWND(), // Parent window of the toolbar.
170 (HMENU)m_windowId, // Toolbar ID.
171 wxGetInstance(), // Current instance.
172 NULL // No class data.
173 );
174
175 wxCHECK_MSG( hWndToolbar, FALSE, _T("Toolbar creation failed") );
176
177 // Toolbar-specific initialisation
178 ::SendMessage(hWndToolbar, TB_BUTTONSTRUCTSIZE,
179 (WPARAM)sizeof(TBBUTTON), (LPARAM)0);
180
181 m_hWnd = (WXHWND) hWndToolbar;
182 if (parent)
183 parent->AddChild(this);
184
185 SubclassWin((WXHWND)hWndToolbar);
186
187 return TRUE;
188 }
189
190 wxToolBar95::~wxToolBar95()
191 {
192 UnsubclassWin();
193
194 if (m_hBitmap)
195 {
196 ::DeleteObject((HBITMAP) m_hBitmap);
197 m_hBitmap = 0;
198 }
199 }
200
201 bool wxToolBar95::CreateTools()
202 {
203 if (m_tools.Number() == 0)
204 return FALSE;
205
206 HBITMAP oldToolBarBitmap = (HBITMAP) m_hBitmap;
207
208 int totalBitmapWidth = (int)(m_defaultWidth * m_tools.Number());
209 int totalBitmapHeight = (int)m_defaultHeight;
210
211 // Create a bitmap for all the tool bitmaps
212 HDC dc = ::GetDC(NULL);
213 m_hBitmap = (WXHBITMAP) ::CreateCompatibleBitmap(dc, totalBitmapWidth, totalBitmapHeight);
214 ::ReleaseDC(NULL, dc);
215
216 // Now blit all the tools onto this bitmap
217 HDC memoryDC = ::CreateCompatibleDC(NULL);
218 HBITMAP oldBitmap = (HBITMAP) ::SelectObject(memoryDC, (HBITMAP) m_hBitmap);
219
220 HDC memoryDC2 = ::CreateCompatibleDC(NULL);
221 int x = 0;
222 wxNode *node = m_tools.First();
223 int noButtons = 0;
224 while (node)
225 {
226 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
227 if ((tool->m_toolStyle != wxTOOL_STYLE_SEPARATOR) && tool->m_bitmap1.Ok() && tool->m_bitmap1.GetHBITMAP())
228 {
229 // wxPalette *palette = tool->m_bitmap1->GetPalette();
230
231 HBITMAP oldBitmap2 = (HBITMAP) ::SelectObject(memoryDC2, (HBITMAP) tool->m_bitmap1.GetHBITMAP());
232 /* int bltResult = */
233 BitBlt(memoryDC, x, 0, (int) m_defaultWidth, (int) m_defaultHeight, memoryDC2,
234 0, 0, SRCCOPY);
235 ::SelectObject(memoryDC2, oldBitmap2);
236 x += (int)m_defaultWidth;
237 noButtons ++;
238 }
239 node = node->Next();
240 }
241 ::SelectObject(memoryDC, oldBitmap);
242 ::DeleteDC(memoryDC);
243 ::DeleteDC(memoryDC2);
244
245 // Map to system colours
246 wxMapBitmap((HBITMAP) m_hBitmap, totalBitmapWidth, totalBitmapHeight);
247
248 if ( oldToolBarBitmap )
249 {
250 TBREPLACEBITMAP replaceBitmap;
251 replaceBitmap.hInstOld = NULL;
252 replaceBitmap.hInstNew = NULL;
253 replaceBitmap.nIDOld = (UINT) oldToolBarBitmap;
254 replaceBitmap.nIDNew = (UINT) (HBITMAP) m_hBitmap;
255 replaceBitmap.nButtons = noButtons;
256 if (::SendMessage((HWND) GetHWND(), TB_REPLACEBITMAP, (WPARAM) 0, (LPARAM) &replaceBitmap) == -1)
257 {
258 wxFAIL_MSG(_T("Could not add bitmap to toolbar"));
259 }
260
261 ::DeleteObject((HBITMAP) oldToolBarBitmap);
262
263 // Now delete all the buttons
264 int i = 0;
265 while ( TRUE )
266 {
267 // TODO: What about separators???? They don't have an id!
268 if ( ! ::SendMessage( (HWND) GetHWND(), TB_DELETEBUTTON, i, 0 ) )
269 break;
270 }
271 }
272 else
273 {
274 TBADDBITMAP addBitmap;
275 addBitmap.hInst = 0;
276 addBitmap.nID = (UINT)m_hBitmap;
277 if (::SendMessage((HWND) GetHWND(), TB_ADDBITMAP, (WPARAM) noButtons, (LPARAM) &addBitmap) == -1)
278 {
279 wxFAIL_MSG(_T("Could not add bitmap to toolbar"));
280 }
281 }
282
283 // Now add the buttons.
284 TBBUTTON buttons[50];
285
286 node = m_tools.First();
287 int i = 0;
288 int bitmapId = 0;
289 while (node)
290 {
291 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
292 if (tool->m_toolStyle == wxTOOL_STYLE_SEPARATOR)
293 {
294 buttons[i].iBitmap = 0;
295 buttons[i].idCommand = 0;
296
297 buttons[i].fsState = TBSTATE_ENABLED;
298 buttons[i].fsStyle = TBSTYLE_SEP;
299 buttons[i].dwData = 0L;
300 buttons[i].iString = 0;
301 }
302 else
303 {
304 buttons[i].iBitmap = bitmapId;
305 buttons[i].idCommand = tool->m_index;
306
307 buttons[i].fsState = 0;
308 if (tool->m_enabled)
309 buttons[i].fsState |= TBSTATE_ENABLED;
310 if (tool->m_toggleState)
311 buttons[i].fsState |= TBSTATE_CHECKED;
312 buttons[i].fsStyle = tool->m_isToggle ? TBSTYLE_CHECK : TBSTYLE_BUTTON;
313 buttons[i].dwData = 0L;
314 buttons[i].iString = 0;
315
316 bitmapId ++;
317 }
318
319 i ++;
320 node = node->Next();
321 }
322
323 long rc = ::SendMessage((HWND) GetHWND(), TB_ADDBUTTONS, (WPARAM)i, (LPARAM)& buttons);
324
325 wxCHECK_MSG( rc, FALSE, _T("failed to add buttons to the toolbar") );
326
327 (void)::SendMessage((HWND) GetHWND(), TB_AUTOSIZE, (WPARAM)0, (LPARAM) 0);
328
329 SetRows(m_maxRows);
330
331 return TRUE;
332 }
333
334 bool wxToolBar95::MSWCommand(WXUINT cmd, WXWORD id)
335 {
336 wxNode *node = m_tools.Find((long)id);
337 if (!node)
338 return FALSE;
339 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
340 if (tool->m_isToggle)
341 tool->m_toggleState = (1 == (1 & (int)::SendMessage((HWND) GetHWND(), TB_GETSTATE, (WPARAM) id, (LPARAM) 0)));
342
343 BOOL ret = OnLeftClick((int)id, tool->m_toggleState);
344 if (ret == FALSE && tool->m_isToggle)
345 {
346 tool->m_toggleState = !tool->m_toggleState;
347 ::SendMessage((HWND) GetHWND(), TB_CHECKBUTTON, (WPARAM)id, (LPARAM)MAKELONG(tool->m_toggleState, 0));
348 }
349 return TRUE;
350 }
351
352 bool wxToolBar95::MSWOnNotify(int WXUNUSED(idCtrl),
353 WXLPARAM lParam,
354 WXLPARAM *result)
355 {
356 // First check if this applies to us
357 NMHDR *hdr = (NMHDR *)lParam;
358
359 // the tooltips control created by the toolbar is sometimes Unicode, even in
360 // an ANSI application
361 if ( (hdr->code != TTN_NEEDTEXTA) && (hdr->code != TTN_NEEDTEXTW) )
362 return FALSE;
363
364 HWND toolTipWnd = (HWND)::SendMessage((HWND)GetHWND(), TB_GETTOOLTIPS, 0, 0);
365 if ( toolTipWnd != hdr->hwndFrom )
366 return FALSE;
367
368 LPTOOLTIPTEXT ttText = (LPTOOLTIPTEXT)lParam;
369 int id = (int)ttText->hdr.idFrom;
370 wxNode *node = m_tools.Find((long)id);
371 if (!node)
372 return FALSE;
373
374 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
375
376 const wxString& help = tool->m_shortHelpString;
377
378 if ( !help.IsEmpty() )
379 {
380 if ( hdr->code == TTN_NEEDTEXTA )
381 {
382 ttText->lpszText = (wxChar *)help.c_str();
383 }
384 #if (_WIN32_IE >= 0x0300)
385 else
386 {
387 // FIXME this is a temp hack only until I understand better what
388 // must be done in both ANSI and Unicode builds
389
390 size_t lenAnsi = help.Len();
391 #ifdef __MWERKS__
392 // MetroWerks doesn't like calling mbstowcs with NULL argument
393 size_t lenUnicode = 2*lenAnsi;
394 #else
395 size_t lenUnicode = mbstowcs(NULL, help, lenAnsi);
396 #endif
397
398 // using the pointer of right type avoids us doing all sorts of
399 // pointer arithmetics ourselves
400 wchar_t *dst = (wchar_t *)ttText->szText,
401 *pwz = new wchar_t[lenUnicode + 1];
402 mbstowcs(pwz, help, lenAnsi + 1);
403 memcpy(dst, pwz, lenUnicode*sizeof(wchar_t));
404
405 // put the terminating _wide_ NUL
406 dst[lenUnicode] = 0;
407
408 delete [] pwz;
409 }
410 #endif // _WIN32_IE >= 0x0300
411 }
412
413 // For backward compatibility...
414 OnMouseEnter(tool->m_index);
415
416 return TRUE;
417 }
418
419 void wxToolBar95::SetToolBitmapSize(const wxSize& size)
420 {
421 m_defaultWidth = size.x;
422 m_defaultHeight = size.y;
423 ::SendMessage((HWND) GetHWND(), TB_SETBITMAPSIZE, 0, (LPARAM) MAKELONG ((int)size.x, (int)size.y));
424 }
425
426 void wxToolBar95::SetRows(int nRows)
427 {
428 RECT rect;
429 ::SendMessage((HWND) GetHWND(), TB_SETROWS, MAKEWPARAM(nRows, TRUE), (LPARAM) & rect);
430 m_maxWidth = (rect.right - rect.left + 2);
431 m_maxHeight = (rect.bottom - rect.top + 2);
432 }
433
434 wxSize wxToolBar95::GetMaxSize() const
435 {
436 if ((m_maxWidth == -1) || (m_maxHeight == -1))
437 {
438 RECT rect;
439 ::SendMessage((HWND) GetHWND(), TB_SETROWS, MAKEWPARAM(m_maxRows, TRUE), (LPARAM) & rect);
440 ((wxToolBar95 *)this)->m_maxWidth = (rect.right - rect.left + 2); // ???
441 ((wxToolBar95 *)this)->m_maxHeight = (rect.bottom - rect.top + 2); // ???
442 }
443 return wxSize(m_maxWidth, m_maxHeight);
444 }
445
446 // The button size is bigger than the bitmap size
447 wxSize wxToolBar95::GetToolSize() const
448 {
449 return wxSize(m_defaultWidth + 8, m_defaultHeight + 7);
450 }
451
452 void wxToolBar95::EnableTool(int toolIndex, bool enable)
453 {
454 wxNode *node = m_tools.Find((long)toolIndex);
455 if (node)
456 {
457 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
458 tool->m_enabled = enable;
459 ::SendMessage((HWND) GetHWND(), TB_ENABLEBUTTON, (WPARAM)toolIndex, (LPARAM)MAKELONG(enable, 0));
460 }
461 }
462
463 void wxToolBar95::ToggleTool(int toolIndex, bool toggle)
464 {
465 wxNode *node = m_tools.Find((long)toolIndex);
466 if (node)
467 {
468 wxToolBarTool *tool = (wxToolBarTool *)node->Data();
469 if (tool->m_isToggle)
470 {
471 tool->m_toggleState = toggle;
472 ::SendMessage((HWND) GetHWND(), TB_CHECKBUTTON, (WPARAM)toolIndex, (LPARAM)MAKELONG(toggle, 0));
473 }
474 }
475 }
476
477 bool wxToolBar95::GetToolState(int toolIndex) const
478 {
479 return (::SendMessage((HWND) GetHWND(), TB_ISBUTTONCHECKED, (WPARAM)toolIndex, (LPARAM)0) != 0);
480 }
481
482 void wxToolBar95::ClearTools()
483 {
484 // TODO: Don't know how to reset the toolbar bitmap, as yet.
485 // But adding tools and calling CreateTools should probably
486 // recreate a buttonbar OK.
487 wxToolBarBase::ClearTools();
488 }
489
490 // If pushedBitmap is NULL, a reversed version of bitmap is
491 // created and used as the pushed/toggled image.
492 // If toggle is TRUE, the button toggles between the two states.
493 wxToolBarTool *wxToolBar95::AddTool(int index, const wxBitmap& bitmap, const wxBitmap& pushedBitmap,
494 bool toggle, long xPos, long yPos, wxObject *clientData, const wxString& helpString1, const wxString& helpString2)
495 {
496 wxToolBarTool *tool = new wxToolBarTool(index, bitmap, wxNullBitmap, toggle, xPos, yPos, helpString1, helpString2);
497 tool->m_clientData = clientData;
498
499 if (xPos > -1)
500 tool->m_x = xPos;
501 else
502 tool->m_x = m_xMargin;
503
504 if (yPos > -1)
505 tool->m_y = yPos;
506 else
507 tool->m_y = m_yMargin;
508
509 tool->SetSize(GetToolSize().x, GetToolSize().y);
510
511 m_tools.Append((long)index, tool);
512 return tool;
513 }
514
515 // Responds to colour changes, and passes event on to children.
516 void wxToolBar95::OnSysColourChanged(wxSysColourChangedEvent& event)
517 {
518 m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
519 GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
520
521 // Remap the buttons
522 CreateTools();
523
524 Refresh();
525
526 // Propagate the event to the non-top-level children
527 wxWindow::OnSysColourChanged(event);
528 }
529
530 void wxToolBar95::OnMouseEvent(wxMouseEvent& event)
531 {
532 if (event.RightDown())
533 {
534 // For now, we don't have an id. Later we could
535 // try finding the tool.
536 OnRightClick((int)-1, event.GetX(), event.GetY());
537 }
538 else
539 {
540 event.Skip();
541 }
542 }
543
544 // These are the default colors used to map the bitmap colors
545 // to the current system colors
546
547 #define BGR_BUTTONTEXT (RGB(000,000,000)) // black
548 #define BGR_BUTTONSHADOW (RGB(128,128,128)) // dark grey
549 #define BGR_BUTTONFACE (RGB(192,192,192)) // bright grey
550 #define BGR_BUTTONHILIGHT (RGB(255,255,255)) // white
551 #define BGR_BACKGROUNDSEL (RGB(255,000,000)) // blue
552 #define BGR_BACKGROUND (RGB(255,000,255)) // magenta
553
554 void wxMapBitmap(HBITMAP hBitmap, int width, int height)
555 {
556 COLORMAP ColorMap[] = {
557 {BGR_BUTTONTEXT, COLOR_BTNTEXT}, // black
558 {BGR_BUTTONSHADOW, COLOR_BTNSHADOW}, // dark grey
559 {BGR_BUTTONFACE, COLOR_BTNFACE}, // bright grey
560 {BGR_BUTTONHILIGHT, COLOR_BTNHIGHLIGHT},// white
561 {BGR_BACKGROUNDSEL, COLOR_HIGHLIGHT}, // blue
562 {BGR_BACKGROUND, COLOR_WINDOW} // magenta
563 };
564
565 int NUM_MAPS = (sizeof(ColorMap)/sizeof(COLORMAP));
566 int n;
567 for ( n = 0; n < NUM_MAPS; n++)
568 {
569 ColorMap[n].to = ::GetSysColor(ColorMap[n].to);
570 }
571
572 HBITMAP hbmOld;
573 HDC hdcMem = CreateCompatibleDC(NULL);
574
575 if (hdcMem)
576 {
577 hbmOld = (HBITMAP) SelectObject(hdcMem, hBitmap);
578
579 int i, j, k;
580 for ( i = 0; i < width; i++)
581 {
582 for ( j = 0; j < height; j++)
583 {
584 COLORREF pixel = ::GetPixel(hdcMem, i, j);
585 /*
586 BYTE red = GetRValue(pixel);
587 BYTE green = GetGValue(pixel);
588 BYTE blue = GetBValue(pixel);
589 */
590
591 for ( k = 0; k < NUM_MAPS; k ++)
592 {
593 if ( ColorMap[k].from == pixel )
594 {
595 /* COLORREF actualPixel = */ ::SetPixel(hdcMem, i, j, ColorMap[k].to);
596 break;
597 }
598 }
599 }
600 }
601
602
603 SelectObject(hdcMem, hbmOld);
604 DeleteObject(hdcMem);
605 }
606
607 }
608
609 // Some experiments...
610 #if 0
611 // What we want to do is create another bitmap which has a depth of 4,
612 // and set the bits. So probably we want to convert this HBITMAP into a
613 // DIB, then call SetDIBits.
614 // AAAGH. The stupid thing is that if newBitmap has a depth of 4 (less than that of
615 // the screen), then SetDIBits fails.
616 HBITMAP newBitmap = ::CreateBitmap(totalBitmapWidth, totalBitmapHeight, 1, 4, NULL);
617 HANDLE newDIB = ::BitmapToDIB((HBITMAP) m_hBitmap, NULL);
618 LPBITMAPINFOHEADER lpbmi = (LPBITMAPINFOHEADER) GlobalLock(newDIB);
619
620 dc = ::GetDC(NULL);
621 // LPBITMAPINFOHEADER lpbmi = (LPBITMAPINFOHEADER) newDIB;
622
623 int result = ::SetDIBits(dc, newBitmap, 0, lpbmi->biHeight, FindDIBBits((LPSTR)lpbmi), (LPBITMAPINFO)lpbmi,
624 DIB_PAL_COLORS);
625 DWORD err = GetLastError();
626
627 ::ReleaseDC(NULL, dc);
628
629 // Delete the DIB
630 GlobalUnlock (newDIB);
631 GlobalFree (newDIB);
632
633 // WXHBITMAP hBitmap2 = wxCreateMappedBitmap((WXHINSTANCE) wxGetInstance(), (WXHBITMAP) m_hBitmap);
634 // Substitute our new bitmap for the old one
635 ::DeleteObject((HBITMAP) m_hBitmap);
636 m_hBitmap = (WXHBITMAP) newBitmap;
637 #endif
638
639
640 #endif