X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7b218dfaf47dc47705f6d6cba9408fa9f9cca70e..750b78ba359e7d30c7d3ad49d268923e986268cb:/include/wx/msw/window.h diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index cef7278a85..2efdb4dcd4 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -6,7 +6,7 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_WINDOW_H_ @@ -27,6 +27,7 @@ #include "wx/list.h" #include "wx/region.h" #include "wx/msw/accel.h" +#include "wx/intl.h" #define wxKEY_SHIFT 1 #define wxKEY_CTRL 2 @@ -66,6 +67,7 @@ class WXDLLEXPORT wxPen; class WXDLLEXPORT wxIcon; class WXDLLEXPORT wxDC; class WXDLLEXPORT wxValidator; +class WXDLLEXPORT wxToolTip; #if wxUSE_DRAG_AND_DROP class WXDLLEXPORT wxDropTarget; @@ -81,6 +83,42 @@ WXDLLEXPORT_DATA(extern const char*) wxPanelNameStr; WXDLLEXPORT_DATA(extern const wxSize) wxDefaultSize; WXDLLEXPORT_DATA(extern const wxPoint) wxDefaultPosition; +//----------------------------------------------------------------------------- +// wxClientData +//----------------------------------------------------------------------------- + +class wxClientData +{ +public: + wxClientData() { } + virtual ~wxClientData() { } +}; + +//----------------------------------------------------------------------------- +// wxStringClientData +//----------------------------------------------------------------------------- + +class wxStringClientData: public wxClientData +{ +public: + wxStringClientData() { } + wxStringClientData( wxString &data ) { m_data = data; } + void SetData( wxString &data ) { m_data = data; } + wxString GetData() const { return m_data; } + +private: + wxString m_data; +}; + +// Clash with Windows headers +#ifdef GetCharWidth +#undef GetCharWidth +#endif + +#ifdef FindWindow +#undef FindWindow +#endif + class WXDLLEXPORT wxWindow : public wxEvtHandler { DECLARE_ABSTRACT_CLASS(wxWindow) @@ -225,6 +263,16 @@ public: wxDropTarget *GetDropTarget() const { return m_pDropTarget; } #endif +#if wxUSE_TOOLTIPS + // tooltips + // create a tooltip with this text + void SetToolTip(const wxString &tip); + // pointer may be NULL to remove the tooltip + void SetToolTip(wxToolTip *tooltip); + // get the current tooltip (may return NULL if none) + wxToolTip* GetToolTip() const { return m_tooltip; } +#endif // wxUSE_TOOLTIPS + // Accept files for dragging virtual void DragAcceptFiles(bool accept); @@ -335,7 +383,7 @@ public: // be searched) void PushEventHandler(wxEvtHandler *handler) ; wxEvtHandler *PopEventHandler(bool deleteHandler = FALSE) ; - + // Close the window by calling OnClose, posting a deletion virtual bool Close(bool force = FALSE); @@ -418,17 +466,16 @@ public: void OnEraseBackground(wxEraseEvent& event); void OnChar(wxKeyEvent& event); - void OnPaint(wxPaintEvent& event); void OnIdle(wxIdleEvent& event); // Does this window want to accept keyboard focus? virtual bool AcceptsFocus() const; - virtual void PrepareDC( wxDC &dc ) {}; + virtual void PrepareDC( wxDC& WXUNUSED(dc) ) {}; public: //////////////////////////////////////////////////////////////////////// //// IMPLEMENTATION - + // For implementation purposes - sometimes decorations make the client area // smaller virtual wxPoint GetClientAreaOrigin() const; @@ -575,7 +622,10 @@ public: virtual void MSWOnMouseEnter(int x, int y, WXUINT flags); virtual void MSWOnMouseLeave(int x, int y, WXUINT flags); - virtual void MSWOnChar(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE); + // These return TRUE if an event handler was found, FALSE otherwise (not processed) + virtual bool MSWOnChar(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE); + virtual bool MSWOnKeyDown(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE); + virtual bool MSWOnKeyUp(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE); virtual bool MSWOnActivate(int flag, bool minimized, WXHWND activate); virtual long MSWOnMDIActivate(long flag, WXHWND activate, WXHWND deactivate); @@ -601,13 +651,13 @@ public: // Detach "Window" menu from menu bar so it doesn't get deleted void MSWDetachWindowMenu(); - + inline WXFARPROC MSWGetOldWndProc() const; inline void MSWSetOldWndProc(WXFARPROC proc); // Define for each class of dialog and control virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); inline void SetShowing(bool show); inline bool IsUserEnabled() const; @@ -629,8 +679,8 @@ public: protected: wxAcceleratorTable m_acceleratorTable; int m_windowId; - long m_windowStyle; // Store the window's style - wxEvtHandler * m_windowEventHandler; // Usually is 'this' + long m_windowStyle; // Store the window's style + wxEvtHandler * m_windowEventHandler; // Usually is 'this' wxLayoutConstraints * m_constraints; // Constraints for this window wxList * m_constraintsInvolvedIn; // List of constraints we're involved in wxSizer * m_windowSizer; // Window's top-level sizer (if any) @@ -642,7 +692,7 @@ protected: WXFARPROC m_oldWndProc; bool m_useCtl3D; // Using CTL3D for this control - bool m_inOnSize; // Protection against OnSize reentry + bool m_inOnSize; // Protection against OnSize reentry #ifndef _WX_WIN32__ // Pointer to global memory, for EDIT controls that need // special treatment to reduce USER area consumption. @@ -690,7 +740,7 @@ protected: #endif //USE_DRAG_AND_DROP public: - WXHWND m_hWnd; // MS Windows window handle + WXHWND m_hWnd; // MS Windows window handle WXUINT m_lastMsg; WXWPARAM m_lastWParam; WXLPARAM m_lastLParam; @@ -714,6 +764,11 @@ private: // common part of all ctors void Init(); + // the associated tooltip (may be NULL if none) +#if wxUSE_TOOLTIPS + wxToolTip *m_tooltip; +#endif + DECLARE_EVENT_TABLE() }; @@ -725,7 +780,7 @@ inline int wxWindow::GetId() const { return m_windowId; } inline void wxWindow::SetId(int id) { m_windowId = id; } inline wxWindow *wxWindow::GetParent() const { return m_windowParent; } inline void wxWindow::SetParent(wxWindow *p) { m_windowParent = p; } -inline wxWindow *wxWindow::GetGrandParent() const { return (m_windowParent ? m_windowParent->m_windowParent : NULL); } +inline wxWindow *wxWindow::GetGrandParent() const { return (m_windowParent ? m_windowParent->m_windowParent : (wxWindow*) NULL); } inline wxList& wxWindow::GetChildren() const { return (wxList&) *m_children; } inline wxFont& wxWindow::GetFont() const { return (wxFont&) m_windowFont; } inline wxString wxWindow::GetName() const { return m_windowName; }