X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8f7b34a878bbcb2f71a0c7694e2a3bec51460218..dad5f99acb6b3400ff73562c03db2f3f21b658cd:/include/wx/mgl/window.h diff --git a/include/wx/mgl/window.h b/include/wx/mgl/window.h index f558f1ace4..4cd53c3d27 100644 --- a/include/wx/mgl/window.h +++ b/include/wx/mgl/window.h @@ -1,127 +1,158 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: window.h -// Purpose: +// Name: wx/mgl/window.h +// Purpose: wxWindow class // Author: Vaclav Slavik -// Id: $Id$ +// RCS-ID: $Id$ // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +#ifndef _WX_WINDOW_H_ +#define _WX_WINDOW_H_ -#ifndef __WX_WINDOW_H__ -#define __WX_WINDOW_H__ +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- #ifdef __GNUG__ #pragma interface "window.h" #endif +#include "wx/font.h" -//----------------------------------------------------------------------------- -// wxWindow -//----------------------------------------------------------------------------- +struct window_t; +class MGLDevCtx; + +// --------------------------------------------------------------------------- +// wxWindow declaration for MGL +// --------------------------------------------------------------------------- class WXDLLEXPORT wxWindowMGL : public wxWindowBase { - DECLARE_DYNAMIC_CLASS(wxWindowMGL) - public: - // creating the window - // ------------------- - wxWindowMGL() {} + wxWindowMGL() { Init(); } + wxWindowMGL(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = wxPanelNameStr) {} + const wxString& name = wxPanelNameStr) + { + Init(); + Create(parent, id, pos, size, style, name); + } + + virtual ~wxWindowMGL(); + bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = wxPanelNameStr) {} - virtual ~wxWindowMGL() {} + const wxString& name = wxPanelNameStr); - // implement base class (pure) virtual methods - // ------------------------------------------- - virtual bool Destroy() {return TRUE;} + virtual void Raise(); + virtual void Lower(); - virtual void Raise() {} - virtual void Lower() {} + virtual bool Show(bool show = TRUE); - virtual bool Show( bool show = TRUE ) {return TRUE;} - virtual bool Enable( bool enable = TRUE ) {return TRUE;} + virtual void SetFocus(); - virtual bool IsRetained() const {return TRUE;} + virtual bool Reparent(wxWindowBase *newParent); - virtual void SetFocus() {} - virtual bool AcceptsFocus() const {return TRUE;} + virtual void WarpPointer(int x, int y); + virtual void CaptureMouse(); + virtual void ReleaseMouse(); - virtual bool Reparent( wxWindowBase *newParent ) {return TRUE;} + virtual void Refresh(bool eraseBackground = TRUE, + const wxRect *rect = (const wxRect *) NULL); + virtual void Update(); + virtual void Clear(); + virtual void Freeze(); + virtual void Thaw(); - virtual void WarpPointer(int x, int y) {} - virtual void CaptureMouse() {} - virtual void ReleaseMouse() {} + virtual bool SetCursor(const wxCursor &cursor); + virtual bool SetFont(const wxFont &font) { m_font = font; return TRUE; } - virtual void Refresh( bool eraseBackground = TRUE, - const wxRect *rect = (const wxRect *) NULL ) {} - virtual void Clear() {} - - virtual bool SetBackgroundColour( const wxColour &colour ) {return TRUE;} - virtual bool SetForegroundColour( const wxColour &colour ) {return TRUE;} - virtual bool SetCursor( const wxCursor &cursor ) {return TRUE;} - virtual bool SetFont( const wxFont &font ) {return TRUE;} - - virtual int GetCharHeight() const {return 0;} - virtual int GetCharWidth() const {return 0;} + virtual int GetCharHeight() const; + virtual int GetCharWidth() const; virtual void GetTextExtent(const wxString& string, int *x, int *y, int *descent = (int *) NULL, int *externalLeading = (int *) NULL, const wxFont *theFont = (const wxFont *) NULL) - const {} - - virtual bool DoPopupMenu( wxMenu *menu, int x, int y ) {return TRUE;} - - virtual void SetScrollbar( int orient, int pos, int thumbVisible, - int range, bool refresh = TRUE ) {} - virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE ) {} - virtual int GetScrollPos( int orient ) const {return 0;} - virtual int GetScrollThumb( int orient ) const {return 0;} - virtual int GetScrollRange( int orient ) const {return 0;} - virtual void ScrollWindow( int dx, int dy, - const wxRect* rect = (wxRect *) NULL ) {} + const; #if wxUSE_DRAG_AND_DROP - virtual void SetDropTarget( wxDropTarget *dropTarget ) {} + virtual void SetDropTarget(wxDropTarget *dropTarget); #endif // wxUSE_DRAG_AND_DROP - virtual WXWidget GetHandle() const { return NULL; } + // Accept files for dragging + virtual void DragAcceptFiles(bool accept); - /* For compatibility across platforms (not in event table) */ - void OnIdle(wxIdleEvent& WXUNUSED(event)) {}; +#if WXWIN_COMPATIBILITY + // event handlers + // Handle a control command + virtual void OnCommand(wxWindow& win, wxCommandEvent& event); + + // Override to define new behaviour for default action (e.g. double + // clicking on a listbox) + virtual void OnDefaultAction(wxControl * WXUNUSED(initiatingItem)) { } +#endif // WXWIN_COMPATIBILITY + + virtual WXWidget GetHandle() const { return m_wnd; } + + // implementation from now on + // -------------------------- + +protected: + // the window handle + struct window_t *m_wnd; + // whether there should be wxEraseEvent before wxPaintEvent or not + // (see wxWindow::Refresh) + bool m_frozen; + bool m_refreshAfterThaw; + wxFont m_font; // 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 {} + 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; virtual void DoSetSize(int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO) {} - virtual void DoSetClientSize(int width, int height) {} - virtual void DoMoveWindow(int x, int y, int width, int height) {} - -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ) {} -#endif // wxUSE_TOOLTIPS + int sizeFlags = wxSIZE_AUTO); + virtual void DoSetClientSize(int width, int height); - // common part of all ctors (can't be virtual because called from ctor) - void Init() {} + // 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); private: + // common part of all ctors + void Init(); + // counterpart to SetFocus + void KillFocus(); + + MGLDevCtx *m_paintMGLDC; + friend class wxPaintDC; + + void OnEraseBackground(wxEraseEvent& event); + void OnSetFocus(wxFocusEvent& event); + + DECLARE_DYNAMIC_CLASS(wxWindowMGL); DECLARE_NO_COPY_CLASS(wxWindowMGL); + DECLARE_EVENT_TABLE() + +public: + void HandlePaint(MGLDevCtx *dc); + // needed by wxWindowPainter }; -#endif // ___WX_WINDOW_H__ + +#endif + // _WX_WINDOW_H_