Frame and Window coding

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6160 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster 2000-02-21 05:12:34 +00:00
parent f250631042
commit a885d89ae9
16 changed files with 656 additions and 424 deletions

View File

@ -61,7 +61,7 @@ public:
// OS2 only // OS2 only
virtual bool OS2Command(WXUINT param, WXWORD id); virtual bool OS2Command(WXUINT param, WXWORD id);
MRESULT OS2WindowProc(HWND hwnd, WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); MRESULT OS2WindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
protected: protected:
virtual void DoSetItemClientData( int n, void* clientData ); virtual void DoSetItemClientData( int n, void* clientData );

View File

@ -110,7 +110,7 @@ public:
// implementation // implementation
// -------------- // --------------
virtual MRESULT OS2WindowProc(HWND hwnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam); virtual MRESULT OS2WindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
WXUINT message, WXWPARAM wParam, WXLPARAM lParam); WXUINT message, WXWPARAM wParam, WXLPARAM lParam);

View File

@ -53,7 +53,7 @@ public:
virtual bool ShowFullScreen( bool bShow virtual bool ShowFullScreen( bool bShow
,long lStyle = wxFULLSCREEN_ALL ,long lStyle = wxFULLSCREEN_ALL
); );
virtual bool IsFullScreen(void) const { return m_bFfsIsShowing; }; virtual bool IsFullScreen(void) const { return m_bFsIsShowing; };
// implementation only from now on // implementation only from now on
@ -131,8 +131,8 @@ public:
// tooltip management // tooltip management
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
WXHWND GetToolTipCtrl(void) const { return m_hHwndToolTip; } WXHWND GetToolTipCtrl(void) const { return m_hWndToolTip; }
void SetToolTipCtrl(WXHWND hHwndTT) { m_hHwndToolTip = hHwndTT; } void SetToolTipCtrl(WXHWND hHwndTT) { m_hWndToolTip = hHwndTT; }
#endif // tooltips #endif // tooltips
protected: protected:

View File

@ -86,9 +86,9 @@ public:
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
// override window proc for MDI-specific message processing // override window proc for MDI-specific message processing
virtual MRESULT OS2WindowProc(HWND hwnd, WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); virtual MRESULT OS2WindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
virtual MRESULT OS2DefWindowProc(HWND hwnd, WXUINT, WXWPARAM, WXLPARAM); virtual MRESULT OS2DefWindowProc(WXUINT, WXWPARAM, WXLPARAM);
virtual bool OS2TranslateMessage(WXMSG* msg); virtual bool OS2TranslateMessage(WXMSG* msg);
protected: protected:
@ -144,8 +144,8 @@ public:
bool HandleWindowPosChanging(void *lpPos); bool HandleWindowPosChanging(void *lpPos);
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
virtual MRESULT OS2WindowProc(HWND hwnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam); virtual MRESULT OS2WindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
virtual MRESULT OS2DefWindowProc(HWND hwnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam); virtual MRESULT OS2DefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
virtual bool OS2TranslateMessage(WXMSG *msg); virtual bool OS2TranslateMessage(WXMSG *msg);
virtual void OS2DestroyWindow(); virtual void OS2DestroyWindow();

View File

@ -49,7 +49,7 @@ class WXDLLEXPORT wxStaticBox: public wxControl
void OnEraseBackground(wxEraseEvent& event); void OnEraseBackground(wxEraseEvent& event);
virtual MRESULT OS2WindowProc(HWND hwnd, WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); virtual MRESULT OS2WindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
WXUINT message, WXWPARAM wParam, WXLPARAM lParam); WXUINT message, WXWPARAM wParam, WXLPARAM lParam);

View File

@ -53,7 +53,7 @@ class WXDLLEXPORT wxStaticText: public wxControl
// callbacks // callbacks
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
WXUINT message, WXWPARAM wParam, WXLPARAM lParam); WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
virtual MRESULT OS2WindowProc(HWND hwnd, WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); virtual MRESULT OS2WindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
protected: protected:
virtual wxSize DoGetBestSize() const; virtual wxSize DoGetBestSize() const;

View File

@ -100,8 +100,7 @@ protected:
void UpdateSize(void); void UpdateSize(void);
// override WndProc to process WM_SIZE // override WndProc to process WM_SIZE
virtual MRESULT OS2WindowProc( HWND hWnd virtual MRESULT OS2WindowProc( WXUINT ulMsg
,WXUINT ulMsg
,WXWPARAM wParam ,WXWPARAM wParam
,WXLPARAM lParam ,WXLPARAM lParam
); );

View File

@ -46,8 +46,6 @@ enum
class WXDLLEXPORT wxWindow : public wxWindowBase class WXDLLEXPORT wxWindow : public wxWindowBase
{ {
DECLARE_DYNAMIC_CLASS(wxWindow);
public: public:
wxWindow() { Init(); } wxWindow() { Init(); }
@ -205,6 +203,7 @@ public:
// event handlers // event handlers
// -------------- // --------------
void OnSetFocus(wxFocusEvent& rEvent);
void OnEraseBackground(wxEraseEvent& rEvent); void OnEraseBackground(wxEraseEvent& rEvent);
void OnIdle(wxIdleEvent& rEvent); void OnIdle(wxIdleEvent& rEvent);
@ -424,15 +423,13 @@ public:
); );
// Window procedure // Window procedure
virtual MRESULT OS2WindowProc( HWND hwnd virtual MRESULT OS2WindowProc( WXUINT uMsg
,WXUINT uMsg
,WXWPARAM wParam ,WXWPARAM wParam
,WXLPARAM lParam ,WXLPARAM lParam
); );
// Calls an appropriate default window procedure // Calls an appropriate default window procedure
virtual MRESULT OS2DefWindowProc( HWND hwnd virtual MRESULT OS2DefWindowProc( WXUINT uMsg
,WXUINT uMsg
,WXWPARAM wParam ,WXWPARAM wParam
,WXLPARAM lParam ,WXLPARAM lParam
); );
@ -469,6 +466,17 @@ public:
); );
protected: protected:
// PM can't create some MSW styles natively but can perform these after
// creation by sending messages
typedef enum extra_flags { kFrameToolWindow = 0x0001
,kVertCaption = 0x0002
,kHorzCaption = 0x0004
} EExtraFlags;
// Some internal sizeing id's to make it easy for event handlers
typedef enum size_types { kSizeNormal
,kSizeMax
,kSizeMin
} ESizeTypes;
// the window handle // the window handle
WXHWND m_hWnd; WXHWND m_hWnd;
@ -557,13 +565,17 @@ private:
,WXLPARAM lParam ,WXLPARAM lParam
,WXLPARAM* pResult ,WXLPARAM* pResult
); );
// the helper functions used by HandleChar/KeyXXX methods
wxKeyEvent CreateKeyEvent(wxEventType evType, int id, WXLPARAM lp) const;
DECLARE_DYNAMIC_CLASS(wxWindow);
DECLARE_NO_COPY_CLASS(wxWindow); DECLARE_NO_COPY_CLASS(wxWindow);
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
private: private:
// Virtual function hiding supression // Virtual function hiding supression
inline virtual bool Reparent(wxWindowBase* pNewParent) inline virtual bool Reparent(wxWindowBase* pNewParent)
{ return(wxWindowBase::Reparent(pNewParent));}; { return(wxWindowBase::Reparent(pNewParent));};
}; }; // end of wxWindow
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// global functions // global functions

View File

@ -246,7 +246,7 @@ wxSize wxChoice::DoGetBestSize() const
return wxSize(wChoice, hChoice); return wxSize(wChoice, hChoice);
} }
MRESULT wxChoice::OS2WindowProc(HWND hwnd, WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) MRESULT wxChoice::OS2WindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{ {
// TODO: // TODO:
/* /*
@ -264,7 +264,7 @@ MRESULT wxChoice::OS2WindowProc(HWND hwnd, WXUINT nMsg, WXWPARAM wParam, WXLPARA
return 0; return 0;
} }
*/ */
return wxWindow::OS2WindowProc(hwnd, nMsg, wParam, lParam); return wxWindow::OS2WindowProc(nMsg, wParam, lParam);
} }
bool wxChoice::OS2Command(WXUINT param, WXWORD WXUNUSED(id)) bool wxChoice::OS2Command(WXUINT param, WXWORD WXUNUSED(id))

View File

@ -423,7 +423,7 @@ void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
Refresh(); Refresh();
} }
MRESULT wxDialog::OS2WindowProc(HWND hwnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam) MRESULT wxDialog::OS2WindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{ {
MRESULT rc = 0; MRESULT rc = 0;
bool processed = FALSE; bool processed = FALSE;
@ -438,7 +438,7 @@ MRESULT wxDialog::OS2WindowProc(HWND hwnd, WXUINT message, WXWPARAM wParam, WXLP
} }
if ( !processed ) if ( !processed )
rc = wxWindow::OS2WindowProc(hwnd, message, wParam, lParam); rc = wxWindow::OS2WindowProc(message, wParam, lParam);
return rc; return rc;
} }

File diff suppressed because it is too large Load Diff

View File

@ -288,8 +288,7 @@ void wxMDIParentFrame::ActivatePrevious()
// the MDI parent frame window proc // the MDI parent frame window proc
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
MRESULT wxMDIParentFrame::OS2WindowProc(HWND hwnd, MRESULT wxMDIParentFrame::OS2WindowProc(WXUINT message,
WXUINT message,
WXWPARAM wParam, WXWPARAM wParam,
WXLPARAM lParam) WXLPARAM lParam)
{ {
@ -504,8 +503,7 @@ bool wxMDIParentFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd)
return FALSE; return FALSE;
} }
MRESULT wxMDIParentFrame::OS2DefWindowProc(HWND hwnd, MRESULT wxMDIParentFrame::OS2DefWindowProc(WXUINT message,
WXUINT message,
WXWPARAM wParam, WXWPARAM wParam,
WXLPARAM lParam) WXLPARAM lParam)
{ {
@ -774,8 +772,7 @@ void wxMDIChildFrame::Activate()
// MDI window proc and message handlers // MDI window proc and message handlers
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
MRESULT wxMDIChildFrame::OS2WindowProc(HWND hwnd, MRESULT wxMDIChildFrame::OS2WindowProc(WXUINT message,
WXUINT message,
WXWPARAM wParam, WXWPARAM wParam,
WXLPARAM lParam) WXLPARAM lParam)
{ {
@ -987,7 +984,7 @@ bool wxMDIChildFrame::HandleWindowPosChanging(void *pos)
// MDI specific message translation/preprocessing // MDI specific message translation/preprocessing
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
MRESULT wxMDIChildFrame::OS2DefWindowProc(HWND hwnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam) MRESULT wxMDIChildFrame::OS2DefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{ {
// TODO // TODO
/* /*

View File

@ -174,7 +174,7 @@ void wxStaticBox::OnEraseBackground(wxEraseEvent& event)
*/ */
} }
MRESULT wxStaticBox::OS2WindowProc(HWND hwnd, WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) MRESULT wxStaticBox::OS2WindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{ {
// TODO: // TODO:
/* /*
@ -192,7 +192,7 @@ MRESULT wxStaticBox::OS2WindowProc(HWND hwnd, WXUINT nMsg, WXWPARAM wParam, WXLP
} }
*/ */
return wxControl::OS2WindowProc(hwnd, nMsg, wParam, lParam); return wxControl::OS2WindowProc(nMsg, wParam, lParam);
} }

View File

@ -138,7 +138,7 @@ WXHBRUSH wxStaticText::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
return (WXHBRUSH)0; return (WXHBRUSH)0;
} }
MRESULT wxStaticText::OS2WindowProc(HWND hwnd, WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) MRESULT wxStaticText::OS2WindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{ {
// Ensure that static items get messages. Some controls don't like this // Ensure that static items get messages. Some controls don't like this
// message to be intercepted (e.g. RichEdit), hence the tests. // message to be intercepted (e.g. RichEdit), hence the tests.
@ -147,6 +147,6 @@ MRESULT wxStaticText::OS2WindowProc(HWND hwnd, WXUINT nMsg, WXWPARAM wParam, WXL
if (nMsg == WM_NCHITTEST) if (nMsg == WM_NCHITTEST)
return (long)HTCLIENT; return (long)HTCLIENT;
*/ */
return wxWindow::OS2WindowProc(hwnd, nMsg, wParam, lParam); return wxWindow::OS2WindowProc(nMsg, wParam, lParam);
} }

View File

@ -919,8 +919,7 @@ void wxToolBar::OnMouseEvent(
} }
MRESULT wxToolBar::OS2WindowProc( MRESULT wxToolBar::OS2WindowProc(
HWND hWnd WXUINT ulMsg
, WXUINT ulMsg
, MPARAM wParam , MPARAM wParam
, MPARAM lParam , MPARAM lParam
) )

View File

@ -9,7 +9,9 @@
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
//
// For compilers that support precompilation, includes "wx.h". // For compilers that support precompilation, includes "wx.h".
//
#include "wx/wxprec.h" #include "wx/wxprec.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
@ -64,14 +66,21 @@
#include <string.h> #include <string.h>
// place compiler, OS specific includes here //
// Place compiler, OS specific includes here
//
//
// standard macros -- these are for OS/2 PM, but most GUI's have something similar // Standard macros -- these are for OS/2 PM, but most GUI's have something similar
//
#ifndef GET_X_LPARAM #ifndef GET_X_LPARAM
//
// SHORT1FROMMP -- LOWORD // SHORT1FROMMP -- LOWORD
//
#define GET_X_LPARAM(mp) ((unsigned short)(unsigned long)(mp)) #define GET_X_LPARAM(mp) ((unsigned short)(unsigned long)(mp))
//
// SHORT2FROMMP -- HIWORD // SHORT2FROMMP -- HIWORD
//
#define GET_Y_LPARAM(mp) ((unsigned short)(unsigned long)(mp >> 16)) #define GET_Y_LPARAM(mp) ((unsigned short)(unsigned long)(mp >> 16))
#endif // GET_X_LPARAM #endif // GET_X_LPARAM
@ -79,18 +88,23 @@
// global variables // global variables
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// the last Windows message we got (MT-UNSAFE) //
extern WXMSGID s_currentMsg; // The last Windows message we got (MT-UNSAFE)
extern wxList WXDLLEXPORT wxPendingDelete; //
extern wxChar wxCanvasClassName[]; extern WXMSGID s_currentMsg;
wxMenu *wxCurrentPopupMenu = NULL; wxMenu* wxCurrentPopupMenu = NULL;
wxList *wxWinHandleList = NULL; extern wxList WXDLLEXPORT wxPendingDelete;
extern wxChar* wxCanvasClassName;
wxList* wxWinHandleList = NULL;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// private functions // private functions
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
//
// the window proc for all our windows; most gui's have something similar // the window proc for all our windows; most gui's have something similar
//
MRESULT wxWndProc( HWND hWnd MRESULT wxWndProc( HWND hWnd
,ULONG message ,ULONG message
,MPARAM mp1 ,MPARAM mp1
@ -101,10 +115,27 @@ MRESULT wxWndProc( HWND hWnd
const char *wxGetMessageName(int message); const char *wxGetMessageName(int message);
#endif //__WXDEBUG__ #endif //__WXDEBUG__
void wxRemoveHandleAssociation(wxWindow *win); void wxRemoveHandleAssociation(wxWindow* pWin);
void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win); void wxAssociateWinWithHandle( HWND hWnd
wxWindow *wxFindWinFromHandle(WXHWND hWnd); ,wxWindow* pWin
);
wxWindow* wxFindWinFromHandle(WXHWND hWnd);
//
// This magical function is used to translate VK_APPS key presses to right
// mouse clicks
//
static void TranslateKbdEventToMouse( wxWindow* pWin
,int* pX
,int* pY
,MPARAM* pFlags
);
//
// get the current state of SHIFT/CTRL keys
//
static inline bool IsShiftDown() { return (::WinGetKeyState(HWND_DESKTOP, VK_SHIFT) & 0x8000) != 0; }
static inline bool IsCtrlDown() { return (::WinGetKeyState(HWND_DESKTOP, VK_CTRL) & 0x8000) != 0; }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// event tables // event tables
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -122,40 +153,47 @@ END_EVENT_TABLE()
// implementation // implementation
// =========================================================================== // ===========================================================================
//
// Find an item given the PM Window id // Find an item given the PM Window id
//
wxWindow* wxWindow::FindItem( wxWindow* wxWindow::FindItem(
long ulId long lId
) const ) const
{ {
wxControl* pItem = wxDynamicCast( this
,wxControl
);
if (pItem)
{
//
// I it we or one of our "internal" children?
//
if (pItem->GetId() == lId ||
(pItem->GetSubcontrols().Index(lId) != wxNOT_FOUND))
{
return pItem;
}
}
wxWindowList::Node* pCurrent = GetChildren().GetFirst(); wxWindowList::Node* pCurrent = GetChildren().GetFirst();
while (pCurrent) while (pCurrent)
{ {
wxWindow* pChildWin = pCurrent->GetData(); wxWindow* pChildWin = pCurrent->GetData();
wxWindow* pWnd = pChildWin->FindItem(ulId); wxWindow* pWnd = pChildWin->FindItem(lId);
if (pWnd) if (pWnd)
return pWnd; return pWnd;
if (pChildWin->IsKindOf(CLASSINFO(wxControl)))
{
wxControl* pItem = (wxControl *)pChildWin;
if (pItem->GetId() == ulId)
return(pItem);
else
{
// In case it's a 'virtual' control (e.g. radiobox)
if (pItem->GetSubcontrols().Member((wxObject *)ulId))
return(pItem);
}
}
pCurrent = pCurrent->GetNext(); pCurrent = pCurrent->GetNext();
} }
return(NULL); return(NULL);
} } // end of wxWindow::FindItem
//
// Find an item given the PM Window handle // Find an item given the PM Window handle
//
wxWindow* wxWindow::FindItemByHWND( wxWindow* wxWindow::FindItemByHWND(
WXHWND hWnd WXHWND hWnd
, bool bControlOnly , bool bControlOnly
@ -167,7 +205,9 @@ wxWindow* wxWindow::FindItemByHWND(
{ {
wxWindow* pParent = pCurrent->GetData(); wxWindow* pParent = pCurrent->GetData();
//
// Do a recursive search. // Do a recursive search.
//
wxWindow* pWnd = pParent->FindItemByHWND(hWnd); wxWindow* pWnd = pParent->FindItemByHWND(hWnd);
if (pWnd) if (pWnd)
@ -188,9 +228,11 @@ wxWindow* wxWindow::FindItemByHWND(
pCurrent = pCurrent->GetNext(); pCurrent = pCurrent->GetNext();
} }
return(NULL); return(NULL);
} } // end of wxWindow::FindItemByHWND
//
// Default command handler // Default command handler
//
bool wxWindow::OS2Command( bool wxWindow::OS2Command(
WXUINT WXUNUSED(uParam) WXUINT WXUNUSED(uParam)
, WXWORD WXUNUSED(uId) , WXWORD WXUNUSED(uId)
@ -205,10 +247,14 @@ bool wxWindow::OS2Command(
void wxWindow::Init() void wxWindow::Init()
{ {
// generic //
// Generic
//
InitBase(); InitBase();
//
// PM specific // PM specific
//
m_bDoubleClickAllowed = 0; m_bDoubleClickAllowed = 0;
m_bWinCaptured = FALSE; m_bWinCaptured = FALSE;
@ -217,19 +263,23 @@ void wxWindow::Init()
m_bUseCtl3D = FALSE; m_bUseCtl3D = FALSE;
m_bMouseInWindow = FALSE; m_bMouseInWindow = FALSE;
//
// wxWnd // wxWnd
//
m_hMenu = 0; m_hMenu = 0;
m_hWnd = 0; m_hWnd = 0;
// pass WM_GETDLGCODE to DefWindowProc() //
// Pass WM_GETDLGCODE to DefWindowProc()
m_lDlgCode = 0; m_lDlgCode = 0;
m_nXThumbSize = 0; m_nXThumbSize = 0;
m_nYThumbSize = 0; m_nYThumbSize = 0;
m_bBackgroundTransparent = FALSE; m_bBackgroundTransparent = FALSE;
// as all windows are created with WS_VISIBLE style... //
// As all windows are created with WS_VISIBLE style...
//
m_isShown = TRUE; m_isShown = TRUE;
#if wxUSE_MOUSEEVENT_HACK #if wxUSE_MOUSEEVENT_HACK
@ -237,26 +287,29 @@ void wxWindow::Init()
m_lLastMouseY = -1; m_lLastMouseY = -1;
m_nLastMouseEvent = -1; m_nLastMouseEvent = -1;
#endif // wxUSE_MOUSEEVENT_HACK #endif // wxUSE_MOUSEEVENT_HACK
} } // wxWindow::Init
//
// Destructor // Destructor
//
wxWindow::~wxWindow() wxWindow::~wxWindow()
{ {
m_isBeingDeleted = TRUE; m_isBeingDeleted = TRUE;
OS2DetachWindowMenu(); OS2DetachWindowMenu();
// delete handlers?
if (m_parent) if (m_parent)
m_parent->RemoveChild(this); m_parent->RemoveChild(this);
DestroyChildren(); DestroyChildren();
if (m_hWnd) if (m_hWnd)
{ {
if(!WinDestroyWindow(GetHWND())) if(!::WinDestroyWindow(GetHWND()))
wxLogLastError(wxT("DestroyWindow")); wxLogLastError(wxT("DestroyWindow"));
//
// remove hWnd <-> wxWindow association // remove hWnd <-> wxWindow association
//
wxRemoveHandleAssociation(this); wxRemoveHandleAssociation(this);
} }
} } // end of wxWindow::~wxWindow
bool wxWindow::Create( bool wxWindow::Create(
wxWindow* pParent wxWindow* pParent
@ -281,10 +334,39 @@ bool wxWindow::Create(
pParent->AddChild(this); pParent->AddChild(this);
ULONG ulFlags = 0L;
//
// Frame windows and their derivatives only
//
if (lStyle & wxBORDER)
ulFlags |= FCF_BORDER;
if (lStyle & wxTHICK_FRAME )
ulFlags |= FCF_SIZEBORDER;
//
// Some generic window styles
//
ulFlags |= WS_VISIBLE;
if (lStyle & wxCLIP_CHILDREN )
ulFlags |= WS_CLIPCHILDREN;
bool bWant3D; bool bWant3D;
WXDWORD dwExStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &bWant3D); WXDWORD dwExStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &bWant3D);
DWORD ulFlags = 0L;
//
// OS/2 PM doesn't have "extended" styles but if the library specifies
// them and we are creating a frame window then at least give it a border
//
if ( bWant3D ||
(m_windowStyle & wxSIMPLE_BORDER) ||
(m_windowStyle & wxRAISED_BORDER ) ||
(m_windowStyle & wxSUNKEN_BORDER) ||
(m_windowStyle & wxDOUBLE_BORDER)
)
{
ulFlags |= FCF_BORDER;
}
OS2Create( m_windowId OS2Create( m_windowId
,pParent ,pParent
,wxCanvasClassName ,wxCanvasClassName
@ -299,7 +381,7 @@ bool wxWindow::Create(
,dwExStyle ,dwExStyle
); );
return(TRUE); return(TRUE);
} } // end of wxWindow::Create
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// basic operations // basic operations
@ -311,7 +393,7 @@ void wxWindow::SetFocus()
if (hWnd) if (hWnd)
::WinSetFocus(HWND_DESKTOP, hWnd); ::WinSetFocus(HWND_DESKTOP, hWnd);
} } // end of wxWindow::SetFocus
wxWindow* wxWindowBase::FindFocus() wxWindow* wxWindowBase::FindFocus()
{ {
@ -322,7 +404,7 @@ wxWindow* wxWindowBase::FindFocus()
return wxFindWinFromHandle((WXHWND)hWnd); return wxFindWinFromHandle((WXHWND)hWnd);
} }
return NULL; return NULL;
} } // wxWindowBase::FindFocus
bool wxWindow::Enable( bool wxWindow::Enable(
bool bEnable bool bEnable
@ -346,7 +428,7 @@ bool wxWindow::Enable(
pNode = pNode->GetNext(); pNode = pNode->GetNext();
} }
return(TRUE); return(TRUE);
} } // end of wxWindow::Enable
bool wxWindow::Show( bool wxWindow::Show(
bool bShow bool bShow
@ -361,32 +443,32 @@ bool wxWindow::Show(
if (bShow) if (bShow)
{ {
::WinSetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE); ::WinSetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE | SWP_ZORDER);
} }
return(TRUE); return(TRUE);
} } // end of wxWindow::Show
void wxWindow::Raise() void wxWindow::Raise()
{ {
::WinSetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_ACTIVATE); ::WinSetWindowPos(GetHwnd(), HWND_TOP, 0, 0, 0, 0, SWP_ZORDER | SWP_ACTIVATE);
} } // end of wxWindow::Raise
void wxWindow::Lower() void wxWindow::Lower()
{ {
::WinSetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_DEACTIVATE); ::WinSetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER | SWP_DEACTIVATE);
} } // end of wxWindow::Lower
void wxWindow::SetTitle( void wxWindow::SetTitle(
const wxString& rTitle const wxString& rTitle
) )
{ {
::WinSetWindowText(GetHwnd(), rTitle.c_str()); ::WinSetWindowText(GetHwnd(), rTitle.c_str());
} } // end of wxWindow::SetTitle
wxString wxWindow::GetTitle() const wxString wxWindow::GetTitle() const
{ {
return wxGetWindowText(GetHWND()); return wxGetWindowText(GetHWND());
} } // end of wxWindow::GetTitle
void wxWindow::CaptureMouse() void wxWindow::CaptureMouse()
{ {
@ -397,16 +479,16 @@ void wxWindow::CaptureMouse()
::WinSetCapture(HWND_DESKTOP, hWnd); ::WinSetCapture(HWND_DESKTOP, hWnd);
m_bWinCaptured = TRUE; m_bWinCaptured = TRUE;
} }
} } // end of wxWindow::GetTitle
void wxWindow::ReleaseMouse() void wxWindow::ReleaseMouse()
{ {
if ( m_bWinCaptured ) if (m_bWinCaptured)
{ {
::WinSetCapture(HWND_DESKTOP, NULLHANDLE); ::WinSetCapture(HWND_DESKTOP, NULLHANDLE);
m_bWinCaptured = FALSE; m_bWinCaptured = FALSE;
} }
} } // end of wxWindow::ReleaseMouse
bool wxWindow::SetFont( bool wxWindow::SetFont(
const wxFont& rFont const wxFont& rFont
@ -458,15 +540,26 @@ bool wxWindow::SetCursor(
if ((::GpiPtInRegion(hPS, hRGN, &vPoint) == PRGN_INSIDE) && !wxIsBusy()) if ((::GpiPtInRegion(hPS, hRGN, &vPoint) == PRGN_INSIDE) && !wxIsBusy())
{ {
// ::SetCursor((HCURSOR)m_cursor.GetHCURSOR()); ::WinSetPointer(HWND_DESKTOP, (HPOINTER)m_cursor.GetHCURSOR());
} }
return TRUE; return TRUE;
} } // end of wxWindow::SetCursor
void wxWindow::WarpPointer(int x_pos, int y_pos) void wxWindow::WarpPointer(
int nXPos
, int nYPos
)
{ {
// TODO: int nX = nXPos;
} int nY = nYPos;
RECTL vRect;
::WinQueryWindowRect(GetHwnd(), &vRect);
nX += vRect.xLeft;
nY += vRect.yBottom;
::WinSetPointerPos(HWND_DESKTOP, (LONG)nX, (LONG)(nY));
} // end of wxWindow::WarpPointer
#if WXWIN_COMPATIBILITY #if WXWIN_COMPATIBILITY
void wxWindow::OS2DeviceToLogical (float *x, float *y) const void wxWindow::OS2DeviceToLogical (float *x, float *y) const
@ -479,27 +572,51 @@ void wxWindow::OS2DeviceToLogical (float *x, float *y) const
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
#if WXWIN_COMPATIBILITY #if WXWIN_COMPATIBILITY
void wxWindow::SetScrollRange(int orient, int range, bool refresh) void wxWindow::SetScrollRange(
int nOrient
, int nRange
, bool bRefresh
)
{ {
// TODO: ::WinSendMsg(GetHwnd(), SBM_SETSCROLLBAR, (MPARAM)0, MPFROM2SHORT(0, nRange));
} // end of wxWindow::SetScrollRange
void wxWindow::SetScrollPage(
int nOrient
, int nPage
, bool bRefresh
)
{
if ( orient == wxHORIZONTAL )
m_xThumbSize = page;
else
m_yThumbSize = page;
} }
void wxWindow::SetScrollPage(int orient, int page, bool refresh) int wxWindow::OldGetScrollRange(
int nOrient
) const
{ {
// TODO: MRESULT mRc;
} HWND hWnd = GetHwnd();
int wxWindow::OldGetScrollRange(int orient) const if (hWnd)
{ {
// TODO: mRc = WinSendMsg(hWnd, SBM_QUERYRANGE, (MPARAM)0L, (MPARAM)0L);
return 0; return(SHORT2FROMMR(mRc));
} }
return 0;
} // end of wxWindow::OldGetScrollRange
int wxWindow::GetScrollPage(int orient) const int wxWindow::GetScrollPage(
int nOrient
) const
{ {
// TODO: if (nOrient == wxHORIZONTAL)
return(1); return m_xThumbSize;
} else
return m_yThumbSize;
} // end of wxWindow::GetScrollPage
#endif // WXWIN_COMPATIBILITY #endif // WXWIN_COMPATIBILITY
int wxWindow::GetScrollPos(int orient) const int wxWindow::GetScrollPos(int orient) const
@ -905,7 +1022,7 @@ bool wxWindow::DoPopupMenu( wxMenu *menu, int x, int y )
// pre/post message processing // pre/post message processing
// =========================================================================== // ===========================================================================
MRESULT wxWindow::OS2DefWindowProc(HWND hwnd, WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) MRESULT wxWindow::OS2DefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{ {
// TODO: // TODO:
return (MRESULT)0; return (MRESULT)0;
@ -1008,13 +1125,13 @@ MRESULT wxWndProc(HWND hWnd, ULONG message, MPARAM wParam, MPARAM lParam)
{ {
// FIXME: why do we do this? // FIXME: why do we do this?
wnd->SetHWND((WXHWND) hWnd); wnd->SetHWND((WXHWND) hWnd);
rc = wnd->OS2DefWindowProc(hWnd, message, wParam, lParam ); rc = wnd->OS2DefWindowProc(message, wParam, lParam );
wnd->SetHWND(0); wnd->SetHWND(0);
} }
else else
{ {
if ( wnd ) if ( wnd )
rc = wnd->OS2WindowProc(hWnd, message, wParam, lParam); rc = wnd->OS2WindowProc(message, wParam, lParam);
else else
rc = 0; //TODO: DefWindowProc( hWnd, message, wParam, lParam ); rc = 0; //TODO: DefWindowProc( hWnd, message, wParam, lParam );
} }
@ -1022,7 +1139,7 @@ MRESULT wxWndProc(HWND hWnd, ULONG message, MPARAM wParam, MPARAM lParam)
return rc; return rc;
} }
MRESULT wxWindow::OS2WindowProc(HWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam) MRESULT wxWindow::OS2WindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{ {
// did we process the message? // did we process the message?
bool processed = FALSE; bool processed = FALSE;