#include "wx/ownerdrw.h"
#endif
-#if wxUSE_DRAG_AND_DROP
- #include "wx/dataobj.h"
- #include "wx/msw/ole/droptgt.h"
+#if wxUSE_DRAG_AND_DROP
+ #include "wx/dnd.h"
#endif
#include "wx/menuitem.h"
#ifndef __TWIN32__
#ifdef __GNUWIN32__
#ifndef wxUSE_NORLANDER_HEADERS
- #include <wx/msw/gnuwin32/extra.h>
+ #include "wx/msw/gnuwin32/extra.h"
#endif
#endif
#endif
// ---------------------------------------------------------------------------
// the window proc for all our windows
-LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message,
+LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam);
#ifdef __WXDEBUG__
// 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;
}
*y = rect.bottom;
}
+void wxWindow::DoMoveWindow(int x, int y, int width, int height)
+{
+ if ( !::MoveWindow(GetHwnd(), x, y, width, height, TRUE) )
+ {
+ wxLogLastError("MoveWindow");
+ }
+}
+
// set the size of the window: if the dimensions are positive, just use them,
// but if any of them is equal to -1, it means that we must find the value for
// it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in
wxSize size(-1, -1);
if ( width == -1 )
{
- if ( sizeFlags && wxSIZE_AUTO_WIDTH )
+ if ( sizeFlags & wxSIZE_AUTO_WIDTH )
{
size = DoGetBestSize();
width = size.x;
if ( height == -1 )
{
- if ( sizeFlags && wxSIZE_AUTO_HEIGHT )
+ if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
{
if ( size.x == -1 )
{
- size= DoGetBestSize();
+ size = DoGetBestSize();
}
//else: already called DoGetBestSize() above
}
}
- if ( !::MoveWindow(GetHwnd(), x, y, width, height, TRUE) )
- {
- wxLogLastError("MoveWindow");
- }
-}
-
-// for a generic window there is no natural best size - just use the current one
-wxSize wxWindow::DoGetBestSize()
-{
- return GetSize();
+ DoMoveWindow(x, y, width, height);
}
void wxWindow::DoSetClientSize(int width, int height)
::ScreenToClient(hParentWnd, &point);
}
- MoveWindow(hWnd, point.x, point.y, actual_width, actual_height, (BOOL)TRUE);
+ DoMoveWindow(point.x, point.y, actual_width, actual_height);
wxSizeEvent event(wxSize(width, height), m_windowId);
event.SetEventObject(this);
wxWindow *wxWndHook = NULL;
// Main window proc
-LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
// trace all messages - useful for the debugging
#ifdef __WXDEBUG__
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:
}
m_hWnd = (WXHWND)CreateWindowEx(extendedStyle,
- wclass,
+ className,
title ? title : wxT(""),
style,
x1, y1,
{
#if wxUSE_TOOLTIPS
NMHDR* hdr = (NMHDR *)lParam;
- if ( hdr->code == TTN_NEEDTEXT && m_tooltip )
+ if ( (int)hdr->code == TTN_NEEDTEXT && m_tooltip )
{
TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam;
ttt->lpszText = (wxChar *)m_tooltip->GetTip().c_str();
wxCloseEvent event(wxEVT_QUERY_END_SESSION, -1);
event.SetEventObject(wxTheApp);
event.SetCanVeto(TRUE);
- event.SetLoggingOff(logOff == ENDSESSION_LOGOFF);
+ event.SetLoggingOff(logOff == (long)ENDSESSION_LOGOFF);
bool rc = wxTheApp->ProcessEvent(event);
wxCloseEvent event(wxEVT_END_SESSION, -1);
event.SetEventObject(wxTheApp);
event.SetCanVeto(FALSE);
- event.SetLoggingOff( (logOff == ENDSESSION_LOGOFF) );
+ event.SetLoggingOff( (logOff == (long)ENDSESSION_LOGOFF) );
if ( (this == wxTheApp->GetTopWindow()) && // Only send once
wxTheApp->ProcessEvent(event))
{
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);
}
else
{
UnhookWindowsHookEx(wxTheKeyboardHook);
+ // avoids mingw warning about statement with no effect (FreeProcInstance
+ // doesn't do anything under Win32)
+#ifndef __GNUWIN32__
FreeProcInstance(wxTheKeyboardHookProc);
+#endif
}
}