]> git.saurik.com Git - wxWidgets.git/blob - src/gtk/frame.cpp
i18n fixes
[wxWidgets.git] / src / gtk / frame.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: frame.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifdef __GNUG__
11 #pragma implementation "frame.h"
12 #endif
13
14 #include "wx/frame.h"
15 #include "wx/dialog.h"
16 #include "wx/control.h"
17 #include "wx/app.h"
18 #include "wx/menu.h"
19 #include "wx/toolbar.h"
20 #include "wx/statusbr.h"
21 #include "wx/dcclient.h"
22
23 #include "glib.h"
24 #include "gdk/gdk.h"
25 #include "gtk/gtk.h"
26 #include "wx/gtk/win_gtk.h"
27
28 //-----------------------------------------------------------------------------
29 // constants
30 //-----------------------------------------------------------------------------
31
32 const int wxMENU_HEIGHT = 27;
33 const int wxSTATUS_HEIGHT = 25;
34
35 //-----------------------------------------------------------------------------
36 // data
37 //-----------------------------------------------------------------------------
38
39 extern wxList wxTopLevelWindows;
40 extern wxList wxPendingDelete;
41
42 //-----------------------------------------------------------------------------
43 // "size_allocate"
44 //-----------------------------------------------------------------------------
45
46 static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
47 {
48 if (!win->HasVMT()) return;
49
50 /*
51 printf( "OnFrameResize from " );
52 if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
53 printf( win->GetClassInfo()->GetClassName() );
54 printf( ".\n" );
55 */
56
57 if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
58 {
59 win->m_sizeSet = FALSE;
60 win->m_width = alloc->width;
61 win->m_height = alloc->height;
62 }
63 }
64
65 //-----------------------------------------------------------------------------
66 // "delete_event"
67 //-----------------------------------------------------------------------------
68
69 static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxFrame *win )
70 {
71 /*
72 printf( "OnDelete from " );
73 if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
74 printf( win->GetClassInfo()->GetClassName() );
75 printf( ".\n" );
76 */
77
78 win->Close();
79
80 return TRUE;
81 }
82
83 //-----------------------------------------------------------------------------
84 // "configure_event"
85 //-----------------------------------------------------------------------------
86
87 static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
88 {
89 if (!win->HasVMT()) return FALSE;
90
91 win->m_x = event->x;
92 win->m_y = event->y;
93
94 wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() );
95 mevent.SetEventObject( win );
96 win->GetEventHandler()->ProcessEvent( mevent );
97
98 return FALSE;
99 }
100
101 //-----------------------------------------------------------------------------
102 // wxFrame
103 //-----------------------------------------------------------------------------
104
105 BEGIN_EVENT_TABLE(wxFrame, wxWindow)
106 EVT_SIZE(wxFrame::OnSize)
107 EVT_CLOSE(wxFrame::OnCloseWindow)
108 EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
109 END_EVENT_TABLE()
110
111 IMPLEMENT_DYNAMIC_CLASS(wxFrame,wxWindow)
112
113 wxFrame::wxFrame()
114 {
115 m_frameMenuBar = (wxMenuBar *) NULL;
116 m_mdiMenuBar = (wxMenuBar *) NULL;
117 m_frameStatusBar = (wxStatusBar *) NULL;
118 m_frameToolBar = (wxToolBar *) NULL;
119 m_sizeSet = FALSE;
120 m_miniEdge = 0;
121 m_miniTitle = 0;
122 }
123
124 wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
125 const wxPoint &pos, const wxSize &size,
126 long style, const wxString &name )
127 {
128 m_frameMenuBar = (wxMenuBar *) NULL;
129 m_mdiMenuBar = (wxMenuBar *) NULL;
130 m_frameStatusBar = (wxStatusBar *) NULL;
131 m_frameToolBar = (wxToolBar *) NULL;
132 m_sizeSet = FALSE;
133 m_miniEdge = 0;
134 m_miniTitle = 0;
135 Create( parent, id, title, pos, size, style, name );
136 }
137
138 bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
139 const wxPoint &pos, const wxSize &size,
140 long style, const wxString &name )
141 {
142 wxTopLevelWindows.Append( this );
143
144 m_needParent = FALSE;
145
146 PreCreation( parent, id, pos, size, style, name );
147
148 m_title = title;
149
150 GtkWindowType win_type = GTK_WINDOW_TOPLEVEL;
151 if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP;
152
153 m_widget = gtk_window_new( win_type );
154
155 gtk_window_set_title( GTK_WINDOW(m_widget), title );
156 GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
157
158 gtk_window_set_policy( GTK_WINDOW(m_widget), 1, 1, 0 );
159
160 gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
161 GTK_SIGNAL_FUNC(gtk_frame_delete_callback), (gpointer)this );
162
163 m_wxwindow = gtk_myfixed_new();
164 gtk_widget_show( m_wxwindow );
165 GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
166
167 gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
168
169 if (m_parent) m_parent->AddChild( this );
170
171 PostCreation();
172
173 gtk_widget_realize( m_widget );
174
175 gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
176 GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
177
178 gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event",
179 GTK_SIGNAL_FUNC(gtk_frame_configure_callback), (gpointer)this );
180
181 return TRUE;
182 }
183
184 wxFrame::~wxFrame()
185 {
186 if (m_frameMenuBar) delete m_frameMenuBar;
187 m_frameMenuBar = (wxMenuBar *) NULL;
188
189 if (m_frameStatusBar) delete m_frameStatusBar;
190 m_frameStatusBar = (wxStatusBar *) NULL;
191
192 if (m_frameToolBar) delete m_frameToolBar;
193 m_frameToolBar = (wxToolBar *) NULL;
194
195 wxTopLevelWindows.DeleteObject( this );
196
197 if (wxTheApp->GetTopWindow() == this)
198 {
199 wxTheApp->SetTopWindow( (wxWindow*) NULL );
200 }
201
202 if (wxTopLevelWindows.Number() == 0)
203 {
204 wxTheApp->ExitMainLoop();
205 }
206 }
207
208 bool wxFrame::Show( bool show )
209 {
210 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
211
212 if (show && !m_sizeSet)
213 {
214 /* by calling GtkOnSize here, we don't have to call
215 either after showing the frame, which would entail
216 much ugly flicker nor from within the size_allocate
217 handler, because GTK 1.1.X forbids that. */
218
219 GtkOnSize( m_x, m_y, m_width, m_height );
220 }
221
222 return wxWindow::Show( show );
223 }
224
225 bool wxFrame::Destroy()
226 {
227 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
228
229 if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this);
230
231 return TRUE;
232 }
233
234 wxPoint wxFrame::GetClientAreaOrigin() const
235 {
236 wxPoint pt( m_miniEdge, m_miniEdge + m_miniTitle );
237 if (m_frameMenuBar)
238 {
239 int h = 0;
240 m_frameMenuBar->GetSize( (int*)NULL, &h );
241 pt.y += h;
242 }
243 if (m_frameToolBar)
244 {
245 int h = 0;
246 m_frameToolBar->GetSize( (int*)NULL, &h );
247 pt.y += h;
248 }
249 return pt;
250 }
251
252 void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
253 {
254 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
255
256 /* don't do anything for children of wxMDIChildFrame */
257 if (!m_wxwindow) return;
258
259 if (m_resizing) return; // I don't like recursions
260 m_resizing = TRUE;
261
262 int old_x = m_x;
263 int old_y = m_y;
264 int old_width = m_width;
265 int old_height = m_height;
266
267 if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
268 {
269 if (x != -1) m_x = x;
270 if (y != -1) m_y = y;
271 if (width != -1) m_width = width;
272 if (height != -1) m_height = height;
273 }
274 else
275 {
276 m_x = x;
277 m_y = y;
278 m_width = width;
279 m_height = height;
280 }
281
282 if ((sizeFlags & wxSIZE_AUTO_WIDTH) == wxSIZE_AUTO_WIDTH)
283 {
284 if (width == -1) m_width = 80;
285 }
286
287 if ((sizeFlags & wxSIZE_AUTO_HEIGHT) == wxSIZE_AUTO_HEIGHT)
288 {
289 if (height == -1) m_height = 26;
290 }
291
292 if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
293 if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
294 if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
295 if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
296
297 if ((m_x != -1) || (m_y != -1))
298 {
299 if ((m_x != old_x) || (m_y != old_y))
300 {
301 /* m_sizeSet = FALSE; */
302 gtk_widget_set_uposition( m_widget, m_x, m_y );
303 }
304 }
305
306 if ((m_width != old_width) || (m_height != old_height))
307 {
308 /* we set the size in GtkOnSize */
309 m_sizeSet = FALSE;
310 }
311
312 m_resizing = FALSE;
313 }
314
315 void wxFrame::SetSize( int width, int height )
316 {
317 SetSize( -1, -1, width, height, wxSIZE_USE_EXISTING );
318 }
319
320 void wxFrame::Centre( int direction )
321 {
322 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
323
324 int x = 0;
325 int y = 0;
326
327 if ((direction & wxHORIZONTAL) == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2;
328 if ((direction & wxVERTICAL) == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2;
329
330 Move( x, y );
331 }
332
333 void wxFrame::GetClientSize( int *width, int *height ) const
334 {
335 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
336
337 wxWindow::GetClientSize( width, height );
338 if (height)
339 {
340 if (m_frameMenuBar) (*height) -= wxMENU_HEIGHT;
341 if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT;
342 if (m_frameToolBar)
343 {
344 int y = 0;
345 m_frameToolBar->GetSize( (int *) NULL, &y );
346 (*height) -= y;
347 }
348 (*height) -= m_miniEdge*2 + m_miniTitle;
349 }
350 if (width)
351 {
352 (*width) -= m_miniEdge*2;
353 }
354 }
355
356 void wxFrame::SetClientSize( int width, int height )
357 {
358 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
359
360 int h = height;
361 if (m_frameMenuBar) h += wxMENU_HEIGHT;
362 if (m_frameStatusBar) h += wxSTATUS_HEIGHT;
363 if (m_frameToolBar)
364 {
365 int y = 0;
366 m_frameToolBar->GetSize( (int *) NULL, &y );
367 h += y;
368 }
369 wxWindow::SetClientSize( width + m_miniEdge*2, h + m_miniEdge*2 + m_miniTitle );
370 }
371
372 void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
373 {
374 // due to a bug in gtk, x,y are always 0
375 // m_x = x;
376 // m_y = y;
377
378 if (m_resizing) return;
379 m_resizing = TRUE;
380
381 if (!m_wxwindow) return;
382
383 m_width = width;
384 m_height = height;
385
386 /* check if size is in legal range */
387 if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
388 if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
389 if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
390 if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
391
392 /* this emulates the new wxMSW behaviour of placing all
393 * frame-subwindows (menu, toolbar..) on one native window
394 * this hurts in the eye, but I don't want to call SetSize()
395 * because I don't want to call any non-native functions here. */
396
397 if (m_frameMenuBar)
398 {
399 int xx = m_miniEdge;
400 int yy = m_miniEdge + m_miniTitle;
401 int ww = m_width - 2*m_miniEdge;
402 int hh = wxMENU_HEIGHT;
403 m_frameMenuBar->m_x = xx;
404 m_frameMenuBar->m_y = yy;
405 m_frameMenuBar->m_width = ww;
406 m_frameMenuBar->m_height = hh;
407
408 gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, xx, yy );
409 gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh );
410 }
411
412 if (m_frameToolBar)
413 {
414 int xx = m_miniEdge;
415 int yy = m_miniEdge + m_miniTitle;
416 if ((m_frameMenuBar) || (m_mdiMenuBar)) yy += wxMENU_HEIGHT;
417 int ww = m_width - 2*m_miniEdge;
418 int hh = m_frameToolBar->m_height;
419
420 m_frameToolBar->m_x = xx;
421 m_frameToolBar->m_y = yy;
422 m_frameToolBar->m_height = hh;
423 m_frameToolBar->m_width = ww;
424
425 gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameToolBar->m_widget, xx, yy );
426 gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh );
427 }
428
429 if (m_frameStatusBar)
430 {
431 int xx = 0 + m_miniEdge;
432 int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge;
433 int ww = m_width - 2*m_miniEdge;
434 int hh = wxSTATUS_HEIGHT;
435
436 m_frameStatusBar->m_x = xx;
437 m_frameStatusBar->m_y = yy;
438 m_frameStatusBar->m_width = ww;
439 m_frameStatusBar->m_height = hh;
440
441 gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, xx, yy );
442 gtk_widget_set_usize( m_frameStatusBar->m_widget, ww, hh );
443 }
444
445 /* we actually set the size of a frame here and no-where else */
446 gtk_widget_set_usize( m_widget, m_width, m_height );
447
448 m_sizeSet = TRUE;
449
450 /* send size event to frame */
451 wxSizeEvent event( wxSize(m_width,m_height), GetId() );
452 event.SetEventObject( this );
453 GetEventHandler()->ProcessEvent( event );
454
455 /* send size event to status bar */
456 if (m_frameStatusBar)
457 {
458 wxSizeEvent event2( wxSize(m_frameStatusBar->m_width,m_frameStatusBar->m_height), m_frameStatusBar->GetId() );
459 event2.SetEventObject( m_frameStatusBar );
460 m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 );
461 }
462
463 m_resizing = FALSE;
464 }
465
466 void wxFrame::OnInternalIdle()
467 {
468 if (!m_sizeSet)
469 GtkOnSize( m_x, m_y, m_width, m_height );
470
471 DoMenuUpdates();
472 }
473
474 void wxFrame::OnCloseWindow( wxCloseEvent& event )
475 {
476 // close the window if it wasn't vetoed by the application
477 // if ( !event.GetVeto() ) // No, this isn't the interpretation of GetVeto.
478 Destroy();
479 }
480
481 void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
482 {
483 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
484
485 if (GetAutoLayout())
486 {
487 Layout();
488 }
489 else
490 {
491 /* no child: go out ! */
492 if (!GetChildren().First()) return;
493
494 /* do we have exactly one child? */
495 wxWindow *child = (wxWindow *) NULL;
496 for(wxNode *node = GetChildren().First(); node; node = node->Next())
497 {
498 wxWindow *win = (wxWindow *)node->Data();
499 if (!wxIS_KIND_OF(win,wxFrame) && !wxIS_KIND_OF(win,wxDialog)
500 #if 0 // not in m_children anyway ?
501 && (win != m_frameMenuBar) &&
502 (win != m_frameToolBar) &&
503 (win != m_frameStatusBar)
504 #endif
505 )
506 {
507 /* it's the second one: do nothing */
508 if (child) return;
509 child = win;
510 }
511 }
512
513 /* yes: set it's size to fill all the frame */
514 int client_x, client_y;
515 GetClientSize( &client_x, &client_y );
516 child->SetSize( 1, 1, client_x-2, client_y-2 );
517 }
518 }
519
520 static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
521 {
522 menu->SetInvokingWindow( win );
523 wxNode *node = menu->m_items.First();
524 while (node)
525 {
526 wxMenuItem *menuitem = (wxMenuItem*)node->Data();
527 if (menuitem->IsSubMenu())
528 SetInvokingWindow( menuitem->GetSubMenu(), win );
529 node = node->Next();
530 }
531 }
532
533 void wxFrame::SetMenuBar( wxMenuBar *menuBar )
534 {
535 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
536 wxASSERT_MSG( (m_wxwindow != NULL), "invalid frame" );
537
538 m_frameMenuBar = menuBar;
539
540 if (m_frameMenuBar)
541 {
542 wxNode *node = m_frameMenuBar->m_menus.First();
543 while (node)
544 {
545 wxMenu *menu = (wxMenu*)node->Data();
546 SetInvokingWindow( menu, this );
547 node = node->Next();
548 }
549
550 if (m_frameMenuBar->m_parent != this)
551 {
552 m_frameMenuBar->m_parent = this;
553 gtk_myfixed_put( GTK_MYFIXED(m_wxwindow),
554 m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
555
556 /* an mdi child menu bar might be underneath */
557 if (m_mdiMenuBar) m_frameMenuBar->Show( FALSE );
558 }
559 }
560
561 m_sizeSet = FALSE;
562 }
563
564 wxMenuBar *wxFrame::GetMenuBar() const
565 {
566 return m_frameMenuBar;
567 }
568
569 void wxFrame::OnMenuHighlight(wxMenuEvent& event)
570 {
571 if (GetStatusBar())
572 {
573 if (event.GetMenuId() == -1)
574 {
575 SetStatusText("");
576 }
577 else
578 {
579 wxMenuBar *menuBar = GetMenuBar();
580 if (menuBar)
581 {
582 int menuId = event.GetMenuId();
583 wxString helpString;
584 helpString = menuBar->GetHelpString(menuId);
585 if (helpString != "")
586 SetStatusText(helpString);
587 }
588 }
589 }
590 }
591
592 wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
593 {
594 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
595
596 wxCHECK_MSG( m_frameToolBar == NULL, FALSE, "recreating toolbar in wxFrame" );
597
598 m_frameToolBar = OnCreateToolBar( style, id, name );
599
600 GetChildren().DeleteObject( m_frameToolBar );
601
602 m_sizeSet = FALSE;
603
604 return m_frameToolBar;
605 }
606
607 wxToolBar* wxFrame::OnCreateToolBar( long style, wxWindowID id, const wxString& name )
608 {
609 return new wxToolBar( this, id, wxDefaultPosition, wxDefaultSize, style, name );
610 }
611
612 wxToolBar *wxFrame::GetToolBar() const
613 {
614 return m_frameToolBar;
615 }
616
617 wxStatusBar* wxFrame::CreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
618 {
619 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
620
621 wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, "recreating status bar in wxFrame" );
622
623 m_frameStatusBar = OnCreateStatusBar( number, style, id, name );
624
625 m_sizeSet = FALSE;
626
627 return m_frameStatusBar;
628 }
629
630 wxStatusBar *wxFrame::OnCreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
631 {
632 wxStatusBar *statusBar = (wxStatusBar *) NULL;
633
634 statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 20), style, name);
635
636 // Set the height according to the font and the border size
637 wxClientDC dc(statusBar);
638 dc.SetFont( statusBar->GetFont() );
639
640 long x, y;
641 dc.GetTextExtent( "X", &x, &y );
642
643 int height = (int)( (y * 1.1) + 2* statusBar->GetBorderY());
644
645 statusBar->SetSize( -1, -1, 100, height );
646
647 statusBar->SetFieldsCount( number );
648 return statusBar;
649 }
650
651 void wxFrame::SetStatusText(const wxString& text, int number)
652 {
653 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
654
655 wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" );
656
657 m_frameStatusBar->SetStatusText(text, number);
658 }
659
660 void wxFrame::SetStatusWidths(int n, const int widths_field[] )
661 {
662 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
663
664 wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" );
665
666 m_frameStatusBar->SetStatusWidths(n, widths_field);
667 }
668
669 wxStatusBar *wxFrame::GetStatusBar() const
670 {
671 return m_frameStatusBar;
672 }
673
674 void wxFrame::SetTitle( const wxString &title )
675 {
676 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
677
678 m_title = title;
679 if (m_title.IsNull()) m_title = "";
680 gtk_window_set_title( GTK_WINDOW(m_widget), title );
681 }
682
683 void wxFrame::SetIcon( const wxIcon &icon )
684 {
685 wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
686
687 m_icon = icon;
688 if (!icon.Ok()) return;
689
690 wxMask *mask = icon.GetMask();
691 GdkBitmap *bm = (GdkBitmap *) NULL;
692 if (mask) bm = mask->GetBitmap();
693
694 gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
695 }
696