- ////////////////////////////////////////////////////////////////////////
- //// IMPLEMENTATION
-
- // For implementation purposes - sometimes decorations make the client area
- // smaller
- virtual wxPoint GetClientAreaOrigin() const;
-
- // Makes an adjustment to the window position (for example, a frame that has
- // a toolbar that it manages itself).
- virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags);
-
- // Executes the default message
- virtual long Default();
-
-/* TODO: you may need something like this
- // Determine whether 3D effects are wanted
- virtual WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D);
-*/
-
- virtual void AddChild(wxWindow *child); // Adds reference to the child object
- virtual void RemoveChild(wxWindow *child); // Removes reference to child
- // (but doesn't delete the child object)
- virtual void DestroyChildren(); // Removes and destroys all children
-
- inline bool IsBeingDeleted() const { return FALSE; } // TODO: Should probably eliminate this
-
- // Constraint implementation
- void UnsetConstraints(wxLayoutConstraints *c);
- inline wxList *GetConstraintsInvolvedIn() const ;
- // Back-pointer to other windows we're involved with, so if we delete
- // this window, we must delete any constraints we're involved with.
- void AddConstraintReference(wxWindow *otherWin);
- void RemoveConstraintReference(wxWindow *otherWin);
- void DeleteRelatedConstraints();
-
- virtual void ResetConstraints();
- virtual void SetConstraintSizes(bool recurse = TRUE);
- virtual bool LayoutPhase1(int *noChanges);
- virtual bool LayoutPhase2(int *noChanges);
- virtual bool DoPhase(int);
- // Transforms from sizer coordinate space to actual
- // parent coordinate space
- virtual void TransformSizerToActual(int *x, int *y) const ;
-
- // Set size with transformation to actual coordinates if nec.
- virtual void SizerSetSize(int x, int y, int w, int h);
- virtual void SizerMove(int x, int y);
-
- // Only set/get the size/position of the constraint (if any)
- virtual void SetSizeConstraint(int x, int y, int w, int h);
- virtual void MoveConstraint(int x, int y);
- virtual void GetSizeConstraint(int *w, int *h) const ;
- virtual void GetClientSizeConstraint(int *w, int *h) const ;
- virtual void GetPositionConstraint(int *x, int *y) const ;
-
- // Dialog units translations. Implemented in wincmn.cpp.
- wxPoint ConvertPixelsToDialog(const wxPoint& pt) ;
- wxPoint ConvertDialogToPixels(const wxPoint& pt) ;
- inline wxSize ConvertPixelsToDialog(const wxSize& sz)
- { wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
- inline wxSize ConvertDialogToPixels(const wxSize& sz)
- { wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
-
- wxObject *GetChild(int number) const ;
-
- // Generates a new id for controls
- static int NewControlId();
-
- // Responds to colour changes: passes event on to children.
- void OnSysColourChanged(wxSysColourChangedEvent& event);
-
- // Transfers data to any child controls
- void OnInitDialog(wxInitDialogEvent& event);
-
- // Sends an OnInitDialog event, which in turns transfers data to
- // to the window via validators.
- virtual void InitDialog();
-
- /// 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
- void CanvasSetClientSize(int width, int size);
- void CanvasSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
-
- // Gives window a chance to do something in response to a size
- // message, e.g. arrange status bar, toolbar etc.
- virtual bool PreResize() { return TRUE; }
-
- // Get main widget for this window, e.g. a text widget
- virtual WXWidget GetMainWidget() const;
- // 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)
- virtual WXWidget GetClientWidget() const;
- // Get the top widget for this window, e.g. the scrolled widget parent
- // of a multi-line text widget. Top means, top in the window hierarchy
- // that implements this window.
- virtual WXWidget GetTopWidget() const;
- virtual void SetMainWidget(WXWidget w) { m_mainWidget = w; }
- bool CanAddEventHandler() const { return m_canAddEventHandler; }
- void SetCanAddEventHandler(bool flag) { m_canAddEventHandler = flag; }
-
- // Get the underlying X window and display
- virtual WXWindow GetXWindow() const;
- virtual WXDisplay *GetXDisplay() const;
-
- virtual WXPixmap GetBackingPixmap() const { return m_backingPixmap; }
- inline int GetPixmapWidth() const { return m_pixmapWidth; }
- inline int GetPixmapHeight() const { return m_pixmapHeight; }
-
- // Change properties
- 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,
- WXWidget formWidget, int x, int y, int width, int height);
- bool DetachWidget(WXWidget widget);
-
- // 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:
- int m_windowId;
- 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)
- wxWindow * m_sizerParent; // Window's parent sizer (if any)
- bool m_autoLayout; // Whether to call Layout() in OnSize
- wxWindow * m_windowParent; // Each window always knows its parent
- wxValidator * m_windowValidator;
- int m_minSizeX;
- int m_minSizeY;
- int m_maxSizeX;
- int m_maxSizeY;
-
- // Caret data
- int m_caretWidth;
- int m_caretHeight;
- bool m_caretEnabled;
- bool m_caretShown;
- wxFont m_windowFont; // Window's font
- wxCursor m_windowCursor; // Window's cursor
- wxString m_windowName; // Window name
-
- wxButton * m_defaultItem;
-
- wxColour m_backgroundColour ;
- wxColour m_foregroundColour ;
- wxAcceleratorTable m_acceleratorTable;
- wxClientData* m_clientObject;
- void* m_clientData;