Cured problem introduced by LEAVE/ENTER OnIdle code; bugs in gauge sizing

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@135 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-06-22 22:43:48 +00:00
parent 565215b26a
commit 1c089c47f3
17 changed files with 125 additions and 170 deletions

View File

@@ -825,6 +825,7 @@ void wxApp::OnIdle(wxIdleEvent& event)
// Send OnIdle events to all windows // Send OnIdle events to all windows
bool needMore = SendIdleEvents(); bool needMore = SendIdleEvents();
// bool needMore = FALSE;
if (needMore) if (needMore)
event.RequestMore(TRUE); event.RequestMore(TRUE);

View File

@@ -24,6 +24,8 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
#if USE_OWNER_DRAWN
#include <windows.h> #include <windows.h>
#include "wx/ownerdrw.h" #include "wx/ownerdrw.h"
@@ -304,3 +306,6 @@ void wxCheckListBox::OnLeftClick(wxMouseEvent& event)
event.Skip(); event.Skip();
} }
} }
#endif

View File

@@ -132,47 +132,6 @@ void wxConvertDialogToPixels(wxWindow *control, int *x, int *y)
} }
*/ */
#if 0
// We can't rely on Windows giving us events corresponding to the wxWindows Z-ordering.
// E.g. we can't push a wxGroupBox to the back for editing purposes.
// Convert the item event to parent coordinates, then search for
// an item that could receive this event.
wxControl *wxFakeItemEvent(wxWindow *parent, wxControl *item, wxMouseEvent& event)
{
int x, y;
item->GetPosition(&x, &y);
event.m_x += x;
event.m_y += y;
wxNode *node = parent->GetChildren()->Last();
while (node)
{
wxControl *newItem = (wxControl *)node->Data();
if (newItem->IsSelected() && newItem->SelectionHandleHitTest(event.x, event.GetY()))
{
// This event belongs to the panel.
parent->GetEventHandler()->OldOnMouseEvent(event);
return NULL;
}
else if (newItem->HitTest(event.x, event.GetY()))
{
int x1, y1;
newItem->GetPosition(&x1, &y1);
event.x -= x1;
event.GetY() -= y1;
newItem->OldOnMouseEvent(event);
return newItem;
}
node = node->Previous();
}
// No takers, so do what we would have done anyway.
event.x -= x;
event.y -= y;
item->OldOnMouseEvent(event);
return item;
}
#endif
void wxControl::MSWOnMouseMove(const int x, const int y, const WXUINT flags) void wxControl::MSWOnMouseMove(const int x, const int y, const WXUINT flags)
{ {
/* /*

View File

@@ -111,7 +111,10 @@ wxPaintDC::wxPaintDC(wxWindow *the_canvas)
m_staticPaintHDC = m_hDC ; m_staticPaintHDC = m_hDC ;
} }
else else
{
wxDebugMsg("wxPaintDC: Using existing HDC\n");
m_hDC = m_staticPaintHDC ; m_hDC = m_staticPaintHDC ;
}
m_canvas = the_canvas; m_canvas = the_canvas;
RECT updateRect1 = g_paintStruct.rcPaint; RECT updateRect1 = g_paintStruct.rcPaint;
@@ -136,6 +139,13 @@ wxPaintDC::~wxPaintDC(void)
m_hDCCount --; m_hDCCount --;
m_hDC = 0; m_hDC = 0;
} }
else
wxDebugMsg("~wxPaintDC: Did not release HDC\n");
m_staticPaintHDC = 0 ; m_staticPaintHDC = 0 ;
} }
else
{
wxDebugMsg("~wxPaintDC: Did not release HDC\n");
}
} }

View File

@@ -41,6 +41,7 @@ wxMemoryDC::wxMemoryDC(void)
{ {
m_hDC = (WXHDC) ::CreateCompatibleDC(NULL); m_hDC = (WXHDC) ::CreateCompatibleDC(NULL);
m_ok = (m_hDC != 0); m_ok = (m_hDC != 0);
m_bOwnsDC = TRUE;
SetBrush(*wxWHITE_BRUSH); SetBrush(*wxWHITE_BRUSH);
SetPen(*wxBLACK_PEN); SetPen(*wxBLACK_PEN);

View File

@@ -552,13 +552,11 @@ void wxFrame::MSWCreate(const int id, wxWindow *parent, const char *wclass, wxWi
// If child windows aren't properly drawn initially, WS_CLIPCHILDREN // If child windows aren't properly drawn initially, WS_CLIPCHILDREN
// could be the culprit. But without it, you can get a lot of flicker. // could be the culprit. But without it, you can get a lot of flicker.
// DWORD msflags = WS_POPUP | WS_CLIPCHILDREN ;
DWORD msflags = 0; DWORD msflags = 0;
if ((style & wxCAPTION) == wxCAPTION) if ((style & wxCAPTION) == wxCAPTION)
msflags = WS_OVERLAPPED | WS_CLIPCHILDREN ; // WS_POPUP | WS_CLIPCHILDREN ; msflags = WS_OVERLAPPED;
else else
msflags = WS_POPUP | WS_CLIPCHILDREN ; msflags = WS_POPUP;
if (style & wxMINIMIZE_BOX) if (style & wxMINIMIZE_BOX)
msflags |= WS_MINIMIZEBOX; msflags |= WS_MINIMIZEBOX;
@@ -574,6 +572,8 @@ void wxFrame::MSWCreate(const int id, wxWindow *parent, const char *wclass, wxWi
msflags |= WS_MAXIMIZE; msflags |= WS_MAXIMIZE;
if (style & wxCAPTION) if (style & wxCAPTION)
msflags |= WS_CAPTION; msflags |= WS_CAPTION;
if (style & wxCLIP_CHILDREN)
msflags |= WS_CLIPCHILDREN;
// Keep this in wxFrame because it saves recoding this function // Keep this in wxFrame because it saves recoding this function
// in wxTinyFrame // in wxTinyFrame
@@ -642,12 +642,9 @@ bool wxFrame::MSWOnPaint(void)
EndPaint((HWND) GetHWND(), &ps); EndPaint((HWND) GetHWND(), &ps);
} }
else
if (!m_iconized)
{ {
// m_paintHDC = (WXHDC) cdc;
GetEventHandler()->OldOnPaint(); GetEventHandler()->OldOnPaint();
// m_paintHDC = NULL;
} }
return 0; return 0;
} }

View File

@@ -191,27 +191,20 @@ void wxGauge::SetSize(const int x, const int y, const int width, const int heigh
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
y1 = currentY; y1 = currentY;
float control_width, control_height, control_x, control_y;
// If we're prepared to use the existing size, then... // If we're prepared to use the existing size, then...
if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO)) if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
{ {
GetSize(&x1, &y1); GetSize(&w1, &h1);
} }
// Deal with default size (using -1 values) // Deal with default size (using -1 values)
if (width<=0) if (w1<=0)
w1 = DEFAULT_ITEM_WIDTH; w1 = DEFAULT_ITEM_WIDTH;
if (height<=0) if (h1<=0)
h1 = DEFAULT_ITEM_HEIGHT; h1 = DEFAULT_ITEM_HEIGHT;
control_x = (float)x1; MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
control_y = (float)y1;
control_width = (float)w1;
control_height = (float)h1;
MoveWindow((HWND) GetHWND(), (int)control_x, (int)control_y, (int)control_width, (int)control_height, TRUE);
#if WXWIN_COMPATIBILITY #if WXWIN_COMPATIBILITY
GetEventHandler()->OldOnSize(width, height); GetEventHandler()->OldOnSize(width, height);

View File

@@ -207,6 +207,9 @@ bool wxListBox::Create(wxWindow *parent, const wxWindowID id,
0, 0, 0, 0, 0, 0, 0, 0,
(HWND)parent->GetHWND(), (HMENU)m_windowId, (HWND)parent->GetHWND(), (HMENU)m_windowId,
wxGetInstance(), NULL); wxGetInstance(), NULL);
m_hWnd = (WXHWND)wx_list;
#if CTL3D #if CTL3D
if (want3D) if (want3D)
{ {
@@ -215,12 +218,15 @@ bool wxListBox::Create(wxWindow *parent, const wxWindowID id,
} }
#endif #endif
// Subclass again to catch messages
SubclassWin((WXHWND)wx_list);
uint ui; uint ui;
for (ui = 0; ui < (uint)n; ui++) { for (ui = 0; ui < (uint)n; ui++) {
SendMessage(wx_list, LB_ADDSTRING, 0, (LPARAM)(const char *)choices[ui]); SendMessage(wx_list, LB_ADDSTRING, 0, (LPARAM)(const char *)choices[ui]);
} }
#if USE_OWNER_DRAWN #if USE_OWNER_DRAWN
if ( m_windowStyle & wxLB_OWNERDRAW ) { if ( m_windowStyle & wxLB_OWNERDRAW ) {
for (ui = 0; ui < (uint)n; ui++) { for (ui = 0; ui < (uint)n; ui++) {
// create new item which will process WM_{DRAW|MEASURE}ITEM messages // create new item which will process WM_{DRAW|MEASURE}ITEM messages
@@ -230,33 +236,30 @@ bool wxListBox::Create(wxWindow *parent, const wxWindowID id,
ListBox_SetItemData(wx_list, ui, pNewItem); ListBox_SetItemData(wx_list, ui, pNewItem);
} }
} }
#endif #endif
if ((m_windowStyle & wxLB_MULTIPLE) == 0) if ((m_windowStyle & wxLB_MULTIPLE) == 0)
SendMessage(wx_list, LB_SETCURSEL, 0, 0); SendMessage(wx_list, LB_SETCURSEL, 0, 0);
ShowWindow(wx_list, SW_SHOW);
m_hWnd = (WXHWND)wx_list;
// Subclass again for purposes of dialog editing mode
SubclassWin((WXHWND)wx_list);
SetFont(* parent->GetFont()); SetFont(* parent->GetFont());
SetSize(x, y, width, height); SetSize(x, y, width, height);
ShowWindow(wx_list, SW_SHOW);
return TRUE; return TRUE;
} }
wxListBox::~wxListBox(void) wxListBox::~wxListBox(void)
{ {
#if USE_OWNER_DRAWN #if USE_OWNER_DRAWN
uint uiCount = m_aItems.Count(); uint uiCount = m_aItems.Count();
while ( uiCount-- != 0 ) { while ( uiCount-- != 0 ) {
delete m_aItems[uiCount]; delete m_aItems[uiCount];
} }
#endif #endif
DELETEA(m_selections);
} }
void wxListBox::SetupColours(void) void wxListBox::SetupColours(void)
@@ -290,14 +293,14 @@ void wxListBox::Append(const wxString& item)
int index = ListBox_AddString(hwnd, item); int index = ListBox_AddString(hwnd, item);
m_noItems ++; m_noItems ++;
#if USE_OWNER_DRAWN #if USE_OWNER_DRAWN
if ( m_windowStyle & wxLB_OWNERDRAW ) { if ( m_windowStyle & wxLB_OWNERDRAW ) {
wxOwnerDrawn *pNewItem = CreateItem(-1); // dummy argument wxOwnerDrawn *pNewItem = CreateItem(-1); // dummy argument
pNewItem->SetName(item); pNewItem->SetName(item);
m_aItems.Add(pNewItem); m_aItems.Add(pNewItem);
ListBox_SetItemData(hwnd, index, pNewItem); ListBox_SetItemData(hwnd, index, pNewItem);
} }
#endif #endif
SetHorizontalExtent(item); SetHorizontalExtent(item);
} }
@@ -307,14 +310,14 @@ void wxListBox::Append(const wxString& item, char *Client_data)
int index = ListBox_AddString(hwnd, item); int index = ListBox_AddString(hwnd, item);
m_noItems ++; m_noItems ++;
#if USE_OWNER_DRAWN #if USE_OWNER_DRAWN
if ( m_windowStyle & wxLB_OWNERDRAW ) { if ( m_windowStyle & wxLB_OWNERDRAW ) {
// client data must be pointer to wxOwnerDrawn, otherwise we would crash // client data must be pointer to wxOwnerDrawn, otherwise we would crash
// in OnMeasure/OnDraw. // in OnMeasure/OnDraw.
wxFAIL_MSG("Can't use client data with owner-drawn listboxes"); wxFAIL_MSG("Can't use client data with owner-drawn listboxes");
} }
else else
#endif #endif
ListBox_SetItemData(hwnd, index, Client_data); ListBox_SetItemData(hwnd, index, Client_data);
SetHorizontalExtent(item); SetHorizontalExtent(item);
@@ -333,7 +336,7 @@ void wxListBox::Set(const int n, const wxString *choices, char** clientData)
} }
m_noItems = n; m_noItems = n;
#if USE_OWNER_DRAWN #if USE_OWNER_DRAWN
if ( m_windowStyle & wxLB_OWNERDRAW ) { if ( m_windowStyle & wxLB_OWNERDRAW ) {
// first delete old items // first delete old items
uint ui = m_aItems.Count(); uint ui = m_aItems.Count();
@@ -353,7 +356,7 @@ void wxListBox::Set(const int n, const wxString *choices, char** clientData)
"Can't use client data with owner-drawn listboxes"); "Can't use client data with owner-drawn listboxes");
} }
} }
#endif #endif
SetHorizontalExtent(""); SetHorizontalExtent("");
ShowWindow(hwnd, SW_SHOW); ShowWindow(hwnd, SW_SHOW);
@@ -711,7 +714,6 @@ WXHBRUSH wxListBox::OnCtlColor(const WXHDC pDC, const WXHWND pWnd, const WXUINT
long wxListBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) long wxListBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{ {
/*
switch (nMsg) switch (nMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
@@ -730,7 +732,7 @@ long wxListBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
case WM_MBUTTONDBLCLK: case WM_MBUTTONDBLCLK:
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
case WM_LBUTTONUP: case WM_LBUTTONUP:
// case WM_LBUTTONDBLCLK: case WM_LBUTTONDBLCLK:
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
case WM_DESTROY: case WM_DESTROY:
case WM_COMMAND: case WM_COMMAND:
@@ -761,7 +763,6 @@ long wxListBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
case WM_NCHITTEST: case WM_NCHITTEST:
return MSWDefWindowProc(nMsg, wParam, lParam ); return MSWDefWindowProc(nMsg, wParam, lParam );
} }
*/
return wxControl::MSWWindowProc(nMsg, wParam, lParam); return wxControl::MSWWindowProc(nMsg, wParam, lParam);
} }

View File

@@ -489,6 +489,11 @@ $(MSWDIR)/nativdlg.obj: $*.$(SRCSUFF)
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@ $(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
<< <<
$(MSWDIR)/notebook.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
<<
$(MSWDIR)/ownerdrw.obj: $*.$(SRCSUFF) $(MSWDIR)/ownerdrw.obj: $*.$(SRCSUFF)
cl @<< cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@ $(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@

View File

@@ -142,6 +142,8 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
msflags |= WS_MAXIMIZE; msflags |= WS_MAXIMIZE;
if (style & wxCAPTION) if (style & wxCAPTION)
msflags |= WS_CAPTION; msflags |= WS_CAPTION;
if (style & wxCLIP_CHILDREN)
msflags |= WS_CLIPCHILDREN;
wxWindow::MSWCreate(m_windowId, parent, wxMDIFrameClassName, this, title, x, y, width, height, wxWindow::MSWCreate(m_windowId, parent, wxMDIFrameClassName, this, title, x, y, width, height,
msflags); msflags);

View File

@@ -67,7 +67,7 @@ wxMenuItem::wxMenuItem(wxMenu *pParentMenu, int id,
{ {
wxASSERT( pParentMenu != NULL ); wxASSERT( pParentMenu != NULL );
#ifdef USE_OWNER_DRAWN #if USE_OWNER_DRAWN
// set default menu colors // set default menu colors
#define SYS_COLOR(c) (wxSystemSettings::GetSystemColour(wxSYS_COLOUR_##c)) #define SYS_COLOR(c) (wxSystemSettings::GetSystemColour(wxSYS_COLOUR_##c))

View File

@@ -100,6 +100,8 @@ bool wxScrollBar::Create(wxWindow *parent, const wxWindowID id,
::SetScrollPos(scroll_bar, SB_CTL, 0, FALSE); ::SetScrollPos(scroll_bar, SB_CTL, 0, FALSE);
ShowWindow(scroll_bar, SW_SHOW); ShowWindow(scroll_bar, SW_SHOW);
SetFont(parent->GetFont());
m_hWnd = (WXHWND)scroll_bar; m_hWnd = (WXHWND)scroll_bar;
// Subclass again for purposes of dialog editing mode // Subclass again for purposes of dialog editing mode

View File

@@ -156,6 +156,8 @@ bool wxSlider::Create(wxWindow *parent, const wxWindowID id,
SubclassWin(GetHWND()); SubclassWin(GetHWND());
SetFont(parent->GetFont());
if ( m_windowStyle & wxSL_LABELS ) if ( m_windowStyle & wxSL_LABELS )
{ {
// Finally, create max value static item // Finally, create max value static item
@@ -165,8 +167,6 @@ bool wxSlider::Create(wxWindow *parent, const wxWindowID id,
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(), 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
wxGetInstance(), NULL); wxGetInstance(), NULL);
SetFont(parent->GetFont());
if (GetFont()) if (GetFont())
{ {
// GetFont()->RealizeResource(); // GetFont()->RealizeResource();

View File

@@ -182,6 +182,21 @@ WXHBRUSH wxStaticBox::OnCtlColor(const WXHDC pDC, const WXHWND pWnd, const WXUIN
// outline. // outline.
void wxStaticBox::OnEraseBackground(wxEraseEvent& event) void wxStaticBox::OnEraseBackground(wxEraseEvent& event)
{ {
// If we don't have this (call Default()), we don't paint the background properly.
// If we do have this, we seem to overwrite enclosed controls.
// Is it the WS_CLIPCHILDREN style that's causing the problems?
// Probably - without this style, the background of the window will show through,
// so the control doesn't have to paint it. The window background will always be
// painted before all other controls, therefore there are no problems with
// controls being hidden by the static box.
// So, if we could specify wxCLIP_CHILDREN in window, or not, we could optimise painting better.
// We would assume wxCLIP_CHILDREN in a frame and a scrolled window, but not in a panel.
// Is this too platform-specific?? What else can we do? Not a lot, since we have to pass
// this information from arbitrary wxWindow derivatives, and it depends on what you wish to
// do with the windows.
// Alternatively, just make sure that wxStaticBox is always at the back! There are probably
// few other circumstances where it matters about child clipping. But what about painting onto
// to panel, inside a groupbox? Doesn't appear, because the box wipes it out.
wxWindow *parent = GetParent(); wxWindow *parent = GetParent();
if ( parent && parent->GetHWND() && (::GetWindowLong((HWND) parent->GetHWND(), GWL_STYLE) & WS_CLIPCHILDREN) ) if ( parent && parent->GetHWND() && (::GetWindowLong((HWND) parent->GetHWND(), GWL_STYLE) & WS_CLIPCHILDREN) )
{ {
@@ -204,7 +219,7 @@ void wxStaticBox::OnEraseBackground(wxEraseEvent& event)
long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{ {
// TODO: somehow, this has to accept mouse clicks in user interface edit mode, // TODO: somehow, this has to accept mouse clicks in user interface edit mode,
// but not otherwise. Only there is no longer a UI edit mode... // but not otherwise. Only there is no longer a UI edit mode...
// It worked before because the message could be processed if not in UI // It worked before because the message could be processed if not in UI
@@ -215,8 +230,21 @@ long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
// skip the code below. Too time consuming though. // skip the code below. Too time consuming though.
// Perhaps it's ok to do the default thing *anyway* because the title or edge // Perhaps it's ok to do the default thing *anyway* because the title or edge
// of the window may still be active! // of the window may still be active!
// if (nMsg == WM_NCHITTEST)
// return Default();
if (nMsg == WM_NCHITTEST) if (nMsg == WM_NCHITTEST)
return Default(); {
int xPos = LOWORD(lParam); // horizontal position of cursor
int yPos = HIWORD(lParam); // vertical position of cursor
ScreenToClient(&xPos, &yPos);
// Make sure you can drag by the top of the groupbox, but let
// other (enclosed) controls get mouse events also
if (yPos < 10)
return (long)HTCLIENT;
}
return wxControl::MSWWindowProc(nMsg, wParam, lParam); return wxControl::MSWWindowProc(nMsg, wParam, lParam);
} }

View File

@@ -94,7 +94,7 @@ bool wxStatusBar95::Create(wxWindow *parent, wxWindowID id, long style)
m_windowId = id == -1 ? NewControlId() : id; m_windowId = id == -1 ? NewControlId() : id;
DWORD wstyle = WS_CHILD | WS_VISIBLE; DWORD wstyle = WS_CHILD | WS_VISIBLE;
if ( style & wxSB_SIZEGRIP ) if ( style & wxST_SIZEGRIP )
wstyle |= SBARS_SIZEGRIP; wstyle |= SBARS_SIZEGRIP;
m_hWnd = (WXHWND)CreateStatusWindow(wstyle, m_hWnd = (WXHWND)CreateStatusWindow(wstyle,

View File

@@ -104,7 +104,7 @@ bool wxToolBar95::Create(wxWindow *parent, const wxWindowID id, const wxPoint& p
m_windowStyle = style; m_windowStyle = style;
SetFont(wxTheFontList->FindOrCreateFont(11, wxSWISS, wxNORMAL, wxNORMAL)); SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
SetParent(parent); SetParent(parent);

View File

@@ -472,11 +472,10 @@ bool wxWindow::Create(wxWindow *parent, const wxWindowID id,
msflags |= WS_BORDER; msflags |= WS_BORDER;
if (style & wxTHICK_FRAME) if (style & wxTHICK_FRAME)
msflags |= WS_THICKFRAME; msflags |= WS_THICKFRAME;
// TODO: probably make WS_CLIPCHILDREN this a setting in wx/setup.h,
// to reduce flicker with the trade-off that groupboxes must paint in a solid msflags |= WS_CHILD | WS_VISIBLE;
// colour (so your control order must be correct, and you can't easily draw a if (style & wxCLIP_CHILDREN)
// transparent group). msflags |= WS_CLIPCHILDREN;
msflags |= WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN;
bool want3D; bool want3D;
WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ; WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
@@ -819,9 +818,6 @@ void wxWindow::GetTextExtent(const wxString& string, int *x, int *y,
HFONT was = 0; HFONT was = 0;
if (fontToUse && fontToUse->Ok()) if (fontToUse && fontToUse->Ok())
{ {
// fontToUse->UseResource();
// fontToUse->RealizeResource();
if ((fnt=(HFONT) fontToUse->GetResourceHandle())) if ((fnt=(HFONT) fontToUse->GetResourceHandle()))
was = SelectObject(dc,fnt) ; was = SelectObject(dc,fnt) ;
} }
@@ -881,42 +877,11 @@ void wxWindow::Refresh(const bool eraseBack, const wxRectangle *rect)
} }
} }
// TODO: Are these really necessary now?
/*
WXHDC wxWindow::GetHDC(void) const
{
wxWindow *nonConst = (wxWindow *)this;
if (m_paintHDC)
return(m_paintHDC) ;
nonConst->m_tempHDC = (WXHDC) ::GetDC((HWND) GetHWND()) ;
return(m_tempHDC) ;
}
void wxWindow::ReleaseHDC(void)
{
// We're within an OnPaint: it'll be released.
if (m_paintHDC)
return ;
::ReleaseDC((HWND) GetHWND(),(HDC) m_tempHDC) ;
}
*/
// Hook for new window just as it's being created, // Hook for new window just as it's being created,
// when the window isn't yet associated with the handle // when the window isn't yet associated with the handle
wxWindow *wxWndHook = NULL; wxWindow *wxWndHook = NULL;
/* // Main window proc
#if HAVE_SOCKET
// DDE Interface Handler
extern "C" {
long ddeWindowProc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam);
void __ddeUnblock(HWND hWnd, WPARAM wParam);
};
#endif
*/
// Main Windows 3 window proc
LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
wxWindow *wnd = wxFindWinFromHandle((WXHWND) hWnd); wxWindow *wnd = wxFindWinFromHandle((WXHWND) hWnd);
@@ -945,12 +910,6 @@ LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
wnd->m_lastMsg = message; wnd->m_lastMsg = message;
wnd->m_lastWParam = wParam; wnd->m_lastWParam = wParam;
wnd->m_lastLParam = lParam; wnd->m_lastLParam = lParam;
/* Don't know why this was here
if (message == WM_SETFONT)
return 0;
else if (message == WM_INITDIALOG)
return TRUE;
*/
} }
if (wnd) if (wnd)
return wnd->MSWWindowProc(message, wParam, lParam); return wnd->MSWWindowProc(message, wParam, lParam);
@@ -1024,12 +983,6 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
switch (message) switch (message)
{ {
/*
case WM_SETFONT:
{
return 0;
}
*/
case WM_ACTIVATE: case WM_ACTIVATE:
{ {
#ifdef __WIN32__ #ifdef __WIN32__
@@ -1296,25 +1249,27 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
case WM_KEYDOWN: case WM_KEYDOWN:
{ {
// these keys are not interesting to the application (@@ or are they?) if (wParam == VK_SHIFT)
if ( wParam == VK_SHIFT || wParam == VK_CONTROL ) return Default();
return Default();
else if (wParam == VK_CONTROL)
return Default();
// Avoid duplicate messages to OnChar // Avoid duplicate messages to OnChar
if ((wParam == VK_ESCAPE) || (wParam == VK_SPACE) || else if ((wParam != VK_ESCAPE) && (wParam != VK_SPACE) && (wParam != VK_RETURN) && (wParam != VK_BACK) && (wParam != VK_TAB))
(wParam == VK_RETURN) || (wParam == VK_BACK) || {
(wParam == VK_TAB)) MSWOnChar((WORD)wParam, lParam);
return Default(); if (::GetKeyState(VK_CONTROL)&0x100?TRUE:FALSE)
return Default();
MSWOnChar((WORD)wParam, lParam); }
//VZ: commented - what is it for? else
//if (::GetKeyState(VK_CONTROL)&0x100?TRUE:FALSE) return Default();
// return Default(); }
case WM_KEYUP:
{
break; break;
} }
// VZ: WM_KEYUP not processed // VZ: WM_KEYUP not processed
case WM_CHAR: // Always an ASCII character case WM_CHAR: // Always an ASCII character
{ {
MSWOnChar((WORD)wParam, lParam, TRUE); MSWOnChar((WORD)wParam, lParam, TRUE);
@@ -1981,7 +1936,11 @@ long wxWindow::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
long wxWindow::Default() long wxWindow::Default()
{ {
return this->MSWDefWindowProc(m_lastMsg, m_lastWParam, m_lastLParam); // These are fake events, ignore them
if (m_lastEvent != wxEVT_ENTER_WINDOW && m_lastEvent != wxEVT_LEAVE_WINDOW)
return this->MSWDefWindowProc(m_lastMsg, m_lastWParam, m_lastLParam);
else
return 0;
} }
bool wxWindow::MSWProcessMessage(WXMSG* pMsg) bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
@@ -2262,9 +2221,7 @@ void wxWindow::MSWOnLButtonUp(const int x, const int y, const WXUINT flags)
void wxWindow::MSWOnLButtonDClick(const int x, const int y, const WXUINT flags) void wxWindow::MSWOnLButtonDClick(const int x, const int y, const WXUINT flags)
{ {
/* MATTHEW: If dclick not allowed, generate another single-click */ wxMouseEvent event(wxEVENT_TYPE_LEFT_DCLICK);
wxMouseEvent event(m_doubleClickAllowed ?
wxEVENT_TYPE_LEFT_DCLICK : wxEVENT_TYPE_LEFT_DOWN);
event.m_x = x; event.m_y = y; event.m_x = x; event.m_y = y;
event.m_shiftDown = ((flags & MK_SHIFT) != 0); event.m_shiftDown = ((flags & MK_SHIFT) != 0);
@@ -2315,7 +2272,7 @@ void wxWindow::MSWOnMButtonDown(const int x, const int y, const WXUINT flags)
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */ event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
event.m_eventObject = this; event.m_eventObject = this;
m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVENT_TYPE_LEFT_DOWN; m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVENT_TYPE_MIDDLE_DOWN;
GetEventHandler()->OldOnMouseEvent(event); GetEventHandler()->OldOnMouseEvent(event);
} }
@@ -2333,16 +2290,13 @@ void wxWindow::MSWOnMButtonUp(const int x, const int y, const WXUINT flags)
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */ event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
event.m_eventObject = this; event.m_eventObject = this;
m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVENT_TYPE_LEFT_UP; m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVENT_TYPE_MIDDLE_UP;
GetEventHandler()->OldOnMouseEvent(event); GetEventHandler()->OldOnMouseEvent(event);
} }
void wxWindow::MSWOnMButtonDClick(const int x, const int y, const WXUINT flags) void wxWindow::MSWOnMButtonDClick(const int x, const int y, const WXUINT flags)
{ {
//wxDebugMsg("MButtonDClick\n") ; wxMouseEvent event(wxEVENT_TYPE_MIDDLE_DCLICK);
/* MATTHEW: If dclick not allowed, generate another single-click */
wxMouseEvent event((m_doubleClickAllowed) ?
wxEVENT_TYPE_MIDDLE_DCLICK : wxEVENT_TYPE_MIDDLE_DOWN);
event.m_x = x; event.m_y = y; event.m_x = x; event.m_y = y;
event.m_shiftDown = ((flags & MK_SHIFT) != 0); event.m_shiftDown = ((flags & MK_SHIFT) != 0);
@@ -2353,7 +2307,7 @@ void wxWindow::MSWOnMButtonDClick(const int x, const int y, const WXUINT flags)
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */ event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
event.m_eventObject = this; event.m_eventObject = this;
m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVENT_TYPE_LEFT_DCLICK; m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVENT_TYPE_MIDDLE_DCLICK;
// if (m_doubleClickAllowed) // if (m_doubleClickAllowed)
GetEventHandler()->OldOnMouseEvent(event); GetEventHandler()->OldOnMouseEvent(event);
} }
@@ -2415,9 +2369,7 @@ void wxWindow::MSWOnRButtonUp(const int x, const int y, const WXUINT flags)
void wxWindow::MSWOnRButtonDClick(const int x, const int y, const WXUINT flags) void wxWindow::MSWOnRButtonDClick(const int x, const int y, const WXUINT flags)
{ {
/* MATTHEW: If dclick not allowed, generate another single-click */ wxMouseEvent event(wxEVENT_TYPE_RIGHT_DCLICK);
wxMouseEvent event((m_doubleClickAllowed) ?
wxEVENT_TYPE_RIGHT_DCLICK : wxEVENT_TYPE_RIGHT_DOWN);
event.m_x = x; event.m_y = y; event.m_x = x; event.m_y = y;
event.m_shiftDown = ((flags & MK_SHIFT) != 0); event.m_shiftDown = ((flags & MK_SHIFT) != 0);
@@ -2492,7 +2444,7 @@ void wxWindow::MSWOnMouseEnter(const int x, const int y, const WXUINT flags)
m_lastEvent = wxEVT_ENTER_WINDOW; m_lastEvent = wxEVT_ENTER_WINDOW;
m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastXPos = event.m_x; m_lastYPos = event.m_y;
GetEventHandler()->OldOnMouseEvent(event); GetEventHandler()->ProcessEvent(event);
} }
void wxWindow::MSWOnMouseLeave(const int x, const int y, const WXUINT flags) void wxWindow::MSWOnMouseLeave(const int x, const int y, const WXUINT flags)
@@ -2510,7 +2462,7 @@ void wxWindow::MSWOnMouseLeave(const int x, const int y, const WXUINT flags)
m_lastEvent = wxEVT_LEAVE_WINDOW; m_lastEvent = wxEVT_LEAVE_WINDOW;
m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastXPos = event.m_x; m_lastYPos = event.m_y;
GetEventHandler()->OldOnMouseEvent(event); GetEventHandler()->ProcessEvent(event);
} }
void wxWindow::MSWOnChar(const WXWORD wParam, const WXLPARAM lParam, const bool isASCII) void wxWindow::MSWOnChar(const WXWORD wParam, const WXLPARAM lParam, const bool isASCII)
@@ -4718,7 +4670,6 @@ void wxWindow::OnIdle(wxIdleEvent& event)
MSWOnMouseLeave(pt.x, pt.y, 0); MSWOnMouseLeave(pt.x, pt.y, 0);
} }
} }
UpdateWindowUI(); UpdateWindowUI();
} }