]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/motif/window.h
no message
[wxWidgets.git] / include / wx / motif / window.h
index 80a794fa4310af6376546e41fe76ebe14f392e50..06f9f56d99a16f82fe7d0dfb191636189d24d57b 100644 (file)
@@ -81,6 +81,33 @@ 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;
+};
+
 class WXDLLEXPORT wxWindow: public wxEvtHandler
 {
   DECLARE_ABSTRACT_CLASS(wxWindow)
@@ -204,7 +231,7 @@ public:
   virtual void DragAcceptFiles(bool accept);
 
   // Update region access
-  virtual wxRegion GetUpdateRegion() const;
+  virtual wxRegion& GetUpdateRegion() const;
   virtual bool IsExposed(int x, int y, int w, int h) const;
   virtual bool IsExposed(const wxPoint& pt) const;
   virtual bool IsExposed(const wxRect& rect) const;
@@ -279,6 +306,12 @@ public:
   void SetValidator(const wxValidator& validator);
   inline wxValidator *GetValidator() const;
 
+  virtual void SetClientObject( wxClientData *data );
+  virtual wxClientData *GetClientObject();
+    
+  virtual void SetClientData( void *data );
+  virtual void *GetClientData();
+  
   // Set/get the window's style
   inline void SetWindowStyleFlag(long flag);
   inline long GetWindowStyleFlag() const;
@@ -311,11 +344,11 @@ public:
   void SetConstraints(wxLayoutConstraints *c);
 
   // Set/get window background colour
-  inline virtual void SetBackgroundColour(const wxColour& col);
+  virtual void SetBackgroundColour(const wxColour& col);
   inline virtual wxColour GetBackgroundColour() const;
 
   // Set/get window foreground colour
-  inline virtual void SetForegroundColour(const wxColour& col);
+  virtual void SetForegroundColour(const wxColour& col);
   inline virtual wxColour GetForegroundColour() const;
 
   // Get the default button, if there is one
@@ -369,7 +402,7 @@ public:
   // Does this window want to accept keyboard focus?
   virtual bool AcceptsFocus() const;
 
-  virtual void PrepareDC( wxDC &dc ) {};
+  virtual void PrepareDC( wxDC & WXUNUSED(dc) ) {};
 
 
 public:
@@ -453,6 +486,7 @@ public:
 
   /// Motif-specific
 
+  void ClearUpdateRects();
   void CanvasGetSize(int* width, int* height) const; // If have drawing area
   void CanvasGetClientSize(int *width, int *height) const;
   void CanvasGetPosition(int *x, int *y) const; // If have drawing area
@@ -465,7 +499,7 @@ public:
 
   // Get main widget for this window, e.g. a text widget
   virtual WXWidget GetMainWidget() const;
-  // Get the widget that supports font setting
+  // Get the widget that corresponds to the label (for font setting, label setting etc.)
   virtual WXWidget GetLabelWidget() const { return GetMainWidget(); }
   // Get the client widget for this window (something we can
   // create other windows on)
@@ -485,11 +519,17 @@ public:
   virtual WXPixmap GetBackingPixmap() const { return m_backingPixmap; }
   inline int GetPixmapWidth() const { return m_pixmapWidth; }
   inline int GetPixmapHeight() const { return m_pixmapHeight; }
-  virtual WXRegion GetPaintRegion() const { return m_paintRegion; }
 
   // Change properties
-  virtual void ChangeColour(WXWidget widget);
-  virtual void ChangeFont(WXWidget widget);
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);             // Change to the current font (often overridden)
+  virtual void DoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
+  virtual void DoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
+  // These to be overridden as needed (may change several widgets)
+  virtual void ChangeBackgroundColour(); // Change background and foreground colour using current
+                                         // background colour setting (Motif generates
+                                         // foreground based on background)
+  virtual void ChangeForegroundColour(); // Change foreground colour using current
+                                         // foreground colour setting
 
   // Adds the widget to the hash table and adds event handlers.
   bool AttachWidget (wxWindow* parent, WXWidget mainWidget,
@@ -499,6 +539,20 @@ public:
   // Generates a paint event
   virtual void DoPaint();
 
+  // How to implement accelerators. If we find a key event,
+  // translate to wxWindows wxKeyEvent form. Find a widget for the window.
+  // Now find a wxWindow for the widget. If there isn't one, go up the widget hierarchy
+  // trying to find one. Once one is found, call ProcessAccelerator for the
+  // window. If it returns TRUE (processed the event), skip the X event,
+  // otherwise carry on up the wxWindows window hierarchy calling ProcessAccelerator.
+  // If all return FALSE, process the X event as normal.
+  // Eventually we can implement OnCharHook the same way, but concentrate on accelerators
+  // for now.
+  // ProcessAccelerator must look at the current accelerator table, and try to find
+  // what menu id or window (beneath it) has this ID. Then construct an appropriate command
+  // event and send it.
+  virtual bool ProcessAccelerator(wxKeyEvent& event);
+
   ////////////////////////////////////////////////////////////////////////
   //// PROTECTED DATA
 protected:
@@ -531,6 +585,8 @@ protected:
   wxColour              m_backgroundColour ;
   wxColour              m_foregroundColour ;
   wxAcceleratorTable    m_acceleratorTable;
+  wxClientData*         m_clientObject;
+  void*                 m_clientData;
 
 #if wxUSE_DRAG_AND_DROP
   wxDropTarget         *m_pDropTarget;    // the current drop target or NULL
@@ -552,7 +608,6 @@ public:
   int                   m_lastButton;  // last pressed button
   wxList                m_updateRects;     // List of wxRectangles representing damaged region
   bool                  m_isShown;
-  WXRegion              m_paintRegion; // Clip region generated by expose event
 protected:
   WXWidget              m_mainWidget;
   WXWidget              m_hScrollBar;
@@ -595,9 +650,7 @@ inline wxEvtHandler *wxWindow::GetEventHandler() const { return m_windowEventHan
 inline void wxWindow::SetAutoLayout(bool a) { m_autoLayout = a; }
 inline bool wxWindow::GetAutoLayout() const { return m_autoLayout; }
 inline wxLayoutConstraints *wxWindow::GetConstraints() const { return m_constraints; }
-inline void wxWindow::SetBackgroundColour(const wxColour& col) { m_backgroundColour = col; };
 inline wxColour wxWindow::GetBackgroundColour() const { return m_backgroundColour; };
-inline void wxWindow::SetForegroundColour(const wxColour& col) { m_foregroundColour = col; };
 inline wxColour wxWindow::GetForegroundColour() const { return m_foregroundColour; };
 
 inline wxButton *wxWindow::GetDefaultItem() const { return m_defaultItem; }