X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6522713c7527e5f683a107dff8f40e3ea19a4745..748fcded3c795db266076aac381aa335cc4aa42d:/include/wx/msw/window.h diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index 6bdc49db2a..08a5040efd 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -28,6 +28,13 @@ // a better solution should be found later... #define wxUSE_MOUSEEVENT_HACK 0 +#include "wx/hash.h" + +// pseudo-template HWND <-> wxWindow hash table +WX_DECLARE_HASH(wxWindow, wxWindowList, wxWinHashTable); + +extern wxWinHashTable *wxWinHandleHash; + // --------------------------------------------------------------------------- // constants // --------------------------------------------------------------------------- @@ -90,6 +97,8 @@ public: const wxRect *rect = (const wxRect *) NULL ); virtual void Update(); virtual void Clear(); + virtual void Freeze(); + virtual void Thaw(); virtual bool SetCursor( const wxCursor &cursor ); virtual bool SetFont( const wxFont &font ); @@ -116,6 +125,9 @@ public: virtual void ScrollWindow( int dx, int dy, const wxRect* rect = (wxRect *) NULL ); + virtual bool ScrollLines(int lines); + virtual bool ScrollPages(int pages); + #if wxUSE_DRAG_AND_DROP virtual void SetDropTarget( wxDropTarget *dropTarget ); #endif // wxUSE_DRAG_AND_DROP @@ -183,7 +195,6 @@ FUNCTION IS NOW A MEMBER OF wxFrame - gt // event handlers // -------------- - void OnSetFocus(wxFocusEvent& event); void OnEraseBackground(wxEraseEvent& event); void OnIdle(wxIdleEvent& event); void OnPaint(wxPaintEvent& event); @@ -193,10 +204,6 @@ public: // smaller virtual wxPoint GetClientAreaOrigin() const; - // Makes an adjustment to the window position (for example, a frame that has - // a toolbar that it manages itself). - virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags); - // Windows subclassing void SubclassWin(WXHWND hWnd); void UnsubclassWin(); @@ -216,16 +223,26 @@ public: // MSW only: TRUE if this control is part of the main control virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; }; - // returns TRUE if the window has been created - bool MSWCreate(int id, - wxWindow *parent, - const wxChar *wclass, - wxWindow *wx_win, - const wxChar *title, - int x, int y, int width, int height, - WXDWORD style, - const wxChar *dialog_template = NULL, + // translate wxWindows coords into Windows ones suitable to be passed to + // ::CreateWindow() + // + // returns TRUE if non default coords are returned, FALSE otherwise + bool MSWGetCreateWindowCoords(const wxPoint& pos, + const wxSize& size, + int& x, int& y, + int& w, int& h) const; + + // creates the window of specified Windows class with given style, extended + // style, title and geometry (default values + // + // returns TRUE if the window has been created, FALSE if creation failed + bool MSWCreate(const wxChar *wclass, + const wxChar *title = NULL, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + WXDWORD style = 0, WXDWORD exendedStyle = 0); + virtual bool MSWCommand(WXUINT param, WXWORD id); #if WXWIN_COMPATIBILITY @@ -342,8 +359,20 @@ public: // Calls an appropriate default window procedure virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + // message processing helpers + + // return FALSE if the message shouldn't be translated/preprocessed but + // dispatched normally + virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg); + + // return TRUE if the message was preprocessed and shouldn't be dispatched virtual bool MSWProcessMessage(WXMSG* pMsg); + + // return TRUE if the message was translated and shouldn't be dispatched virtual bool MSWTranslateMessage(WXMSG* pMsg); + + // called when the window is about to be destroyed virtual void MSWDestroyWindow(); // Detach "Window" menu from menu bar so it doesn't get deleted @@ -422,6 +451,9 @@ protected: virtual void DoSetToolTip( wxToolTip *tip ); #endif // wxUSE_TOOLTIPS + // the helper functions used by HandleChar/KeyXXX methods + wxKeyEvent CreateKeyEvent(wxEventType evType, int id, WXLPARAM lp) const; + private: // common part of all ctors void Init(); @@ -434,11 +466,8 @@ private: bool HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); #endif // __WIN95__ - // the helper functions used by HandleChar/KeyXXX methods - wxKeyEvent CreateKeyEvent(wxEventType evType, int id, WXLPARAM lp) const; - - DECLARE_DYNAMIC_CLASS(wxWindowMSW); - DECLARE_NO_COPY_CLASS(wxWindowMSW); + DECLARE_DYNAMIC_CLASS(wxWindowMSW) + DECLARE_NO_COPY_CLASS(wxWindowMSW) DECLARE_EVENT_TABLE() }; @@ -450,5 +479,15 @@ private: WXDLLEXPORT int wxCharCodeMSWToWX(int keySym); WXDLLEXPORT int wxCharCodeWXToMSW(int id, bool *IsVirtual); +// window creation helper class: before creating a new HWND, instantiate an +// object of this class on stack - this allows to process the messages sent to +// the window even before CreateWindow() returns +class wxWindowCreationHook +{ +public: + wxWindowCreationHook(wxWindowMSW *winBeingCreated); + ~wxWindowCreationHook(); +}; + #endif // _WX_WINDOW_H_