1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "frame.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
29 #include "wx/dialog.h"
30 #include "wx/settings.h"
31 #include "wx/dcclient.h"
34 #include "wx/msw/private.h"
35 #include "wx/statusbr.h"
36 #include "wx/toolbar.h"
37 #include "wx/menuitem.h"
39 #ifdef LoadAccelerators
40 #undef LoadAccelerators
43 #if USE_NATIVE_STATUSBAR
44 #include <wx/msw/statbr95.h>
47 extern wxList wxModelessWindows
;
48 extern wxList wxPendingDelete
;
49 extern char wxFrameClassName
[];
51 #if !USE_SHARED_LIBRARY
52 BEGIN_EVENT_TABLE(wxFrame
, wxWindow
)
53 EVT_SIZE(wxFrame::OnSize
)
54 EVT_ACTIVATE(wxFrame::OnActivate
)
55 EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight
)
56 EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged
)
57 EVT_IDLE(wxFrame::OnIdle
)
58 EVT_CLOSE(wxFrame::OnCloseWindow
)
61 IMPLEMENT_DYNAMIC_CLASS(wxFrame
, wxWindow
)
64 #if USE_NATIVE_STATUSBAR
65 bool wxFrame::m_useNativeStatusBar
= TRUE
;
67 bool wxFrame::m_useNativeStatusBar
= FALSE
;
70 wxFrame::wxFrame(void)
72 m_frameToolBar
= NULL
;
73 m_frameMenuBar
= NULL
;
74 m_frameStatusBar
= NULL
;
76 m_windowParent
= NULL
;
80 bool wxFrame::Create(wxWindow
*parent
,
82 const wxString
& title
,
89 wxTopLevelWindows
.Append(this);
92 // m_modalShowing = FALSE;
93 m_windowStyle
= style
;
94 m_frameMenuBar
= NULL
;
95 m_frameToolBar
= NULL
;
96 m_frameStatusBar
= NULL
;
98 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
));
104 m_windowId
= (int)NewControlId();
106 if (parent
) parent
->AddChild(this);
114 MSWCreate(m_windowId
, (wxWindow
*)parent
, wxFrameClassName
, this, (char *)(const char *)title
,
115 x
, y
, width
, height
, style
);
117 wxModelessWindows
.Append(this);
121 wxFrame::~wxFrame(void)
123 m_isBeingDeleted
= TRUE
;
124 wxTopLevelWindows
.DeleteObject(this);
126 if (m_frameStatusBar
)
127 delete m_frameStatusBar
;
129 delete m_frameMenuBar
;
131 /* New behaviour March 1998: check if it's the last top-level window */
132 // if (wxTheApp && (this == wxTheApp->GetTopWindow()))
134 if (wxTheApp
&& (wxTopLevelWindows
.Number() == 0))
136 wxTheApp
->SetTopWindow(NULL
);
138 if (wxTheApp
->GetExitOnFrameDelete())
144 wxModelessWindows
.DeleteObject(this);
146 // For some reason, wxWindows can activate another task altogether
147 // when a frame is destroyed after a modal dialog has been invoked.
148 // Try to bring the parent to the top.
149 if (GetParent() && GetParent()->GetHWND())
150 ::BringWindowToTop((HWND
) GetParent()->GetHWND());
153 WXHMENU
wxFrame::GetWinMenu(void) const
158 // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
159 void wxFrame::GetClientSize(int *x
, int *y
) const
162 GetClientRect((HWND
) GetHWND(), &rect
);
164 if ( GetStatusBar() )
166 int statusX
, statusY
;
167 GetStatusBar()->GetClientSize(&statusX
, &statusY
);
168 rect
.bottom
-= statusY
;
171 wxPoint
pt(GetClientAreaOrigin());
179 // Set the client size (i.e. leave the calculation of borders etc.
181 void wxFrame::SetClientSize(int width
, int height
)
183 HWND hWnd
= (HWND
) GetHWND();
186 GetClientRect(hWnd
, &rect
);
189 GetWindowRect(hWnd
, &rect2
);
191 // Find the difference between the entire window (title bar and all)
192 // and the client area; add this to the new client size to move the
194 int actual_width
= rect2
.right
- rect2
.left
- rect
.right
+ width
;
195 int actual_height
= rect2
.bottom
- rect2
.top
- rect
.bottom
+ height
;
197 if ( GetStatusBar() )
199 int statusX
, statusY
;
200 GetStatusBar()->GetClientSize(&statusX
, &statusY
);
201 actual_height
+= statusY
;
204 wxPoint
pt(GetClientAreaOrigin());
205 actual_width
+= pt
.y
;
206 actual_height
+= pt
.x
;
209 point
.x
= rect2
.left
;
212 MoveWindow(hWnd
, point
.x
, point
.y
, actual_width
, actual_height
, (BOOL
)TRUE
);
214 wxSizeEvent
event(wxSize(width
, height
), m_windowId
);
215 event
.SetEventObject( this );
216 GetEventHandler()->ProcessEvent(event
);
219 void wxFrame::GetSize(int *width
, int *height
) const
222 GetWindowRect((HWND
) GetHWND(), &rect
);
223 *width
= rect
.right
- rect
.left
;
224 *height
= rect
.bottom
- rect
.top
;
227 void wxFrame::GetPosition(int *x
, int *y
) const
230 GetWindowRect((HWND
) GetHWND(), &rect
);
239 void wxFrame::SetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
241 int currentX
, currentY
;
247 GetPosition(¤tX
, ¤tY
);
248 if (x
== -1 || (sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
250 if (y
== -1 || (sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
255 if (width
== -1) w1
= ww
;
256 if (height
==-1) h1
= hh
;
258 MoveWindow((HWND
) GetHWND(), x1
, y1
, w1
, h1
, (BOOL
)TRUE
);
260 wxSizeEvent
event(wxSize(width
, height
), m_windowId
);
261 event
.SetEventObject( this );
262 GetEventHandler()->ProcessEvent(event
);
265 bool wxFrame::Show(bool show
)
275 // Try to highlight the correct window (the parent)
279 hWndParent
= (HWND
) GetParent()->GetHWND();
281 ::BringWindowToTop(hWndParent
);
285 ShowWindow((HWND
) GetHWND(), (BOOL
)cshow
);
288 BringWindowToTop((HWND
) GetHWND());
290 wxActivateEvent
event(wxEVT_ACTIVATE
, TRUE
, m_windowId
);
291 event
.SetEventObject( this );
292 GetEventHandler()->ProcessEvent(event
);
297 void wxFrame::Iconize(bool iconize
)
307 ShowWindow((HWND
) GetHWND(), (BOOL
)cshow
);
308 m_iconized
= iconize
;
311 // Equivalent to maximize/restore in Windows
312 void wxFrame::Maximize(bool maximize
)
320 ShowWindow((HWND
) GetHWND(), cshow
);
324 bool wxFrame::IsIconized(void) const
326 ((wxFrame
*)this)->m_iconized
= (::IsIconic((HWND
) GetHWND()) != 0);
330 void wxFrame::SetTitle(const wxString
& title
)
332 SetWindowText((HWND
) GetHWND(), (const char *)title
);
335 wxString
wxFrame::GetTitle(void) const
337 GetWindowText((HWND
) GetHWND(), wxBuffer
, 1000);
338 return wxString(wxBuffer
);
341 void wxFrame::SetIcon(const wxIcon
& icon
)
344 #if defined(__WIN95__)
346 SendMessage((HWND
) GetHWND(), WM_SETICON
,
347 (WPARAM
)TRUE
, (LPARAM
)(HICON
) m_icon
.GetHICON());
351 wxStatusBar
*wxFrame::OnCreateStatusBar(int number
, long style
, wxWindowID id
,
352 const wxString
& name
)
354 wxStatusBar
*statusBar
= NULL
;
356 #if USE_NATIVE_STATUSBAR
357 if (UsesNativeStatusBar())
359 statusBar
= new wxStatusBar95(this, id
, style
);
364 statusBar
= new wxStatusBar(this, id
, wxPoint(0, 0), wxSize(100, 20),
367 // Set the height according to the font and the border size
368 wxClientDC
dc(statusBar
);
369 dc
.SetFont(* statusBar
->GetFont());
372 dc
.GetTextExtent("X", &x
, &y
);
374 int height
= (int)( (y
* 1.1) + 2* statusBar
->GetBorderY());
376 statusBar
->SetSize(-1, -1, 100, height
);
379 statusBar
->SetFieldsCount(number
);
383 wxStatusBar
* wxFrame::CreateStatusBar(int number
, long style
, wxWindowID id
,
384 const wxString
& name
)
386 // VZ: calling CreateStatusBar twice is an error - why anyone would do it?
387 wxCHECK_MSG( m_frameStatusBar
== NULL
, FALSE
,
388 "recreating status bar in wxFrame" );
390 m_frameStatusBar
= OnCreateStatusBar(number
, style
, id
,
392 if ( m_frameStatusBar
)
395 return m_frameStatusBar
;
401 void wxFrame::SetStatusText(const wxString
& text
, int number
)
403 wxCHECK_RET( m_frameStatusBar
!= NULL
, "no statusbar to set text for" );
405 m_frameStatusBar
->SetStatusText(text
, number
);
408 void wxFrame::SetStatusWidths(int n
, const int widths_field
[])
410 wxCHECK_RET( m_frameStatusBar
!= NULL
, "no statusbar to set widths for" );
412 m_frameStatusBar
->SetStatusWidths(n
, widths_field
);
416 void wxFrame::PositionStatusBar(void)
418 // native status bar positions itself
420 #if USE_NATIVE_STATUSBAR
421 && !m_frameStatusBar
->IsKindOf(CLASSINFO(wxStatusBar95
))
426 GetClientSize(&w
, &h
);
428 m_frameStatusBar
->GetSize(&sw
, &sh
);
430 // Since we wish the status bar to be directly under the client area,
431 // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
432 m_frameStatusBar
->SetSize(0, h
, w
, sh
);
436 void wxFrame::SetMenuBar(wxMenuBar
*menu_bar
)
440 m_frameMenuBar
= NULL
;
444 if (menu_bar
->m_menuBarFrame
)
448 HMENU menu
= CreateMenu();
450 for (i
= 0; i
< menu_bar
->m_menuCount
; i
++)
452 HMENU popup
= (HMENU
)menu_bar
->m_menus
[i
]->m_hMenu
;
454 // After looking Bounds Checker result, it seems that all
455 // menus must be individually destroyed. So, don't reset m_hMenu,
456 // to allow ~wxMenu to do the job.
458 menu_bar
->m_menus
[i
]->m_savehMenu
= (WXHMENU
) popup
;
459 // Uncommenting for the moment... JACS
460 menu_bar
->m_menus
[i
]->m_hMenu
= 0;
461 AppendMenu(menu
, MF_POPUP
| MF_STRING
, (UINT
)popup
, menu_bar
->m_titles
[i
]);
464 menu_bar
->m_hMenu
= (WXHMENU
)menu
;
466 delete m_frameMenuBar
;
468 this->m_hMenu
= (WXHMENU
) menu
;
471 if (!SetMenu((HWND
) GetHWND(), menu
))
474 err
= GetLastError();
478 m_frameMenuBar
= menu_bar
;
479 menu_bar
->m_menuBarFrame
= this;
482 bool wxFrame::LoadAccelerators(const wxString
& table
)
484 m_acceleratorTable
= (WXHANDLE
)
487 ::LoadAcceleratorsW(wxGetInstance(), (const char *)table
);
489 ::LoadAcceleratorsA(wxGetInstance(), (const char *)table
);
492 ::LoadAccelerators(wxGetInstance(), (const char *)table
);
495 // The above is necessary because LoadAccelerators is a macro
496 // which we have undefed earlier in the file to avoid confusion
497 // with wxFrame::LoadAccelerators. Ugh!
499 return (m_acceleratorTable
!= (WXHANDLE
) NULL
);
502 void wxFrame::Fit(void)
504 // Work out max. size
505 wxNode
*node
= GetChildren()->First();
510 // Find a child that's a subwindow, but not a dialog box.
511 wxWindow
*win
= (wxWindow
*)node
->Data();
513 if (!win
->IsKindOf(CLASSINFO(wxFrame
)) &&
514 !win
->IsKindOf(CLASSINFO(wxDialog
)))
518 win
->GetSize(&width
, &height
);
519 win
->GetPosition(&x
, &y
);
521 if ((x
+ width
) > max_width
)
522 max_width
= x
+ width
;
523 if ((y
+ height
) > max_height
)
524 max_height
= y
+ height
;
528 SetClientSize(max_width
, max_height
);
531 // Responds to colour changes, and passes event on to children.
532 void wxFrame::OnSysColourChanged(wxSysColourChangedEvent
& event
)
534 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE
));
537 if ( m_frameStatusBar
)
539 wxSysColourChangedEvent event2
;
540 event2
.SetEventObject( m_frameStatusBar
);
541 m_frameStatusBar
->ProcessEvent(event2
);
544 // Propagate the event to the non-top-level children
545 wxWindow::OnSysColourChanged(event
);
553 void wxFrame::MSWCreate(int id
, wxWindow
*parent
, const char *wclass
, wxWindow
*wx_win
, const char *title
,
554 int x
, int y
, int width
, int height
, long style
)
557 m_defaultIcon
= (WXHICON
) (wxSTD_FRAME_ICON
? wxSTD_FRAME_ICON
: wxDEFAULT_FRAME_ICON
);
559 // If child windows aren't properly drawn initially, WS_CLIPCHILDREN
560 // could be the culprit. But without it, you can get a lot of flicker.
563 if ((style
& wxCAPTION
) == wxCAPTION
)
564 msflags
= WS_OVERLAPPED
;
568 if (style
& wxMINIMIZE_BOX
)
569 msflags
|= WS_MINIMIZEBOX
;
570 if (style
& wxMAXIMIZE_BOX
)
571 msflags
|= WS_MAXIMIZEBOX
;
572 if (style
& wxTHICK_FRAME
)
573 msflags
|= WS_THICKFRAME
;
574 if (style
& wxSYSTEM_MENU
)
575 msflags
|= WS_SYSMENU
;
576 if ((style
& wxMINIMIZE
) || (style
& wxICONIZE
))
577 msflags
|= WS_MINIMIZE
;
578 if (style
& wxMAXIMIZE
)
579 msflags
|= WS_MAXIMIZE
;
580 if (style
& wxCAPTION
)
581 msflags
|= WS_CAPTION
;
582 if (style
& wxCLIP_CHILDREN
)
583 msflags
|= WS_CLIPCHILDREN
;
585 // Keep this in wxFrame because it saves recoding this function
588 if (style
& wxTINY_CAPTION_VERT
)
589 msflags
|= IBS_VERTCAPTION
;
590 if (style
& wxTINY_CAPTION_HORIZ
)
591 msflags
|= IBS_HORZCAPTION
;
593 if (style
& wxTINY_CAPTION_VERT
)
594 msflags
|= WS_CAPTION
;
595 if (style
& wxTINY_CAPTION_HORIZ
)
596 msflags
|= WS_CAPTION
;
598 if ((style
& wxTHICK_FRAME
) == 0)
599 msflags
|= WS_BORDER
;
601 WXDWORD extendedStyle
= MakeExtendedStyle(style
);
603 if (style
& wxSTAY_ON_TOP
)
604 extendedStyle
|= WS_EX_TOPMOST
;
607 wxWindow::MSWCreate(id
, parent
, wclass
, wx_win
, title
, x
, y
, width
, height
,
608 msflags
, NULL
, extendedStyle
);
609 // Seems to be necessary if we use WS_POPUP
610 // style instead of WS_OVERLAPPED
611 if (width
> -1 && height
> -1)
612 ::PostMessage((HWND
) GetHWND(), WM_SIZE
, SIZE_RESTORED
, MAKELPARAM(width
, height
));
615 bool wxFrame::MSWOnPaint(void)
618 wxDebugMsg("wxFrameWnd::OnPaint %d\n", handle
);
621 if (GetUpdateRect((HWND
) GetHWND(), &rect
, FALSE
))
627 the_icon
= (HICON
) m_icon
.GetHICON();
629 the_icon
= (HICON
) m_defaultIcon
;
632 // Hold a pointer to the dc so long as the OnPaint() message
633 // is being processed
634 HDC cdc
= BeginPaint((HWND
) GetHWND(), &ps
);
636 // Erase background before painting or we get white background
637 this->MSWDefWindowProc(WM_ICONERASEBKGND
,(WORD
)ps
.hdc
,0L);
642 GetClientRect((HWND
) GetHWND(), &rect
);
644 int icon_height
= 32;
645 int icon_x
= (int)((rect
.right
- icon_width
)/2);
646 int icon_y
= (int)((rect
.bottom
- icon_height
)/2);
647 DrawIcon(cdc
, icon_x
, icon_y
, the_icon
);
650 EndPaint((HWND
) GetHWND(), &ps
);
654 wxPaintEvent
event(m_windowId
);
655 event
.m_eventObject
= this;
656 if (!GetEventHandler()->ProcessEvent(event
))
664 WXHICON
wxFrame::MSWOnQueryDragIcon(void)
666 if (m_icon
.Ok() && (m_icon
.GetHICON() != 0))
667 return m_icon
.GetHICON();
669 return m_defaultIcon
;
672 void wxFrame::MSWOnSize(int x
, int y
, WXUINT id
)
675 wxDebugMsg("wxFrameWnd::OnSize %d\n", m_hWnd
);
690 // forward WM_SIZE to status bar control
691 #if USE_NATIVE_STATUSBAR
692 if (m_frameStatusBar
&& m_frameStatusBar
->IsKindOf(CLASSINFO(wxStatusBar95
)))
694 wxSizeEvent
event(wxSize(x
, y
), m_frameStatusBar
->GetId());
695 event
.SetEventObject( m_frameStatusBar
);
697 ((wxStatusBar95
*)m_frameStatusBar
)->OnSize(event
);
704 wxSizeEvent
event(wxSize(x
, y
), m_windowId
);
705 event
.SetEventObject( this );
706 if (!GetEventHandler()->ProcessEvent(event
))
711 bool wxFrame::MSWOnClose(void)
714 wxDebugMsg("wxFrameWnd::OnClose %d\n", handle
);
719 bool wxFrame::MSWOnCommand(WXWORD id
, WXWORD cmd
, WXHWND control
)
722 wxDebugMsg("wxFrameWnd::OnCommand %d\n", handle
);
724 if (cmd
== 0 || cmd
== 1 ) // Can be either a menu command or an accelerator.
726 // In case it's e.g. a toolbar.
727 wxWindow
*win
= wxFindWinFromHandle(control
);
729 return win
->MSWCommand(cmd
, id
);
731 if (GetMenuBar() && GetMenuBar()->FindItemForId(id
))
743 void wxFrame::MSWOnMenuHighlight(WXWORD nItem
, WXWORD nFlags
, WXHMENU hSysMenu
)
745 if (nFlags
== 0xFFFF && hSysMenu
== 0)
747 wxMenuEvent
event(wxEVT_MENU_HIGHLIGHT
, -1);
748 event
.SetEventObject( this );
749 GetEventHandler()->ProcessEvent(event
);
751 else if (nFlags
!= MF_SEPARATOR
)
753 wxMenuEvent
event(wxEVT_MENU_HIGHLIGHT
, nItem
);
754 event
.SetEventObject( this );
755 GetEventHandler()->ProcessEvent(event
);
759 bool wxFrame::MSWProcessMessage(WXMSG
* pMsg
)
761 if (m_acceleratorTable
!= 0 &&
762 ::TranslateAccelerator((HWND
) GetHWND(), (HACCEL
) m_acceleratorTable
, (MSG
*)pMsg
))
768 // Default resizing behaviour - if only ONE subwindow,
769 // resize to client rectangle size
770 void wxFrame::OnSize(wxSizeEvent
& event
)
772 // if we're using constraints - do use them
774 if ( GetAutoLayout() ) {
780 // do we have _exactly_ one child?
781 wxWindow
*child
= NULL
;
782 for ( wxNode
*node
= GetChildren()->First(); node
; node
= node
->Next() )
784 wxWindow
*win
= (wxWindow
*)node
->Data();
785 if ( !win
->IsKindOf(CLASSINFO(wxFrame
)) &&
786 !win
->IsKindOf(CLASSINFO(wxDialog
)) &&
787 (win
!= GetStatusBar()) &&
788 (win
!= GetToolBar()) )
791 return; // it's our second subwindow - nothing to do
797 // we have exactly one child - set it's size to fill the whole frame
798 int clientW
, clientH
;
799 GetClientSize(&clientW
, &clientH
);
804 child
->SetSize(x
, y
, clientW
, clientH
);
808 // Default activation behaviour - set the focus for the first child
810 void wxFrame::OnActivate(wxActivateEvent
& event
)
812 for(wxNode
*node
= GetChildren()->First(); node
; node
= node
->Next())
814 // Find a child that's a subwindow, but not a dialog box.
815 wxWindow
*child
= (wxWindow
*)node
->Data();
816 if (!child
->IsKindOf(CLASSINFO(wxFrame
)) &&
817 !child
->IsKindOf(CLASSINFO(wxDialog
)))
820 wxDebugMsg("wxFrame::OnActivate: about to set the child's focus.\n");
828 // The default implementation for the close window event - calls
829 // OnClose for backward compatibility.
831 void wxFrame::OnCloseWindow(wxCloseEvent
& event
)
834 if ( GetEventHandler()->OnClose() || event
.GetForce())
840 bool wxFrame::OnClose(void)
845 // Destroy the window (delayed, if a managed window)
846 bool wxFrame::Destroy(void)
848 if (!wxPendingDelete
.Member(this))
849 wxPendingDelete
.Append(this);
853 // Default menu selection behaviour - display a help string
854 void wxFrame::OnMenuHighlight(wxMenuEvent
& event
)
858 if (event
.GetMenuId() == -1)
862 wxMenuBar
*menuBar
= GetMenuBar();
865 wxString
helpString(menuBar
->GetHelpString(event
.GetMenuId()));
866 if (helpString
!= "")
867 SetStatusText(helpString
);
873 wxMenuBar
*wxFrame::GetMenuBar(void) const
875 return m_frameMenuBar
;
878 void wxFrame::Centre(int direction
)
880 int display_width
, display_height
, width
, height
, x
, y
;
881 wxDisplaySize(&display_width
, &display_height
);
883 GetSize(&width
, &height
);
886 if (direction
& wxHORIZONTAL
)
887 x
= (int)((display_width
- width
)/2);
888 if (direction
& wxVERTICAL
)
889 y
= (int)((display_height
- height
)/2);
891 SetSize(x
, y
, width
, height
);
894 // Call this to simulate a menu command
895 void wxFrame::Command(int id
)
900 void wxFrame::ProcessCommand(int id
)
902 wxCommandEvent
commandEvent(wxEVENT_TYPE_MENU_COMMAND
, id
);
903 commandEvent
.SetInt( id
);
904 commandEvent
.SetEventObject( this );
906 wxMenuBar
*bar
= GetMenuBar() ;
910 wxMenuItem
*item
= bar
->FindItemForId(id
) ;
911 if (item
&& item
->IsCheckable())
913 bar
->Check(id
,!bar
->Checked(id
)) ;
915 GetEventHandler()->ProcessEvent(commandEvent
);
918 // Checks if there is a toolbar, and returns the first free client position
919 wxPoint
wxFrame::GetClientAreaOrigin() const
925 GetToolBar()->GetSize(& w
, & h
);
927 if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL
)
939 wxToolBar
* wxFrame::CreateToolBar(long style
, wxWindowID id
, const wxString
& name
)
941 wxCHECK_MSG( m_frameToolBar
== NULL
, FALSE
,
942 "recreating toolbar in wxFrame" );
944 wxToolBar
* toolBar
= OnCreateToolBar(style
, id
, name
);
957 wxToolBar
* wxFrame::OnCreateToolBar(long style
, wxWindowID id
, const wxString
& name
)
959 return new wxToolBar(this, id
, wxDefaultPosition
, wxDefaultSize
, style
, name
);
962 void wxFrame::PositionToolBar(void)
967 ::GetClientRect((HWND
) GetHWND(), &rect
);
969 if ( GetStatusBar() )
971 int statusX
, statusY
;
972 GetStatusBar()->GetClientSize(&statusX
, &statusY
);
973 rect
.bottom
-= statusY
;
979 GetToolBar()->GetSize(& tw
, & th
);
981 if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL
)
983 // Use the 'real' MSW position
984 GetToolBar()->SetSize(0, 0, tw
, rect
.bottom
, wxSIZE_NO_ADJUSTMENTS
);
988 // Use the 'real' MSW position
989 GetToolBar()->SetSize(0, 0, rect
.right
, th
, wxSIZE_NO_ADJUSTMENTS
);