Crazy Eddie's GUI System  0.8.7
Window.h
1 /***********************************************************************
2  created: 21/2/2004
3  author: Paul D Turner
4 
5  purpose: Defines abstract base class for Window objects
6 *************************************************************************/
7 /***************************************************************************
8  * Copyright (C) 2004 - 2012 Paul D Turner & The CEGUI Development Team
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  ***************************************************************************/
29 
30 #ifndef _CEGUIWindow_h_
31 #define _CEGUIWindow_h_
32 
33 #include "CEGUI/Base.h"
34 #include "CEGUI/NamedElement.h"
35 #include "CEGUI/Vector.h"
36 #include "CEGUI/Quaternion.h"
37 #include "CEGUI/Rect.h"
38 #include "CEGUI/Size.h"
39 #include "CEGUI/EventSet.h"
40 #include "CEGUI/PropertySet.h"
41 #include "CEGUI/TplWindowProperty.h"
42 #include "CEGUI/System.h"
43 #include "CEGUI/GUIContext.h"
44 #include "CEGUI/InputEvent.h"
45 #include "CEGUI/UDim.h"
46 #include "CEGUI/WindowRenderer.h"
47 #include "CEGUI/TextUtils.h"
48 #include "CEGUI/BasicRenderedStringParser.h"
49 #include "CEGUI/DefaultRenderedStringParser.h"
50 #include <vector>
51 #include <set>
52 
53 #if defined(_MSC_VER)
54 # pragma warning(push)
55 # pragma warning(disable : 4251)
56 #endif
57 
58 
59 namespace CEGUI
60 {
61 
71 {
73  WUM_ALWAYS,
75  WUM_NEVER,
78 };
79 
80 template<>
81 class PropertyHelper<WindowUpdateMode>
82 {
83 public:
84  typedef WindowUpdateMode return_type;
85  typedef return_type safe_method_return_type;
86  typedef WindowUpdateMode pass_type;
87  typedef String string_return_type;
88 
89  static const String& getDataTypeName()
90  {
91  static String type("WindowUpdateMode");
92 
93  return type;
94  }
95 
96  static return_type fromString(const String& str)
97  {
98 
99  if (str == "Always")
100  {
101  return WUM_ALWAYS;
102  }
103  else if (str == "Never")
104  {
105  return WUM_NEVER;
106  }
107  else
108  {
109  return WUM_VISIBLE;
110  }
111  }
112 
113  static string_return_type toString(pass_type val)
114  {
115  if (val == WUM_ALWAYS)
116  {
117  return "Always";
118  }
119  else if (val == WUM_NEVER)
120  {
121  return "Never";
122  }
123  else if (val == WUM_VISIBLE)
124  {
125  return "Visible";
126  }
127  else
128  {
129  assert(false && "Invalid Window Update Mode");
130  return "Always";
131  }
132  }
133 };
134 
135 
149 class CEGUIEXPORT Window :
150  public NamedElement
151 {
152 public:
153  /*************************************************************************
154  Property name constants
155  *************************************************************************/
157  static const String AlphaPropertyName;
159  static const String AlwaysOnTopPropertyName;
161  static const String ClippedByParentPropertyName;
163  static const String DestroyedByParentPropertyName;
165  static const String DisabledPropertyName;
167  static const String FontPropertyName;
169  static const String IDPropertyName;
171  static const String InheritsAlphaPropertyName;
173  static const String MouseCursorImagePropertyName;
175  static const String VisiblePropertyName;
177  static const String RestoreOldCapturePropertyName;
179  static const String TextPropertyName;
181  static const String ZOrderingEnabledPropertyName;
183  static const String WantsMultiClickEventsPropertyName;
185  static const String MouseAutoRepeatEnabledPropertyName;
187  static const String AutoRepeatDelayPropertyName;
189  static const String AutoRepeatRatePropertyName;
191  static const String DistributeCapturedInputsPropertyName;
193  static const String TooltipTypePropertyName;
195  static const String TooltipTextPropertyName;
197  static const String InheritsTooltipTextPropertyName;
199  static const String RiseOnClickEnabledPropertyName;
201  static const String MousePassThroughEnabledPropertyName;
203  static const String DragDropTargetPropertyName;
205  static const String AutoRenderingSurfacePropertyName;
207  static const String TextParsingEnabledPropertyName;
209  static const String MarginPropertyName;
211  static const String UpdateModePropertyName;
213  static const String MouseInputPropagationEnabledPropertyName;
215  static const String AutoWindowPropertyName;
216 
217  /*************************************************************************
218  Event name constants
219  *************************************************************************/
221  static const String EventNamespace;
222 
223  // generated internally by Window
227  static const String EventUpdated;
228 
233  static const String EventTextChanged;
238  static const String EventFontChanged;
243  static const String EventAlphaChanged;
248  static const String EventIDChanged;
255  static const String EventActivated;
262  static const String EventDeactivated;
267  static const String EventShown;
272  static const String EventHidden;
277  static const String EventEnabled;
283  static const String EventDisabled;
289  static const String EventClippedByParentChanged;
295  static const String EventDestroyedByParentChanged;
301  static const String EventInheritsAlphaChanged;
307  static const String EventAlwaysOnTopChanged;
312  static const String EventInputCaptureGained;
321  static const String EventInputCaptureLost;
331  static const String EventInvalidated;
339  static const String EventRenderingStarted;
347  static const String EventRenderingEnded;
352  static const String EventDestructionStarted;
360  static const String EventDragDropItemEnters;
368  static const String EventDragDropItemLeaves;
375  static const String EventDragDropItemDropped;
381  static const String EventWindowRendererAttached;
387  static const String EventWindowRendererDetached;
394  static const String EventTextParsingChanged;
400  static const String EventMarginChanged;
401 
402  // generated externally (inputs)
407  static const String EventMouseEntersArea;
412  static const String EventMouseLeavesArea;
423  static const String EventMouseEntersSurface;
434  static const String EventMouseLeavesSurface;
439  static const String EventMouseMove;
445  static const String EventMouseWheel;
450  static const String EventMouseButtonDown;
455  static const String EventMouseButtonUp;
462  static const String EventMouseClick;
468  static const String EventMouseDoubleClick;
474  static const String EventMouseTripleClick;
483  static const String EventKeyDown;
492  static const String EventKeyUp;
500  static const String EventCharacterKey;
501 
502  /*************************************************************************
503  Child Widget name suffix constants
504  *************************************************************************/
506  static const String TooltipNameSuffix;
507 
508  // XML element and attribute names that relate to Window.
509  static const String WindowXMLElementName;
510  static const String AutoWindowXMLElementName;
511  static const String UserStringXMLElementName;
512  static const String WindowTypeXMLAttributeName;
513  static const String WindowNameXMLAttributeName;
514  static const String AutoWindowNamePathXMLAttributeName;
515  static const String UserStringNameXMLAttributeName;
516  static const String UserStringValueXMLAttributeName;
517 
528  Window(const String& type, const String& name);
529 
534  virtual ~Window(void);
535 
543  const String& getType(void) const;
544 
554  bool isDestroyedByParent(void) const {return d_destroyedByParent;}
555 
565  bool isAlwaysOnTop(void) const {return d_alwaysOnTop;}
566 
579  bool isDisabled() const;
580 
593  bool isEffectiveDisabled() const;
594 
611  bool isVisible() const;
612 
629  bool isEffectiveVisible() const;
630 
645  bool isActive(void) const;
646 
656  bool isClippedByParent(void) const {return d_clippedByParent;}
657 
665  uint getID(void) const {return d_ID;}
666 
667  using NamedElement::isChild;
684  bool isChild(uint ID) const;
685 
706  bool isChildRecursive(uint ID) const;
707 
708 
723  inline Window* getChildAtIdx(size_t idx) const
724  {
725  return static_cast<Window*>(getChildElementAtIdx(idx));
726  }
727 
751  inline Window* getChild(const String& name_path) const
752  {
753  return static_cast<Window*>(getChildElement(name_path));
754  }
755 
777  inline Window* getChildRecursive(const String& name) const
778  {
779  return static_cast<Window*>(getChildElementRecursive(name));
780  }
781 
803  Window* getChild(uint ID) const;
804 
826  Window* getChildRecursive(uint ID) const;
827 
840  Window* getActiveChild(void);
841  const Window* getActiveChild(void) const;
842 
857  bool isAncestor(uint ID) const;
858 
878  const Font* getFont(bool useDefault = true) const;
879 
887  const String& getText(void) const {return d_textLogical;}
888 
890  const String& getTextVisual() const;
891 
900  bool inheritsAlpha(void) const {return d_inheritsAlpha;}
901 
919  float getAlpha(void) const {return d_alpha;}
920 
930  float getEffectiveAlpha(void) const;
931 
944  const Rectf& getOuterRectClipper() const;
945 
958  const Rectf& getInnerRectClipper() const;
959 
978  const Rectf& getClipRect(const bool non_client = false) const;
979 
990  const Rectf& getHitTestRect() const;
991 
1000  Window* getCaptureWindow() const
1001  {return getGUIContext().getInputCaptureWindow();}
1002 
1011  bool isCapturedByThis(void) const {return getCaptureWindow() == this;}
1012 
1022  bool isCapturedByAncestor(void) const
1023  {return isAncestor(getCaptureWindow());}
1024 
1033  bool isCapturedByChild(void) const {return isChild(getCaptureWindow());}
1034 
1051  virtual bool isHit(const Vector2f& position,
1052  const bool allow_disabled = false) const;
1053 
1066  Window* getChildAtPosition(const Vector2f& position) const;
1067 
1085  Window* getTargetChildAtPosition(const Vector2f& position,
1086  const bool allow_disabled = false) const;
1087 
1096  inline Window* getParent() const
1097  {
1098  return static_cast<Window*>(getParentElement());
1099  }
1100 
1115  const Image* getMouseCursor(bool useDefault = true) const;
1116 
1128  void* getUserData(void) const {return d_userData;}
1129 
1144  bool restoresOldCapture(void) const {return d_restoreOldCapture;}
1145 
1165  bool isZOrderingEnabled(void) const;
1166 
1177  bool wantsMultiClickEvents(void) const;
1178 
1190  bool isMouseAutoRepeatEnabled(void) const;
1191 
1200  float getAutoRepeatDelay(void) const;
1201 
1211  float getAutoRepeatRate(void) const;
1212 
1222  bool distributesCapturedInputs(void) const;
1223 
1233  bool isUsingDefaultTooltip(void) const;
1234 
1244  Tooltip* getTooltip(void) const;
1245 
1254  String getTooltipType(void) const;
1255 
1263  const String& getTooltipText(void) const;
1264 
1275  const String& getTooltipTextIncludingInheritance(void) const;
1276 
1288  bool inheritsTooltipText(void) const;
1289 
1310  bool isRiseOnClickEnabled(void) const { return d_riseOnClick; }
1311 
1319  GeometryBuffer& getGeometryBuffer();
1320 
1329  const String& getLookNFeel() const;
1330 
1338  bool getModalState(void) const
1339  {return(getGUIContext().getModalWindow() == this);}
1340 
1354  const String& getUserString(const String& name) const;
1355 
1367  bool isUserStringDefined(const String& name) const;
1368 
1384  Window* getActiveSibling();
1385 
1396  bool isMousePassThroughEnabled(void) const {return d_mousePassThroughEnabled;}
1397 
1405  bool isAutoWindow(void) const {return d_autoWindow;}
1406 
1411  bool isWritingXMLAllowed(void) const {return d_allowWriteXML;}
1412 
1422  bool isDragDropTarget() const;
1423 
1429  void getRenderingContext(RenderingContext& ctx) const;
1430 
1432  virtual void getRenderingContext_impl(RenderingContext& ctx) const;
1433 
1439  RenderingSurface* getRenderingSurface() const;
1440 
1446  RenderingSurface& getTargetRenderingSurface() const;
1447 
1459  bool isUsingAutoRenderingSurface() const;
1460 
1471  const Window* getRootWindow() const;
1472  Window* getRootWindow();
1473 
1485  virtual void initialiseComponents(void) {}
1486 
1500  void setDestroyedByParent(bool setting);
1501 
1514  void setAlwaysOnTop(bool setting);
1515 
1528  void setEnabled(bool setting);
1529 
1542  void setDisabled(bool setting);
1543 
1551  void enable(void) {setEnabled(true);}
1552 
1560  void disable(void) {setEnabled(false);}
1561 
1579  void setVisible(bool setting);
1580 
1593  void show(void) {setVisible(true);}
1594 
1605  void hide(void) {setVisible(false);}
1606 
1615  void activate(void);
1616 
1626  void deactivate(void);
1627 
1640  void setClippedByParent(bool setting);
1641 
1653  void setID(uint ID);
1654 
1665  void setText(const String& text);
1666 
1680  void insertText(const String& text, const String::size_type position);
1681 
1691  void appendText(const String& text);
1692 
1704  void setFont(const Font* font);
1705 
1720  void setFont(const String& name);
1721 
1736  void removeChild(uint ID);
1737 
1753  Window* createChild(const String& type, const String& name = "");
1754 
1762  void destroyChild(Window* wnd);
1763 
1771  void destroyChild(const String& name_path);
1772 
1786  void moveToFront();
1787 
1802  void moveToBack();
1803 
1817  void moveInFront(const Window* const window);
1818 
1833  void moveBehind(const Window* const window);
1834 
1847  size_t getZIndex() const;
1848 
1858  bool isInFront(const Window& wnd) const;
1859 
1869  bool isBehind(const Window& wnd) const;
1870 
1880  bool captureInput(void);
1881 
1890  void releaseInput(void);
1891 
1910  void setRestoreOldCapture(bool setting);
1911 
1932  void setAlpha(const float alpha);
1933 
1945  void setInheritsAlpha(bool setting);
1946 
1958  void invalidate(void);
1959 
1975  void invalidate(const bool recursive);
1976 
1988  void setMouseCursor(const Image* image);
1989 
2007  void setMouseCursor(const String& name);
2008 
2023  void setUserData(void* user_data) {d_userData = user_data;}
2024 
2047  void setZOrderingEnabled(bool setting);
2048 
2062  void setWantsMultiClickEvents(bool setting);
2063 
2076  void setMouseAutoRepeatEnabled(bool setting);
2077 
2089  void setAutoRepeatDelay(float delay);
2090 
2103  void setAutoRepeatRate(float rate);
2104 
2114  void setDistributesCapturedInputs(bool setting);
2115 
2121  void notifyDragDropItemEnters(DragContainer* item);
2122 
2128  void notifyDragDropItemLeaves(DragContainer* item);
2129 
2135  void notifyDragDropItemDropped(DragContainer* item);
2136 
2150  virtual void destroy(void);
2151 
2167  void setTooltip(Tooltip* tooltip);
2168 
2187  void setTooltipType(const String& tooltipType);
2188 
2200  void setTooltipText(const String& tip);
2201 
2216  void setInheritsTooltipText(bool setting);
2217 
2241  void setRiseOnClickEnabled(bool setting) { d_riseOnClick = setting; }
2242 
2274  virtual void setLookNFeel(const String& look);
2275 
2289  void setModalState(bool state);
2290 
2320  virtual void performChildWindowLayout(bool nonclient_sized_hint = false,
2321  bool client_sized_hint = false);
2322 
2336  void setUserString(const String& name, const String& value);
2337 
2346  void render();
2347 
2366  virtual void update(float elapsed);
2367 
2378  virtual bool performCopy(Clipboard& clipboard);
2379 
2390  virtual bool performCut(Clipboard& clipboard);
2391 
2402  virtual bool performPaste(Clipboard& clipboard);
2403 
2414  virtual void writeXMLToStream(XMLSerializer& xml_stream) const;
2415 
2424  virtual void beginInitialisation(void) {d_initialising = true;}
2425 
2433  virtual void endInitialisation(void) {d_initialising = false;}
2434 
2445  void setMousePassThroughEnabled(bool setting) {d_mousePassThroughEnabled = setting;}
2446 
2461  void setWindowRenderer(const String& name);
2462 
2471  WindowRenderer* getWindowRenderer(void) const;
2472 
2482  const String& getWindowRendererName() const;
2483 
2488  void setWritingXMLAllowed(bool allow) {d_allowWriteXML = allow;}
2489 
2500  virtual void notifyScreenAreaChanged(bool recursive = true);
2501 
2513  void setFalagardType(const String& type, const String& rendererType = "");
2524  void setDragDropTarget(bool setting);
2525 
2546  void setRenderingSurface(RenderingSurface* surface);
2547 
2554  void invalidateRenderingSurface();
2555 
2597  void setUsingAutoRenderingSurface(bool setting);
2598 
2600  const RenderedString& getRenderedString() const;
2602  RenderedStringParser* getCustomRenderedStringParser() const;
2604  void setCustomRenderedStringParser(RenderedStringParser* parser);
2606  virtual RenderedStringParser& getRenderedStringParser() const;
2608  bool isTextParsingEnabled() const;
2610  void setTextParsingEnabled(const bool setting);
2611 
2613  virtual void setMargin(const UBox& margin);
2615  const UBox& getMargin() const;
2616 
2618  Vector2f getUnprojectedPosition(const Vector2f& pos) const;
2619 
2621  const BidiVisualMapping* getBidiVisualMapping() const
2622  {return d_bidiVisualMapping;}
2623 
2636  void banPropertyFromXML(const String& property_name);
2637 
2650  void banPropertyFromXMLRecursive(const String& property_name);
2651 
2663  void unbanPropertyFromXML(const String& property_name);
2664 
2676  void unbanPropertyFromXMLRecursive(const String& property_name);
2677 
2678 
2687  bool isPropertyBannedFromXML(const String& property_name) const;
2688 
2690  void banPropertyFromXML(const Property* property);
2691 
2693  void unbanPropertyFromXML(const Property* property);
2694 
2703  bool isPropertyBannedFromXML(const Property* property) const;
2704 
2722  void setUpdateMode(const WindowUpdateMode mode);
2723 
2741  WindowUpdateMode getUpdateMode() const;
2742 
2753  void setMouseInputPropagationEnabled(const bool enabled);
2754 
2765  bool isMouseInputPropagationEnabled() const;
2766 
2777  Window* clone(const bool deepCopy = true) const;
2778 
2780  virtual void clonePropertiesTo(Window& target) const;
2782  virtual void cloneChildWidgetsTo(Window& target) const;
2783 
2785  GUIContext& getGUIContext() const;
2787  void setGUIContext(GUIContext* context);
2788 
2790  void syncTargetSurface();
2791 
2799  void setAutoWindow(bool is_auto);
2800 
2811  bool isMouseContainedInArea() const;
2812 
2813  // overridden from Element
2814  const Sizef& getRootContainerSize() const;
2815 
2816 protected:
2817  // friend classes for construction / initialisation purposes (for now)
2818  friend class System;
2819  friend class WindowManager;
2820  friend class GUIContext;
2821 
2822  /*************************************************************************
2823  Event trigger methods
2824  *************************************************************************/
2834  virtual void onSized(ElementEventArgs& e);
2835 
2845  virtual void onMoved(ElementEventArgs& e);
2846 
2847  virtual void onRotated(ElementEventArgs& e);
2848 
2858  virtual void onTextChanged(WindowEventArgs& e);
2859 
2869  virtual void onFontChanged(WindowEventArgs& e);
2870 
2880  virtual void onAlphaChanged(WindowEventArgs& e);
2881 
2891  virtual void onIDChanged(WindowEventArgs& e);
2892 
2902  virtual void onShown(WindowEventArgs& e);
2903 
2913  virtual void onHidden(WindowEventArgs& e);
2914 
2924  virtual void onEnabled(WindowEventArgs& e);
2925 
2935  virtual void onDisabled(WindowEventArgs& e);
2936 
2947  virtual void onClippingChanged(WindowEventArgs& e);
2948 
2959  virtual void onParentDestroyChanged(WindowEventArgs& e);
2960 
2971  virtual void onInheritsAlphaChanged(WindowEventArgs& e);
2972 
2982  virtual void onAlwaysOnTopChanged(WindowEventArgs& e);
2983 
2993  virtual void onCaptureGained(WindowEventArgs& e);
2994 
3004  virtual void onCaptureLost(WindowEventArgs& e);
3005 
3015  virtual void onInvalidated(WindowEventArgs& e);
3016 
3026  virtual void onRenderingStarted(WindowEventArgs& e);
3027 
3037  virtual void onRenderingEnded(WindowEventArgs& e);
3038 
3048  virtual void onZChanged(WindowEventArgs& e);
3049 
3059  virtual void onDestructionStarted(WindowEventArgs& e);
3060 
3069  virtual void onActivated(ActivationEventArgs& e);
3070 
3080  virtual void onDeactivated(ActivationEventArgs& e);
3081 
3093  virtual void onParentSized(ElementEventArgs& e);
3094 
3103  virtual void onChildAdded(ElementEventArgs& e);
3104 
3113  virtual void onChildRemoved(ElementEventArgs& e);
3114 
3122  virtual void onMouseEntersArea(MouseEventArgs& e);
3123 
3131  virtual void onMouseLeavesArea(MouseEventArgs& e);
3132 
3147  virtual void onMouseEnters(MouseEventArgs& e);
3148 
3163  virtual void onMouseLeaves(MouseEventArgs& e);
3164 
3173  virtual void onMouseMove(MouseEventArgs& e);
3174 
3183  virtual void onMouseWheel(MouseEventArgs& e);
3184 
3193  virtual void onMouseButtonDown(MouseEventArgs& e);
3194 
3203  virtual void onMouseButtonUp(MouseEventArgs& e);
3204 
3213  virtual void onMouseClicked(MouseEventArgs& e);
3214 
3223  virtual void onMouseDoubleClicked(MouseEventArgs& e);
3224 
3233  virtual void onMouseTripleClicked(MouseEventArgs& e);
3234 
3246  virtual void onKeyDown(KeyEventArgs& e);
3247 
3259  virtual void onKeyUp(KeyEventArgs& e);
3260 
3272  virtual void onCharacter(KeyEventArgs& e);
3273 
3284  virtual void onDragDropItemEnters(DragDropEventArgs& e);
3285 
3296  virtual void onDragDropItemLeaves(DragDropEventArgs& e);
3297 
3308  virtual void onDragDropItemDropped(DragDropEventArgs& e);
3309 
3319  virtual void onWindowRendererAttached(WindowEventArgs& e);
3320 
3330  virtual void onWindowRendererDetached(WindowEventArgs& e);
3331 
3342  virtual void onTextParsingChanged(WindowEventArgs& e);
3343 
3344  virtual void onMarginChanged(WindowEventArgs& e);
3345 
3346  /*************************************************************************
3347  Implementation Functions
3348  *************************************************************************/
3360  virtual void updateSelf(float elapsed);
3361 
3373  virtual void drawSelf(const RenderingContext& ctx);
3374 
3385  void bufferGeometry(const RenderingContext& ctx);
3386 
3397  void queueGeometry(const RenderingContext& ctx);
3398 
3405  virtual void populateGeometryBuffer() {}
3406 
3418  virtual void setParent(Element* parent);
3419 
3424  void generateAutoRepeatEvent(MouseButton button);
3425 
3437  virtual bool validateWindowRenderer(const WindowRenderer* renderer) const;
3438 
3445  bool isPropertyAtDefault(const Property* property) const;
3446 
3452  void notifyClippingChanged(void);
3453 
3455  void allocateRenderingWindow();
3456 
3458  void releaseRenderingWindow();
3459 
3461  void initialiseClippers(const RenderingContext& ctx);
3462 
3464  virtual void setArea_impl(const UVector2& pos, const USize& size, bool topLeftSizing = false, bool fireEvents = true);
3465 
3470  virtual void cleanupChildren(void);
3471 
3475  virtual void addChild_impl(Element* element);
3476 
3480  virtual void removeChild_impl(Element* element);
3481 
3486  virtual void onZChange_impl(void);
3487 
3492  void addWindowProperties(void);
3493 
3502  virtual bool moveToFront_impl(bool wasClicked);
3503 
3523  void addWindowToDrawList(Window& wnd, bool at_back = false);
3524 
3536  void removeWindowFromDrawList(const Window& wnd);
3537 
3549  bool isTopOfZOrder() const;
3550 
3556  void updateGeometryRenderSettings();
3557 
3559  void transferChildSurfaces();
3560 
3562  Rectf getParentElementClipIntersection(const Rectf& unclipped_area) const;
3563 
3565  void invalidate_impl(const bool recursive);
3566 
3573  const Window* getWindowAttachedToCommonAncestor(const Window& wnd) const;
3574 
3575  virtual Rectf getUnclippedInnerRect_impl(bool skipAllPixelAlignment) const;
3577  virtual Rectf getOuterRectClipper_impl() const;
3579  virtual Rectf getInnerRectClipper_impl() const;
3581  virtual Rectf getHitTestRect_impl() const;
3582 
3583  virtual int writePropertiesXML(XMLSerializer& xml_stream) const;
3584  virtual int writeChildWindowsXML(XMLSerializer& xml_stream) const;
3585  virtual bool writeAutoChildWindowXML(XMLSerializer& xml_stream) const;
3586 
3587  virtual void banPropertiesForAutoWindow();
3588 
3590  virtual bool handleFontRenderSizeChange(const EventArgs& args);
3591 
3592  // mark the rect caches defined on Window invalid (does not affect Element)
3593  void markCachedWindowRectsInvalid();
3594  void layoutLookNFeelChildWidgets();
3595 
3596  Window* getChildAtPosition(const Vector2f& position,
3597  bool (Window::*hittestfunc)(const Vector2f&, bool) const,
3598  bool allow_disabled = false) const;
3599 
3600  bool isHitTargetWindow(const Vector2f& position, bool allow_disabled) const;
3601 
3602  /*************************************************************************
3603  Properties for Window base class
3604  *************************************************************************/
3605 
3617  static
3618  class WindowRendererProperty : public TplWindowProperty<Window, String>
3619  {
3620  public:
3621  WindowRendererProperty();
3622  void writeXMLToStream(const PropertyReceiver* receiver,
3623  XMLSerializer& xml_stream) const;
3624  } d_windowRendererProperty;
3625 
3637  static
3638  class LookNFeelProperty : public TplWindowProperty<Window, String>
3639  {
3640  public:
3641  LookNFeelProperty();
3642  void writeXMLToStream(const PropertyReceiver* receiver,
3643  XMLSerializer& xml_stream) const;
3644  } d_lookNFeelProperty;
3645 
3646  /*************************************************************************
3647  Implementation Data
3648  *************************************************************************/
3650  typedef std::vector<Window*
3651  CEGUI_VECTOR_ALLOC(Window*)> ChildDrawList;
3653  typedef std::map<String, String, StringFastLessCompare
3654  CEGUI_MAP_ALLOC(String, String)> UserStringMap;
3656  typedef std::set<String, StringFastLessCompare
3657  CEGUI_SET_ALLOC(String)> BannedXMLPropertySet;
3658 
3660  const String d_type;
3662  String d_falagardType;
3664  bool d_autoWindow;
3665 
3667  bool d_initialising;
3669  bool d_destructionStarted;
3671  bool d_enabled;
3673  bool d_visible;
3675  bool d_active;
3676 
3678  ChildDrawList d_drawList;
3680  bool d_destroyedByParent;
3681 
3683  bool d_clippedByParent;
3684 
3686  String d_lookName;
3688  WindowRenderer* d_windowRenderer;
3690  GeometryBuffer* d_geometry;
3692  RenderingSurface* d_surface;
3694  mutable bool d_needsRedraw;
3696  bool d_autoRenderingWindow;
3699  const Image* d_mouseCursor;
3700 
3702  float d_alpha;
3704  bool d_inheritsAlpha;
3705 
3707  Window* d_oldCapture;
3709  bool d_restoreOldCapture;
3711  bool d_distCapturedInputs;
3714  const Font* d_font;
3716  String d_textLogical;
3718  BidiVisualMapping* d_bidiVisualMapping;
3720  mutable bool d_bidiDataValid;
3722  mutable RenderedString d_renderedString;
3724  mutable bool d_renderedStringValid;
3726  static BasicRenderedStringParser d_basicStringParser;
3728  static DefaultRenderedStringParser d_defaultStringParser;
3730  RenderedStringParser* d_customStringParser;
3732  bool d_textParsingEnabled;
3735  UBox d_margin;
3736 
3738  uint d_ID;
3740  void* d_userData;
3742  UserStringMap d_userStrings;
3743 
3745  bool d_alwaysOnTop;
3747  bool d_riseOnClick;
3749  bool d_zOrderingEnabled;
3752  bool d_wantsMultiClicks;
3754  bool d_mousePassThroughEnabled;
3756  bool d_autoRepeat;
3758  float d_repeatDelay;
3760  float d_repeatRate;
3762  MouseButton d_repeatButton;
3764  bool d_repeating;
3766  float d_repeatElapsed;
3767 
3769  bool d_dragDropTarget;
3770 
3772  String d_tooltipText;
3774  Tooltip* d_customTip;
3776  bool d_weOwnTip;
3778  bool d_inheritsTipText;
3779 
3781  bool d_allowWriteXML;
3783  BannedXMLPropertySet d_bannedXMLProperties;
3786  mutable Rectf d_outerRectClipper;
3788  mutable Rectf d_innerRectClipper;
3790  mutable Rectf d_hitTestRect;
3791 
3792  mutable bool d_outerRectClipperValid;
3793  mutable bool d_innerRectClipperValid;
3794  mutable bool d_hitTestRectValid;
3797  WindowUpdateMode d_updateMode;
3800  bool d_propagateMouseInputs;
3801 
3803  GUIContext* d_guiContext;
3806  bool d_containsMouse;
3808 private:
3809  /*************************************************************************
3810  May not copy or assign Window objects
3811  *************************************************************************/
3813  Window& operator=(const Window&) {return *this;}
3816  const Font* property_getFont() const;
3818  const Image* property_getMouseCursor() const;
3819 
3821  Event::ScopedConnection d_fontRenderSizeChangeConnection;
3822 };
3824 } // End of CEGUI namespace section
3825 
3827 #if defined(_MSC_VER)
3828 # pragma warning(pop)
3829 #endif
3830 
3831 #endif // end of guard _CEGUIWindow_h_
CEGUI::GeometryBuffer
Abstract class defining the interface for objects that buffer geometry for later rendering.
Definition: GeometryBuffer.h:66
CEGUI::Font
Class that encapsulates a typeface.
Definition: Font.h:82
CEGUI::Window::BannedXMLPropertySet
std::set< String, StringFastLessCompare CEGUI_SET_ALLOC(String)> BannedXMLPropertySet
definition of type used to track properties banned from writing XML.
Definition: Window.h:3683
CEGUI::Event::ScopedConnection
Event::Connection wrapper that automatically disconnects the connection when the object is deleted (o...
Definition: Event.h:139
CEGUI::Tooltip
Base class for Tooltip widgets.
Definition: widgets/Tooltip.h:103
CEGUI::StringFastLessCompare
Functor that can be used as comparator in a std::map with String keys. It's faster than using the def...
Definition: String.h:5605
CEGUI::WindowUpdateMode
WindowUpdateMode
Enumerated type used for specifying Window::update mode to be used. Note that the setting specified w...
Definition: Window.h:96
CEGUI::WUM_NEVER
@ WUM_NEVER
Never call the Window::update function for this window.
Definition: Window.h:127
CEGUI::RenderingSurface
Class that represents a surface that can have geometry based imagery drawn to it.
Definition: RenderingSurface.h:132
CEGUI::ElementEventArgs
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: Element.h:237
CEGUI::RenderingContext
struct that holds some context relating to a RenderingSurface object.
Definition: RenderingContext.h:63
CEGUI::NamedElement::isChild
bool isChild(const String &name_path) const
Checks whether given name path references a NamedElement that is attached to this Element.
CEGUI::DragDropEventArgs
EventArgs based class used for certain drag/drop notifications.
Definition: InputEvent.h:367
CEGUI
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
CEGUI::RenderedString
Class representing a rendered string of entities.
Definition: RenderedString.h:74
CEGUI::MouseEventArgs
EventArgs based class that is used for objects passed to input event handlers concerning mouse input.
Definition: InputEvent.h:306
CEGUI::Vector2< float >
CEGUI::WindowEventArgs
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: InputEvent.h:277
CEGUI::BidiVisualMapping
Abstract class to wrap a Bidi visual mapping of a text string.
Definition: BidiVisualMapping.h:74
CEGUI::Window::UserStringMap
std::map< String, String, StringFastLessCompare CEGUI_MAP_ALLOC(String, String)> UserStringMap
definition of type used for the UserString dictionary.
Definition: Window.h:3680
CEGUI::String::size_type
size_t size_type
Unsigned type used for size values and indices.
Definition: String.h:96
CEGUI::KeyEventArgs
EventArgs based class that is used for objects passed to input event handlers concerning keyboard inp...
Definition: InputEvent.h:340
CEGUI::Window::ChildDrawList
std::vector< Window *CEGUI_VECTOR_ALLOC(Window *)> ChildDrawList
definition of type used for the list of child windows to be drawn
Definition: Window.h:3677
CEGUI::ActivationEventArgs
EventArgs based class that is used for Activated and Deactivated window events.
Definition: InputEvent.h:355
CEGUI::UBox
Class encapsulating the 'Unified Box' - this is usually used for margin.
Definition: UDim.h:247
CEGUI::Window
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:175
CEGUI::RenderedStringParser
Specifies interface for classes that parse text into RenderedString objects.
Definition: RenderedStringParser.h:61
CEGUI::NamedElement::removeChild
void removeChild(const String &name_path)
Remove the Element referenced by the given name path from this Element's child list.
CEGUI::WUM_ALWAYS
@ WUM_ALWAYS
Always call the Window::update function for this window.
Definition: Window.h:125
CEGUI::WindowRenderer
Base-class for the assignable WindowRenderer object.
Definition: WindowRenderer.h:76
CEGUI::NamedElement::isAncestor
bool isAncestor(const String &name) const
Return true if the specified element name is a name of some ancestor of this Element.
CEGUI::Size< float >
CEGUI::GUIContext
Definition: GUIContext.h:92
CEGUI::System
The System class is the CEGUI class that provides access to all other elements in this system.
Definition: System.h:91
CEGUI::String
String class used within the GUI system.
Definition: String.h:88
CEGUI::Property
An abstract class that defines the interface to access object properties by name.
Definition: Property.h:87
CEGUI::MouseButton
MouseButton
Enumeration of mouse buttons.
Definition: InputEvent.h:235
CEGUI::DefaultRenderedStringParser
Effectively a 'null' parser that returns a RenderedString representation that will draw the input tex...
Definition: DefaultRenderedStringParser.h:64
CEGUI::WindowManager
The WindowManager class describes an object that manages creation and lifetime of Window objects.
Definition: WindowManager.h:86
CEGUI::Rect< float >
CEGUI::BasicRenderedStringParser
Basic RenderedStringParser class that offers support for the following tags:
Definition: BasicRenderedStringParser.h:88
CEGUI::Image
Interface for Image.
Definition: Image.h:182
CEGUI::NamedElement
Adds name to the Element class, including name path traversal.
Definition: NamedElement.h:100
CEGUI::WUM_VISIBLE
@ WUM_VISIBLE
Only call the Window::update function for this window if it is visible.
Definition: Window.h:129