#ifndef __TWIN32__
#ifdef __GNUWIN32__
#ifndef wxUSE_NORLANDER_HEADERS
- #include <wx/msw/gnuwin32/extra.h>
+ #include "wx/msw/gnuwin32/extra.h"
#endif
#endif
#endif
// Find an item given the MS Windows id
wxWindow *wxWindow::FindItem(long id) const
{
+ wxControl *item = wxDynamicCast(this, wxControl);
+ if ( item )
+ {
+ // i it we or one of our "internal" children?
+ if ( item->GetId() == id ||
+ (item->GetSubcontrols().Index(id) != wxNOT_FOUND) )
+ {
+ return item;
+ }
+ }
+
wxWindowList::Node *current = GetChildren().GetFirst();
while (current)
{
if ( wnd )
return wnd;
- if ( childWin->IsKindOf(CLASSINFO(wxControl)) )
- {
- wxControl *item = (wxControl *)childWin;
- if ( item->GetId() == id )
- return item;
- else
- {
- // In case it's a 'virtual' control (e.g. radiobox)
- if ( item->GetSubcontrols().Member((wxObject *)id) )
- return item;
- }
- }
-
current = current->GetNext();
}
if ( hWnd )
::EnableWindow(hWnd, (BOOL)enable);
+ wxWindowList::Node *node = GetChildren().GetFirst();
+ while ( node )
+ {
+ wxWindow *child = node->GetData();
+ child->Enable(enable);
+
+ node = node->GetNext();
+ }
+
return TRUE;
}
DoMoveWindow(x, y, width, height);
}
-// for a generic window there is no natural best size - just use the current one
-wxSize wxWindow::DoGetBestSize()
-{
- return GetSize();
-}
-
void wxWindow::DoSetClientSize(int width, int height)
{
wxWindow *parent = GetParent();
break;
case WM_MOUSEMOVE:
+ {
+ short x = LOWORD(lParam);
+ short y = HIWORD(lParam);
+
+ processed = HandleMouseMove(x, y, wParam);
+ }
+ break;
+
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_LBUTTONDBLCLK:
return popupMenu->MSWCommand(cmd, id);
}
- wxWindow *win = FindItem(id);
+ // must cast to a signed type before comparing with other ids!
+ wxWindow *win = FindItem((signed short)id);
if ( !win )
{
win = wxFindWinFromHandle(control);
// global functions
// ===========================================================================
-void wxGetCharSize(WXHWND wnd, int *x, int *y,wxFont *the_font)
+void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont *the_font)
{
TEXTMETRIC tm;
HDC dc = ::GetDC((HWND) wnd);
{
// the_font->UseResource();
// the_font->RealizeResource();
- fnt = (HFONT)the_font->GetResourceHandle();
+ fnt = (HFONT)((wxFont *)the_font)->GetResourceHandle(); // const_cast
if ( fnt )
was = (HFONT) SelectObject(dc,fnt);
}