arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

SurfaceContentWidget.cpp

Go to the documentation of this file.
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.cpp
00019 
00020 
00021 #include "SurfaceContentWidget.h"
00022 #include <algorithm>
00023 
00024 using namespace std;
00025 
00026 void SurfaceContentWidget::drawDef(const gutz::RenderEvent &r)
00027 {
00028    for(WidgetItemSPListIter wili = _content.begin(); wili != _content.end(); ++wili)
00029    {
00030       (*wili)->draw(r);
00031    }
00032 }
00033 
00034 ///////////////////////////////////////////////////////////////////////////
00035 // mouse child
00036 ///////////////////////////////////////////////////////////////////////////
00037 bool SurfaceContentWidget::mouseChild(WidgetItem *child, const gutz::MouseEvent &me)
00038 {
00039 
00040    return false;
00041 }
00042 
00043 ///////////////////////////////////////////////////////////////////////////
00044 // move child
00045 ///////////////////////////////////////////////////////////////////////////
00046 bool SurfaceContentWidget::moveChild(WidgetItem *child, const gutz::MouseMoveEvent &mme)
00047 {
00048 
00049    return false;
00050 }
00051 
00052 ///////////////////////////////////////////////////////////////////////////
00053 // Content interface
00054 ///////////////////////////////////////////////////////////////////////////
00055 
00056 //addContent
00057 void SurfaceContentWidget::addContent(WidgetItem *cont)
00058 {
00059    if(!cont) return;
00060 
00061    cont->setParent(this);
00062    _content.push_back(cont);
00063 }
00064 
00065 //isContent
00066 bool SurfaceContentWidget::isContent(WidgetItem *cont) const
00067 {
00068    if( find(_content.begin(), _content.end(), cont) != _content.end() )
00069       return true;
00070    return false;
00071 }
00072 
00073 //delContent
00074 void SurfaceContentWidget::delContent(WidgetItem *cont)
00075 {
00076    if(!cont) return;
00077 
00078    cont->setParent(0);
00079 
00080    WidgetItemSPListIter wili = find(_content.begin(), _content.end(), cont);
00081    if( wili != _content.end() )
00082       _content.erase(wili);
00083 }
00084 
00085 //nukeContent
00086 void SurfaceContentWidget::nukeContent()
00087 {
00088    for(WidgetItemSPListIter wili = _content.begin(); wili != _content.end(); ++wili)
00089    {
00090       (*wili)->setParent(0);
00091    }
00092    _content = WidgetItemSPList();
00093 }
00094 
00095 // cloneContent from another WidgetItemSPList, clones the items...
00096 void SurfaceContentWidget::cloneContent(const WidgetItemSPList &wil)
00097 {
00098    for(WidgetItemSPListCIter wili = wil.begin(); wili != wil.end(); ++wili)
00099    {
00100       if(!(*wili)) continue;
00101       WidgetItemSP cont = (*wili)->clone();
00102       cont->setParent(this);
00103       _content.push_back(cont);
00104    }
00105 }
00106 
00107 // copyContent into this surface
00108 void SurfaceContentWidget::copyContent(const WidgetItemSPList  &wil)
00109 {
00110   for(WidgetItemSPListCIter wili = wil.begin(); wili != wil.end(); ++wili)
00111    {
00112       if(!(*wili)) continue;
00113       WidgetItemSP cont = (*wili);
00114       cont->setParent(this);
00115       _content.push_back((*wili));
00116    }
00117 }
00118 

Send questions, comments, and bug reports to:
jmk