00001 //------------------------------------------------------------------------ 00002 // 00003 // Joe Kniss 00004 // 9-9-03 00005 // ________ ____ ___ 00006 // | \ / | / / 00007 // +---+ \/ |/ / 00008 // +--+| |\ /| < 00009 // | || | \ / | |\ \ 00010 // | | \/ | | \ \ 00011 // \_____| |__| \__\ 00012 // Copyright 2003 00013 // Joe Michael Kniss 00014 // <<< jmk@cs.utah.edu >>> 00015 // "All Your Base are Belong to Us" 00016 //------------------------------------------------------------------------- 00017 00018 /// SurfaceContentWidget.h 00019 00020 #ifndef __SURFACE_CONTENT_WIDGET_DOT_H 00021 #define __SURFACE_CONTENT_WIDGET_DOT_H 00022 00023 #include "SurfaceWidget.h" 00024 00025 /// A concrete/composite surface widget. Designed to allow you to insert 00026 /// content "onto" a surface. This surface does not draw anything inself 00027 /// i.e. the surface, but can be "linked" to another surface that does, 00028 /// or, for instance, to the corners FrameWidget. It's job is to forward 00029 /// draw/mouse/move events on to it's children and make the children think 00030 /// they live in the space defined by the "geometric frame of reference" defined 00031 /// by the surface. 00032 00033 class SurfaceContentWidget : public SurfaceWidget { 00034 public: 00035 SurfaceContentWidget(WidgetItem *parent, float border = 0, bool drawBorder = false) 00036 : SurfaceWidget(parent, border, drawBorder) 00037 {} 00038 SurfaceContentWidget(const SurfaceContentWidget &scw) 00039 : SurfaceWidget(scw) 00040 {} 00041 00042 virtual ~SurfaceContentWidget() {} 00043 00044 ///@name Clones 00045 ///@{ 00046 SurfaceWidget *cloneSurface() const 00047 { 00048 return cloneSurfaceContent(); 00049 } 00050 virtual SurfaceContentWidget *cloneSurfaceContent() const 00051 { 00052 return new SurfaceContentWidget(*this); 00053 } 00054 00055 ///@} 00056 00057 /// object changed 00058 virtual void setChanged() 00059 { 00060 SurfaceWidget::setChanged(); 00061 for(WidgetItemSPListIter wi = _content.begin(); wi != _content.end(); ++wi) 00062 (*wi)->setChanged(); 00063 } 00064 00065 ///@name Behaviors from WidgetItem 00066 ///@{ 00067 virtual void drawDef(const gutz::RenderEvent &r); 00068 virtual bool mouseChild(WidgetItem *child, const gutz::MouseEvent &me); 00069 virtual bool moveChild(WidgetItem *child, const gutz::MouseMoveEvent &mme); 00070 ///@} 00071 00072 ///////////////////////////////////////////////////// 00073 ///@name Content 00074 /// Stuff that "lives" in the widget. 00075 /// The space that they live in is always the space defined by 00076 /// the frame widget, not world, screen, whatever space. 00077 /// The frame widget will alter the mouse, move, draw, events 00078 /// to reflect that, in such a way that the content widget 00079 /// will never know that it lives in a different space... 00080 ///@{ 00081 00082 /// add a widget to this surface 00083 void addContent(WidgetItem *cont); 00084 /// get the list of widgets contained in this one 00085 WidgetItemSPList getContent() const { return _content; } 00086 /// is a particular widget part of the content? 00087 bool isContent(WidgetItem *cont) const; 00088 /// delete a specific widget 00089 void delContent(WidgetItem *cont); 00090 /// delete all content 00091 void nukeContent(); 00092 /// clone content from another WidgetItemSPList, clones the items... 00093 void cloneContent(const WidgetItemSPList &wil); 00094 /// just copies the content into this surface 00095 void copyContent(const WidgetItemSPList &wil); 00096 00097 ///@} 00098 ///////////////////////////////////////////////////// 00099 00100 protected: 00101 00102 WidgetItemSPList _content; 00103 00104 }; 00105 00106 00107 #endif 00108 00109