📄 window.h
字号:
/////////////////////////////////////////////////////////////////////////////// Name: wx/gtk/window.h// Purpose:// Author: Robert Roebling// Id: $Id: window.h,v 1.160 2006/10/09 16:38:57 VZ Exp $// Copyright: (c) 1998 Robert Roebling// Licence: wxWindows licence/////////////////////////////////////////////////////////////////////////////#ifndef _WX_GTK_WINDOW_H_#define _WX_GTK_WINDOW_H_#include "wx/dynarray.h"// helper structure that holds class that holds GtkIMContext object and// some additional data needed for key events processingstruct wxGtkIMData;WX_DEFINE_EXPORTED_ARRAY_PTR(GdkWindow *, wxArrayGdkWindows);//-----------------------------------------------------------------------------// callback definition for inserting a window (internal)//-----------------------------------------------------------------------------class WXDLLIMPEXP_CORE wxWindowGTK;typedef void (*wxInsertChildFunction)( wxWindowGTK*, wxWindowGTK* );//-----------------------------------------------------------------------------// wxWindowGTK//-----------------------------------------------------------------------------class WXDLLIMPEXP_CORE wxWindowGTK : public wxWindowBase{public: // creating the window // ------------------- wxWindowGTK(); wxWindowGTK(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxPanelNameStr); bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxPanelNameStr); virtual ~wxWindowGTK(); // implement base class (pure) virtual methods // ------------------------------------------- virtual void SetLabel(const wxString& WXUNUSED(label)) { } virtual wxString GetLabel() const { return wxEmptyString; } virtual bool Destroy(); virtual void Raise(); virtual void Lower(); virtual bool Show( bool show = true ); virtual bool Enable( bool enable = true ); virtual void SetWindowStyleFlag( long style ); virtual bool IsRetained() const; virtual void SetFocus(); virtual bool AcceptsFocus() const; virtual bool Reparent( wxWindowBase *newParent ); virtual void WarpPointer(int x, int y); virtual void Refresh( bool eraseBackground = true, const wxRect *rect = (const wxRect *) NULL ); virtual void Update(); virtual void ClearBackground(); virtual bool SetBackgroundColour( const wxColour &colour ); virtual bool SetForegroundColour( const wxColour &colour ); virtual bool SetCursor( const wxCursor &cursor ); virtual bool SetFont( const wxFont &font ); virtual bool SetBackgroundStyle(wxBackgroundStyle style) ; 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 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; virtual int GetScrollThumb( int orient ) const; virtual int GetScrollRange( int orient ) const; 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 virtual void AddChild( wxWindowBase *child ); virtual void RemoveChild( wxWindowBase *child ); virtual void SetLayoutDirection(wxLayoutDirection dir); virtual wxLayoutDirection GetLayoutDirection() const; virtual wxCoord AdjustForLayoutDirection(wxCoord x, wxCoord width, wxCoord widthTotal) const; virtual bool DoIsExposed( int x, int y ) const; virtual bool DoIsExposed( int x, int y, int w, int h ) const; // currently wxGTK2-only void SetDoubleBuffered(bool on); virtual bool IsDoubleBuffered() const; // implementation // -------------- virtual WXWidget GetHandle() const { return m_widget; } // many important things are done here, this function must be called // regularly virtual void OnInternalIdle(); // Internal represention of Update() void GtkUpdate(); // For compatibility across platforms (not in event table) void OnIdle(wxIdleEvent& WXUNUSED(event)) {} // wxGTK-specific: called recursively by Enable, // to give widgets an opportunity to correct their colours after they // have been changed by Enable virtual void OnParentEnable( bool WXUNUSED(enable) ) {} // Used by all window classes in the widget creation process. bool PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size ); void PostCreation(); // Internal addition of child windows. differs from class // to class not by using virtual functions but by using // the m_insertCallback. void DoAddChild(wxWindowGTK *child); // This methods sends wxPaintEvents to the window. It reads the // update region, breaks it up into rects and sends an event // for each rect. It is also responsible for background erase // events and NC paint events. It is called from "draw" and // "expose" handlers as well as from ::Update() void GtkSendPaintEvents(); // The methods below are required because many native widgets // are composed of several subwidgets and setting a style for // the widget means setting it for all subwidgets as well. // also, it is not clear which native widget is the top // widget where (most of) the input goes. even tooltips have // to be applied to all subwidgets. virtual GtkWidget* GetConnectWidget(); void ConnectWidget( GtkWidget *widget ); // Called from several event handlers, if it returns true or false, the // same value should be immediately returned by the handler without doing // anything else. If it returns -1, the handler should continue as usual int GTKCallbackCommonPrologue(struct _GdkEventAny *event) const; // override this if some events should never be consumed by wxWidgets but // but have to be left for the native control // // base version just does GetEventHandler()->ProcessEvent() virtual bool GTKProcessEvent(wxEvent& event) const; // Map GTK widget direction of the given widget to/from wxLayoutDirection static wxLayoutDirection GTKGetLayout(GtkWidget *widget); static void GTKSetLayout(GtkWidget *widget, wxLayoutDirection dir);protected: // Override GTKWidgetNeedsMnemonic and return true if your // needs to set its mnemonic widget, such as for a // GtkLabel for wxStaticText, then do the actual // setting of the widget inside GTKWidgetDoSetMnemonic virtual bool GTKWidgetNeedsMnemonic() const; virtual void GTKWidgetDoSetMnemonic(GtkWidget* w); // Get the GdkWindows making part of this window: usually there will be // only one of them in which case it should be returned directly by this // function. If there is more than one GdkWindow (can be the case for // composite widgets), return NULL and fill in the provided array
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -