m_hwndToolTip = 0;
#endif
- if (!parent)
- wxTopLevelWindows.Append(this);
-
SetName(name);
m_windowStyle = style;
m_frameMenuBar = NULL;
if ((m_windowStyle & wxFRAME_FLOAT_ON_PARENT) == 0)
parent = NULL;
+ if (!parent)
+ wxTopLevelWindows.Append(this);
+
MSWCreate(m_windowId, parent, wxFrameClassName, this, title,
x, y, width, height, style);
void wxFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags)
{
- int currentX, currentY;
- int x1 = x;
- int y1 = y;
- int w1 = width;
- int h1 = height;
-
- GetPosition(¤tX, ¤tY);
- if (x == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
- x1 = currentX;
- if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
- y1 = currentY;
-
- int ww,hh ;
- GetSize(&ww,&hh) ;
- if (width == -1) w1 = ww ;
- if (height==-1) h1 = hh ;
+ wxWindow::DoSetSize(x, y, width, height, sizeFlags);
- MoveWindow(GetHwnd(), x1, y1, w1, h1, (BOOL)TRUE);
-
- wxSizeEvent event(wxSize(width, height), m_windowId);
- event.SetEventObject( this );
- GetEventHandler()->ProcessEvent(event);
+ wxSizeEvent event(wxSize(width, height), m_windowId);
+ event.SetEventObject( this );
+ GetEventHandler()->ProcessEvent(event);
}
bool wxFrame::Show(bool show)
// subwindow found.
void wxFrame::OnActivate(wxActivateEvent& event)
{
- for(wxNode *node = GetChildren().First(); node; node = node->Next())
- {
- // Find a child that's a subwindow, but not a dialog box.
- wxWindow *child = (wxWindow *)node->Data();
- if (!child->IsKindOf(CLASSINFO(wxFrame)) &&
- !child->IsKindOf(CLASSINFO(wxDialog)))
+ for ( wxWindowList::Node *node = GetChildren().GetFirst();
+ node;
+ node = node->GetNext() )
{
- child->SetFocus();
- return;
+ // FIXME all this is totally bogus - we need to do the same as wxPanel,
+ // but how to do it without duplicating the code?
+
+ // restore focus
+ wxWindow *child = node->GetData();
+
+ if ( !child->IsTopLevel()
+#if wxUSE_TOOLBAR
+ && !wxDynamicCast(child, wxToolBar)
+#endif // wxUSE_TOOLBAR
+#if wxUSE_STATUSBAR
+ && !wxDynamicCast(child, wxStatusBar)
+#endif // wxUSE_STATUSBAR
+ )
+ {
+ child->SetFocus();
+ return;
+ }
}
- }
}
// The default implementation for the close window event.
{
if (GetStatusBar())
{
+ wxString help;
int menuId = event.GetMenuId();
if ( menuId != -1 )
{
wxMenuBar *menuBar = GetMenuBar();
if (menuBar && menuBar->FindItem(menuId))
{
- // set status text even if the string is empty - this will at
- // least remove the string from the item which was previously
- // selected
- SetStatusText(menuBar->GetHelpString(menuId));
+ help = menuBar->GetHelpString(menuId);
}
}
+
+ // set status text even if the string is empty - this will at
+ // least remove the string from the item which was previously
+ // selected
+ SetStatusText(help);
}
}
return FALSE;
const wxAcceleratorTable& acceleratorTable = menuBar->GetAccelTable();
- return acceleratorTable.Ok() &&
- ::TranslateAccelerator(GetHwnd(),
- GetTableHaccel(acceleratorTable),
- (MSG *)pMsg);
+ return acceleratorTable.Translate(this, pMsg);
}
// ---------------------------------------------------------------------------
{
if ( m_iconized )
{
- HICON hIcon = m_icon.Ok() ? GetIconHicon(m_icon)
+ HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon)
: (HICON)m_defaultIcon;
// Hold a pointer to the dc so long as the OnPaint() message
return FALSE;
}
-bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu)
+bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu)
{
int item;
- if ( nFlags == 0xFFFF && hMenu == 0 )
+ if ( flags == 0xFFFF && hMenu == 0 )
{
- // FIXME: what does this do? does it ever happen?
+ // menu was removed from screen
item = -1;
}
- else if ((nFlags != MF_SEPARATOR) && (nItem != 0) && (nItem != 65535))
+ else if ( !(flags & MF_POPUP) && !(flags & MF_SEPARATOR) )
{
item = nItem;
}
else
{
+ // don't give hints for separators (doesn't make sense) nor for the
+ // items opening popup menus (they don't have them anyhow)
return FALSE;
}
case WM_QUERYDRAGICON:
{
- HICON hIcon = m_icon.Ok() ? GetIconHicon(m_icon)
+ HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon)
: (HICON)(m_defaultIcon);
rc = (long)hIcon;
processed = rc != 0;