CMS 3D CMS Logo

IgQtTreeRep Class Reference

#include <Iguana/Studio/interface/IgQtTreeRep.h>

Inheritance diagram for IgQtTreeRep:

IgRep

List of all members.

Public Member Functions

void bold (bool value)
bool bold (void) const
virtual IgRepContextcontext (void) const
 IgQtTreeRep (IgQtTreeBrowser *in, QString name, bool traverse, bool visible, bool opened)
 IgQtTreeRep (IgQtTreeBrowser *in, IgQtTreeRep *before, QString name, bool traverse, bool visible, bool opened)
 IgQtTreeRep (IgQtTreeRep *parent, QString name, bool traverse, bool visible, bool opened)
 IgQtTreeRep (IgQtTreeRep *parent, IgQtTreeRep *before, QString name, bool traverse, bool visible, bool opened)
void italic (bool value)
bool italic (void) const
void magic (bool value)
bool magic (void) const
virtual IgModelmodel (void) const
void setCheck (int column, bool value, bool known)
virtual void setOpen (bool opened)
 ~IgQtTreeRep (void)

Static Public Member Functions

static IgQtTreeRepcreate (IgQtTreeBrowser *in, IgQtTreeRep *parent, IgQtTreeRep *before, QString name, bool traverse, bool visible, bool opened)

Static Public Attributes

static const int CASCADE_FIELD = 3
static const int TRAVERSE_FIELD = 2
static const int VISIBLE_FIELD = 1

Protected Member Functions

QColorGroup columnColor (int column, const QColorGroup &cg) const
virtual void context (IgRepContext *context)
void init (bool traverse, bool visible, bool opened)
virtual void paintCell (QPainter *painter, const QColorGroup &cg, int column, int width, int align)
void repaintChildren (QListViewItem *item)
bool traversed (void) const
virtual int width (const QFontMetrics &, const QListView *lv, int c) const

Private Member Functions

void flag (unsigned n, bool value)
bool flag (unsigned n) const
 IgQtTreeRep (const IgQtTreeRep &)
IgQtTreeRepoperator= (const IgQtTreeRep &)

Private Attributes

IgRepContextm_context
unsigned m_flags

Static Private Attributes

static const unsigned int AUTO_OPEN = 128
static const unsigned int BOLD = 2
static const unsigned int CHECKABLE = 1
static const unsigned int EXPANDED = 16
static const unsigned int ITALIC = 4
static const unsigned int MAGIC = 8
static const unsigned int TRAVERSE = 32
static const unsigned int VISIBLE = 64


Detailed Description

Definition at line 22 of file IgQtTreeRep.h.


Constructor & Destructor Documentation

IgQtTreeRep::IgQtTreeRep ( IgQtTreeRep parent,
IgQtTreeRep before,
QString  name,
bool  traverse,
bool  visible,
bool  opened 
)

Definition at line 47 of file IgQtTreeRep.cc.

References init().

Referenced by create().

00049     : QListViewItem (parent, before, name),
00050       m_context (0),
00051       m_flags (0)
00052 { init (traverse, visible, opened); }

IgQtTreeRep::IgQtTreeRep ( IgQtTreeRep parent,
QString  name,
bool  traverse,
bool  visible,
bool  opened 
)

Definition at line 54 of file IgQtTreeRep.cc.

References init().

00056     : QListViewItem (parent, name),
00057       m_context (0),
00058       m_flags (0)
00059 { init (traverse, visible, opened); }

IgQtTreeRep::IgQtTreeRep ( IgQtTreeBrowser in,
IgQtTreeRep before,
QString  name,
bool  traverse,
bool  visible,
bool  opened 
)

Definition at line 61 of file IgQtTreeRep.cc.

References init().

00063     : QListViewItem (in, before, name),
00064       m_context (0),
00065       m_flags (0)
00066 { init (traverse, visible, opened); }

IgQtTreeRep::IgQtTreeRep ( IgQtTreeBrowser in,
QString  name,
bool  traverse,
bool  visible,
bool  opened 
)

Definition at line 68 of file IgQtTreeRep.cc.

References init().

00070     : QListViewItem (in, name),
00071       m_context (0),
00072       m_flags (0)
00073 { init (traverse, visible, opened); }

IgQtTreeRep::~IgQtTreeRep ( void   ) 

Definition at line 88 of file IgQtTreeRep.cc.

References ASSERT, IgRepContext::erase(), m_context, and IgRepContext::rep().

00089 {
00090     // The destruction may come upon me in two ways: the object is
00091     // going away and the context is deleting me, or someone else
00092     // killed me (e.g. Qt).  In the former case the caller will have
00093     // done the right thing of getting rid of references to me.
00094     // However if my context *was* deleted, I must not delete it
00095     // again; if so, it has already set its rep to null, which we use
00096     // as a clue.
00097 
00098     ASSERT (m_context);
00099     if (m_context->rep ())
00100     {
00101         ASSERT (m_context->rep () == this);
00102         m_context->erase (false);
00103         delete m_context;
00104     }
00105 }

IgQtTreeRep::IgQtTreeRep ( const IgQtTreeRep  )  [private]


Member Function Documentation

void IgQtTreeRep::bold ( bool  value  )  [inline]

Definition at line 112 of file IgQtTreeRep.h.

References BOLD, and flag().

00113 { flag (BOLD, value); }

bool IgQtTreeRep::bold ( void   )  const [inline]

Definition at line 108 of file IgQtTreeRep.h.

References BOLD, and flag().

Referenced by init(), paintCell(), and width().

00109 { return flag (BOLD); }

QColorGroup IgQtTreeRep::columnColor ( int  column,
const QColorGroup &  cg 
) const [protected]

Definition at line 194 of file IgQtTreeRep.cc.

References traversed().

Referenced by paintCell().

00195 {
00196     QColorGroup cgnew (cg);
00197     if (column == 0 && !traversed ())
00198         cgnew.setColor (QColorGroup::Text, cg.mid ());
00199     return cgnew;
00200 }

void IgQtTreeRep::context ( IgRepContext context  )  [protected, virtual]

Implements IgRep.

Definition at line 108 of file IgQtTreeRep.cc.

References ASSERT, AUTO_OPEN, flag(), m_context, and setOpen().

00109 {
00110     ASSERT (! m_context);
00111     ASSERT (context);
00112     m_context = context;
00113 
00114     // OK, it is now safe to open up this one
00115     if (flag (AUTO_OPEN))
00116         setOpen (true);
00117 }

IgRepContext * IgQtTreeRep::context ( void   )  const [virtual]

Implements IgRep.

Definition at line 121 of file IgQtTreeRep.cc.

References m_context.

Referenced by MMM_DEFUN_FUNC().

00122 { return m_context; }

IgQtTreeRep * IgQtTreeRep::create ( IgQtTreeBrowser in,
IgQtTreeRep parent,
IgQtTreeRep before,
QString  name,
bool  traverse,
bool  visible,
bool  opened 
) [static]

Definition at line 30 of file IgQtTreeRep.cc.

References IgQtTreeRep().

Referenced by MMM_DEFUN_FUNC().

00035 {
00036     if (parent && before)
00037         return new IgQtTreeRep (parent, before, name, traverse, visible, opened);
00038     else if (parent)
00039         return new IgQtTreeRep (parent, name, traverse, visible, opened);
00040     else if (before)
00041         return new IgQtTreeRep (in, before, name, traverse, visible, opened);
00042     else
00043         return new IgQtTreeRep (in, name, traverse, visible, opened);
00044 }

void IgQtTreeRep::flag ( unsigned  n,
bool  value 
) [inline, private]

Definition at line 104 of file IgQtTreeRep.h.

References m_flags.

00105 { m_flags = (m_flags & ~n) | (n * value); }

bool IgQtTreeRep::flag ( unsigned  n  )  const [inline, private]

Definition at line 100 of file IgQtTreeRep.h.

References m_flags.

Referenced by bold(), context(), init(), italic(), magic(), setCheck(), setOpen(), and traversed().

00101 { return m_flags & n; }

void IgQtTreeRep::init ( bool  traverse,
bool  visible,
bool  opened 
) [protected]

Definition at line 76 of file IgQtTreeRep.cc.

References AUTO_OPEN, bold(), flag(), dbtoconf::parent, setCheck(), TRAVERSE_FIELD, and VISIBLE_FIELD.

Referenced by IgQtTreeRep().

00077 {
00078     bold (! parent ());
00079 
00080 
00081     setCheck (TRAVERSE_FIELD, traverse, false);
00082     setCheck (VISIBLE_FIELD,  visible, false);
00083     setExpandable (true);
00084     // Delay until we get a context
00085     flag (AUTO_OPEN, opened);
00086 }

void IgQtTreeRep::italic ( bool  value  )  [inline]

Definition at line 120 of file IgQtTreeRep.h.

References flag(), and ITALIC.

00121 { flag (ITALIC, value); }

bool IgQtTreeRep::italic ( void   )  const [inline]

Definition at line 116 of file IgQtTreeRep.h.

References flag(), and ITALIC.

Referenced by paintCell(), and width().

00117 { return flag (ITALIC); }

void IgQtTreeRep::magic ( bool  value  )  [inline]

Definition at line 128 of file IgQtTreeRep.h.

References flag(), and MAGIC.

00129 { flag (MAGIC, value); }

bool IgQtTreeRep::magic ( void   )  const [inline]

Definition at line 124 of file IgQtTreeRep.h.

References flag(), and MAGIC.

Referenced by IgQtTreeBrowser::contentsMouseDoubleClickEvent().

00125 { return flag (MAGIC); }

IgModel * IgQtTreeRep::model ( void   )  const [virtual]

Implements IgRep.

Definition at line 125 of file IgQtTreeRep.cc.

Referenced by MMM_DEFUN_FUNC().

00126 { return static_cast<IgQtTreeBrowser *> (listView ()); }

IgQtTreeRep& IgQtTreeRep::operator= ( const IgQtTreeRep  )  [private]

void IgQtTreeRep::paintCell ( QPainter *  painter,
const QColorGroup &  cg,
int  column,
int  width,
int  align 
) [protected, virtual]

Definition at line 147 of file IgQtTreeRep.cc.

References bold(), columnColor(), and italic().

00149 {
00150     QFont fold (painter->font ());
00151     QFont fnew (painter->font ());
00152 
00153     fnew.setBold (bold ());
00154     fnew.setItalic (italic ());
00155 
00156     painter->setFont (fnew);
00157     QListViewItem::paintCell (painter, columnColor (column, cg),
00158                               column, width, align);
00159     painter->setFont (fold);
00160 }

void IgQtTreeRep::repaintChildren ( QListViewItem *  item  )  [protected]

Definition at line 186 of file IgQtTreeRep.cc.

Referenced by setCheck().

00187 {
00188     item->repaint ();
00189     for (item = item->firstChild (); item; item = item->nextSibling ())
00190         repaintChildren (item);
00191 }

void IgQtTreeRep::setCheck ( int  column,
bool  value,
bool  known 
)

Definition at line 203 of file IgQtTreeRep.cc.

References ASSERT, flag(), repaintChildren(), TRAVERSE, TRAVERSE_FIELD, VISIBLE, and VISIBLE_FIELD.

Referenced by init().

00204 {
00205     QListViewItem *item;
00206     switch (column)
00207     {
00208     case TRAVERSE_FIELD:
00209         flag (TRAVERSE, value);
00210 
00211         // Update children to reflect visibility status
00212         for (item = firstChild (); item; item = item->nextSibling ())
00213             repaintChildren (item);
00214         break;
00215 
00216     case VISIBLE_FIELD:
00217         flag (VISIBLE, value);
00218         break;
00219 
00220     default:
00221         ASSERT (false);
00222     }
00223 }

void IgQtTreeRep::setOpen ( bool  opened  )  [virtual]

Definition at line 129 of file IgQtTreeRep.cc.

References CASCADE_FIELD, IgBrowserMethods::commit(), IgBrowserMethods::expand(), EXPANDED, flag(), m_context, and IgRepContext::object().

Referenced by context(), and MMM_DEFUN_FUNC().

00130 {
00131     if (opened && ! flag (EXPANDED))
00132     {
00133         QApplication::setOverrideCursor (Qt::waitCursor);
00134         IgBrowserMethods::expand (m_context->object (), this);
00135         QApplication::restoreOverrideCursor ();
00136         setExpandable (childCount ());
00137     }
00138 
00139     if (opened != flag (EXPANDED))
00140         flag (EXPANDED, opened);
00141 
00142     QListViewItem::setOpen (opened);
00143     IgBrowserMethods::commit (this, m_context->object (), CASCADE_FIELD);
00144 }

bool IgQtTreeRep::traversed ( void   )  const [protected]

Definition at line 174 of file IgQtTreeRep.cc.

References flag(), p, dbtoconf::parent, and TRAVERSE.

Referenced by columnColor().

00175 {
00176     IgQtTreeRep *p = static_cast<IgQtTreeRep *> (parent ());
00177     for (; p; p = static_cast<IgQtTreeRep *> (p->parent ()))
00178         if (! p->flag (TRAVERSE))
00179             return false;
00180 
00181     return true;
00182 }

int IgQtTreeRep::width ( const QFontMetrics &  ,
const QListView *  lv,
int  c 
) const [protected, virtual]

Definition at line 163 of file IgQtTreeRep.cc.

References bold(), italic(), and width.

00164 {
00165     QFont fnew (lv->font ());
00166     fnew.setBold (bold ());
00167     fnew.setItalic (italic ());
00168     QFontMetrics fm (fnew);
00169     return QListViewItem::width (fm, lv, c);
00170 }


Member Data Documentation

const unsigned int IgQtTreeRep::AUTO_OPEN = 128 [static, private]

Definition at line 86 of file IgQtTreeRep.h.

Referenced by context(), and init().

const unsigned int IgQtTreeRep::BOLD = 2 [static, private]

Definition at line 80 of file IgQtTreeRep.h.

Referenced by bold().

const int IgQtTreeRep::CASCADE_FIELD = 3 [static]

Definition at line 27 of file IgQtTreeRep.h.

Referenced by MMM_DEFUN_FUNC(), and setOpen().

const unsigned int IgQtTreeRep::CHECKABLE = 1 [static, private]

Definition at line 79 of file IgQtTreeRep.h.

const unsigned int IgQtTreeRep::EXPANDED = 16 [static, private]

Definition at line 83 of file IgQtTreeRep.h.

Referenced by setOpen().

const unsigned int IgQtTreeRep::ITALIC = 4 [static, private]

Definition at line 81 of file IgQtTreeRep.h.

Referenced by italic().

IgRepContext* IgQtTreeRep::m_context [private]

Definition at line 88 of file IgQtTreeRep.h.

Referenced by context(), setOpen(), and ~IgQtTreeRep().

unsigned IgQtTreeRep::m_flags [private]

Definition at line 89 of file IgQtTreeRep.h.

Referenced by flag().

const unsigned int IgQtTreeRep::MAGIC = 8 [static, private]

Definition at line 82 of file IgQtTreeRep.h.

Referenced by magic().

const unsigned int IgQtTreeRep::TRAVERSE = 32 [static, private]

Definition at line 84 of file IgQtTreeRep.h.

Referenced by setCheck(), and traversed().

const int IgQtTreeRep::TRAVERSE_FIELD = 2 [static]

Definition at line 26 of file IgQtTreeRep.h.

Referenced by init(), MMM_DEFUN_FUNC(), and setCheck().

const unsigned int IgQtTreeRep::VISIBLE = 64 [static, private]

Definition at line 85 of file IgQtTreeRep.h.

Referenced by setCheck().

const int IgQtTreeRep::VISIBLE_FIELD = 1 [static]

Definition at line 25 of file IgQtTreeRep.h.

Referenced by init(), MMM_DEFUN_FUNC(), and setCheck().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:25:37 2009 for CMSSW by  doxygen 1.5.4