X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/42e69d6b435a4dd5415caf3750db62cf45b6f373..cf1a9b45c7b70f217d3cc282ab77df8feaadcdeb:/include/wx/msw/window.h diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index febe2c9b2e..538051007b 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -20,7 +20,7 @@ #pragma interface "window.h" #endif -#include "wx/msw/winundef.h" +// #include "wx/msw/winundef.h" // VZ: apparently some version of Windows send extra mouse move messages after // a mouse click. My tests under NT 4.0 and 95 didn't show it so I'm @@ -49,10 +49,9 @@ enum // --------------------------------------------------------------------------- // wxWindow declaration for MSW // --------------------------------------------------------------------------- + class WXDLLEXPORT wxWindow : public wxWindowBase { - DECLARE_DYNAMIC_CLASS(wxWindow); - public: wxWindow() { Init(); } @@ -88,7 +87,7 @@ public: virtual void SetFocus(); - virtual bool Reparent( wxWindow *newParent ); + virtual bool Reparent( wxWindowBase *newParent ); virtual void WarpPointer(int x, int y); virtual void CaptureMouse(); @@ -110,14 +109,7 @@ public: const wxFont *theFont = (const wxFont *) NULL) const; - virtual void ClientToScreen( int *x, int *y ) const; - virtual void ScreenToClient( int *x, int *y ) const; - wxPoint ClientToScreen(const wxPoint& pt) const - { int x = pt.x; int y = pt.y; ClientToScreen(& x, & y); return wxPoint(x, y); } - wxPoint ScreenToClient(const wxPoint& pt) const - { int x = pt.x; int y = pt.y; ScreenToClient(& x, & y); return wxPoint(x, y); } - - virtual bool PopupMenu( wxMenu *menu, int x, int y ); + virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); virtual void SetScrollbar( int orient, int pos, int thumbVisible, int range, bool refresh = TRUE ); @@ -151,13 +143,16 @@ public: virtual void OnDefaultAction(wxControl * WXUNUSED(initiatingItem)) { } #endif // WXWIN_COMPATIBILITY - // caret manipulation (MSW only) - virtual void CreateCaret(int w, int h); - virtual void CreateCaret(const wxBitmap *bitmap); - virtual void DestroyCaret(); - virtual void ShowCaret(bool show); - virtual void SetCaretPos(int x, int y); - virtual void GetCaretPos(int *x, int *y) const; +#if wxUSE_CARET && WXWIN_COMPATIBILITY + // caret manipulation (old MSW only functions, see wxCaret class for the + // new API) + void CreateCaret(int w, int h); + void CreateCaret(const wxBitmap *bitmap); + void DestroyCaret(); + void ShowCaret(bool show); + void SetCaretPos(int x, int y); + void GetCaretPos(int *x, int *y) const; +#endif // wxUSE_CARET // Native resource loading (implemented in src/msw/nativdlg.cpp) // FIXME: should they really be all virtual? @@ -166,6 +161,13 @@ public: wxWindow* GetWindowChild1(wxWindowID id); wxWindow* GetWindowChild(wxWindowID id); + // a MSW only function which sends a size event to the window using its + // current size - this has an effect of refreshing the window layout +/* +FUNCTION IS NOW A MEMBER OF wxFrame - gt + void SendSizeEvent(); +*/ + // implementation from now on // -------------------------- @@ -182,13 +184,11 @@ public: // event handlers // -------------- + + void OnSetFocus(wxFocusEvent& event); void OnEraseBackground(wxEraseEvent& event); void OnIdle(wxIdleEvent& event); - - // a window may have a default button - // TODO move into wxPanel and/or wxFrame - wxButton *GetDefaultItem() const { return m_btnDefault; } - void SetDefaultItem(wxButton *btn) { m_btnDefault = btn; } + void OnPaint(wxPaintEvent& event); public: // For implementation purposes - sometimes decorations make the client area @@ -206,13 +206,14 @@ public: WXFARPROC MSWGetOldWndProc() const { return m_oldWndProc; } void MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; } - wxWindow *FindItem(int id) const; + wxWindow *FindItem(long id) const; wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const; // Make a Windows extended style from the given wxWindows window style - virtual WXDWORD MakeExtendedStyle(long style, bool eliminateBorders = TRUE); + static WXDWORD MakeExtendedStyle(long style, + bool eliminateBorders = FALSE); // Determine whether 3D effects are wanted - virtual WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D); + WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D) const; // MSW only: TRUE if this control is part of the main control virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; }; @@ -220,12 +221,12 @@ public: // returns TRUE if the window has been created bool MSWCreate(int id, wxWindow *parent, - const char *wclass, + const wxChar *wclass, wxWindow *wx_win, - const char *title, + const wxChar *title, int x, int y, int width, int height, WXDWORD style, - const char *dialog_template = NULL, + const wxChar *dialog_template = NULL, WXDWORD exendedStyle = 0); virtual bool MSWCommand(WXUINT param, WXWORD id); @@ -261,7 +262,7 @@ public: WXWORD *item, WXWORD *flags, WXHMENU *hmenu); // ------------------------------------------------------------------------ - // internal handlers for MSW messages: all handlers return a boolen value: + // internal handlers for MSW messages: all handlers return a boolean value: // TRUE means that the handler processed the event and FALSE that it didn't // ------------------------------------------------------------------------ @@ -305,12 +306,12 @@ public: bool HandleSysCommand(WXWPARAM wParam, WXLPARAM lParam); bool HandleCtlColor(WXHBRUSH *hBrush, - WXHDC hdc, - WXHWND hWnd, - WXUINT nCtlColor, - WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam); + WXHDC hdc, + WXHWND hWnd, + WXUINT nCtlColor, + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam); bool HandlePaletteChanged(WXHWND hWndPalChange); bool HandleQueryNewPalette(); @@ -326,10 +327,11 @@ public: bool HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags); bool HandleMouseMove(int x, int y, WXUINT flags); + bool HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam); - bool HandleChar(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE); - bool HandleKeyDown(WXWORD wParam, WXLPARAM lParam); - bool HandleKeyUp(WXWORD wParam, WXLPARAM lParam); + bool HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII = FALSE); + bool HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam); + bool HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam); bool HandleQueryDragIcon(WXHICON *hIcon); @@ -381,12 +383,6 @@ protected: bool m_doubleClickAllowed:1; bool m_winCaptured:1; - // Caret data - bool m_caretEnabled:1; - bool m_caretShown:1; - int m_caretWidth; - int m_caretHeight; - // the size of one page for scrolling int m_xThumbSize; int m_yThumbSize; @@ -400,9 +396,12 @@ protected: WXHMENU m_hMenu; // Menu, if any - wxButton *m_btnDefault; + // the return value of WM_GETDLGCODE handler + long m_lDlgCode; // implement the base class pure virtuals + virtual void DoClientToScreen( int *x, int *y ) const; + virtual void DoScreenToClient( int *x, int *y ) const; virtual void DoGetPosition( int *x, int *y ) const; virtual void DoGetSize( int *width, int *height ) const; virtual void DoGetClientSize( int *width, int *height ) const; @@ -411,6 +410,12 @@ protected: int sizeFlags = wxSIZE_AUTO); virtual void DoSetClientSize(int width, int height); + // move the window to the specified location and resize it: this is called + // from both DoSetSize() and DoSetClientSize() and would usually just call + // ::MoveWindow() except for composite controls which will want to arrange + // themselves inside the given rectangle + virtual void DoMoveWindow(int x, int y, int width, int height); + #if wxUSE_TOOLTIPS virtual void DoSetToolTip( wxToolTip *tip ); #endif // wxUSE_TOOLTIPS @@ -427,6 +432,10 @@ 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(wxWindow); DECLARE_NO_COPY_CLASS(wxWindow); DECLARE_EVENT_TABLE() };