CMS 3D CMS Logo

IgQtTwigRep Class Reference

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

Inheritance diagram for IgQtTwigRep:

IgRep

List of all members.

Public Member Functions

void bold (bool value)
bool bold (void) const
void check (int column, bool value=true)
bool checked (int column) const
virtual IgRepContextcontext (void) const
 IgQtTwigRep (IgQtTwigBrowser *in, QString name, bool traverse, bool visible, bool opened)
 IgQtTwigRep (IgQtTwigBrowser *in, IgQtTwigRep *before, QString name, bool traverse, bool visible, bool opened)
 IgQtTwigRep (IgQtTwigRep *parent, QString name, bool traverse, bool visible, bool opened)
 IgQtTwigRep (IgQtTwigRep *parent, IgQtTwigRep *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)
 ~IgQtTwigRep (void)

Static Public Member Functions

static IgQtTwigRepcreate (IgQtTwigBrowser *in, IgQtTwigRep *parent, IgQtTwigRep *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)
QPixmap pixmapForState (unsigned value)
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
 IgQtTwigRep (const IgQtTwigRep &)
IgQtTwigRepoperator= (const IgQtTwigRep &)

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 IgQtTwigRep.h.


Constructor & Destructor Documentation

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

Definition at line 46 of file IgQtTwigRep.cc.

References init().

Referenced by create().

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

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

Definition at line 53 of file IgQtTwigRep.cc.

References init().

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

IgQtTwigRep::IgQtTwigRep ( IgQtTwigBrowser in,
IgQtTwigRep before,
QString  name,
bool  traverse,
bool  visible,
bool  opened 
)

Definition at line 60 of file IgQtTwigRep.cc.

References init().

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

IgQtTwigRep::IgQtTwigRep ( IgQtTwigBrowser in,
QString  name,
bool  traverse,
bool  visible,
bool  opened 
)

Definition at line 67 of file IgQtTwigRep.cc.

References init().

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

IgQtTwigRep::~IgQtTwigRep ( void   ) 

Definition at line 86 of file IgQtTwigRep.cc.

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

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

IgQtTwigRep::IgQtTwigRep ( const IgQtTwigRep  )  [private]


Member Function Documentation

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

Definition at line 116 of file IgQtTwigRep.h.

References BOLD, and flag().

00117 { flag (BOLD, value); }

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

Definition at line 112 of file IgQtTwigRep.h.

References BOLD, and flag().

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

00113 { return flag (BOLD); }

void IgQtTwigRep::check ( int  column,
bool  value = true 
)

Definition at line 128 of file IgQtTwigRep.cc.

References checked(), IgBrowserMethods::commit(), m_context, IgRepContext::object(), and setCheck().

Referenced by IgQtTwigBrowser::contentsMousePressEvent().

00129 {
00130     // Update the list view and commit the change back to the object,
00131     // but only if we are changing anything.
00132     if (value != checked (column))
00133     {
00134         setCheck (column, value, true);
00135         QApplication::setOverrideCursor (Qt::waitCursor);
00136         IgBrowserMethods::commit (this, m_context->object (), column);
00137         QApplication::restoreOverrideCursor ();
00138     }
00139 }

bool IgQtTwigRep::checked ( int  column  )  const [inline]

Definition at line 136 of file IgQtTwigRep.h.

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

Referenced by check(), IgQtTwigBrowser::contentsMousePressEvent(), MMM_DEFUN_FUNC(), and pixmapForState().

00137 {
00138     ASSERT (column == TRAVERSE_FIELD || column == VISIBLE_FIELD);
00139     return flag (column == TRAVERSE_FIELD ? TRAVERSE : VISIBLE);
00140 }

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

Definition at line 231 of file IgQtTwigRep.cc.

References traversed().

Referenced by paintCell().

00232 {
00233     QColorGroup cgnew (cg);
00234     if (column == 0 && !traversed ())
00235         cgnew.setColor (QColorGroup::Text, cg.mid ());
00236     return cgnew;
00237 }

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

Implements IgRep.

Definition at line 106 of file IgQtTwigRep.cc.

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

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

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

Implements IgRep.

Definition at line 119 of file IgQtTwigRep.cc.

References m_context.

Referenced by MMM_DEFUN_FUNC().

00120 { return m_context; }

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

Definition at line 29 of file IgQtTwigRep.cc.

References IgQtTwigRep().

Referenced by MMM_DEFUN_FUNC().

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

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

Definition at line 108 of file IgQtTwigRep.h.

References m_flags.

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

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

Definition at line 104 of file IgQtTwigRep.h.

References m_flags.

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

00105 { return m_flags & n; }

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

Definition at line 75 of file IgQtTwigRep.cc.

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

Referenced by IgQtTwigRep().

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

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

Definition at line 124 of file IgQtTwigRep.h.

References flag(), and ITALIC.

00125 { flag (ITALIC, value); }

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

Definition at line 120 of file IgQtTwigRep.h.

References flag(), and ITALIC.

Referenced by paintCell(), and width().

00121 { return flag (ITALIC); }

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

Definition at line 132 of file IgQtTwigRep.h.

References flag(), and MAGIC.

00133 { flag (MAGIC, value); }

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

Definition at line 128 of file IgQtTwigRep.h.

References flag(), and MAGIC.

Referenced by IgQtTwigBrowser::contentsMouseDoubleClickEvent().

00129 { return flag (MAGIC); }

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

Implements IgRep.

Definition at line 123 of file IgQtTwigRep.cc.

Referenced by MMM_DEFUN_FUNC().

00124 { return static_cast<IgQtTwigBrowser *> (listView ()); }

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

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

Definition at line 161 of file IgQtTwigRep.cc.

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

00163 {
00164     QFont fold (painter->font ());
00165     QFont fnew (painter->font ());
00166 
00167     fnew.setBold (bold ());
00168     fnew.setItalic (italic ());
00169 
00170     painter->setFont (fnew);
00171     QListViewItem::paintCell (painter, columnColor (column, cg),
00172                               column, width, align);
00173     painter->setFont (fold);
00174 }

QPixmap IgQtTwigRep::pixmapForState ( unsigned  value  )  [protected]

Definition at line 240 of file IgQtTwigRep.cc.

References ASSERT, checked(), and edm::productstatus::unknown().

Referenced by setCheck().

00241 {
00242     static const char   *unchecked[] = {
00243         "    16    13        2            1",
00244         "  c none",
00245         "x c #000000",
00246         "x x x x x x x   ",
00247         "                ",
00248         "x           x   ",
00249         "                ",
00250         "x           x   ",
00251         "                ",
00252         "x           x   ",
00253         "                ",
00254         "x           x   ",
00255         "                ",
00256         "x           x   ",
00257         "                ",
00258         "x x x x x x x   "
00259     };
00260 
00261     static const char   *unknown[] = {
00262         "    16    13        3            1",
00263         "  c none",
00264         "x c #000000",
00265         "! c #303030",
00266         "x x x x x x x   ",
00267         "                ",
00268         "x ! ! ! ! ! x   ",
00269         "                ",
00270         "x ! ! ! ! ! x   ",
00271         "                ",
00272         "x ! ! ! ! ! x   ",
00273         "                ",
00274         "x ! ! ! ! ! x   ",
00275         "                ",
00276         "x ! ! ! ! ! x   ",
00277         "                ",
00278         "x x x x x x x   "
00279     };
00280 
00281     static const char   *checked[] = {
00282         "    16    13        2            1",
00283         "  c none",
00284         "x c #000000",
00285         "x x x x x x x   ",
00286         "               x",
00287         "x            xx ",
00288         "            x   ",
00289         "x xx      xx    ",
00290         " xxxx    xx     ",
00291         "x xxxx  xx  x   ",
00292         "   xxxxxx       ",
00293         "x   xxxxx   x   ",
00294         "     xxx        ",
00295         "x     xx    x   ",
00296         "                ",
00297         "x x x x x x x   "
00298     };
00299 
00300     static QPixmap      uncheckedpix (unchecked);
00301     static QPixmap      unknownpix (unknown);
00302     static QPixmap      checkedpix (checked);
00303 
00304     switch (value) {
00305     case 0: return uncheckedpix;
00306     case 1: return checkedpix;
00307     case 2: return unknownpix;
00308     default: ASSERT (false); return unknownpix;
00309     };
00310 }

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

Definition at line 223 of file IgQtTwigRep.cc.

Referenced by setCheck().

00224 {
00225     item->repaint ();
00226     for (item = item->firstChild (); item; item = item->nextSibling ())
00227         repaintChildren (item);
00228 }

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

Definition at line 199 of file IgQtTwigRep.cc.

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

Referenced by check(), init(), MMM_DEFUN_FUNC(), and setOpen().

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

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

Definition at line 142 of file IgQtTwigRep.cc.

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

Referenced by context(), and MMM_DEFUN_FUNC().

00143 {
00144     if (opened && ! flag (EXPANDED))
00145     {
00146         QApplication::setOverrideCursor (Qt::waitCursor);
00147         IgBrowserMethods::expand (m_context->object (), this);
00148         QApplication::restoreOverrideCursor ();
00149         setExpandable (childCount ());
00150         setCheck (TRAVERSE_FIELD, flag (TRAVERSE), true);
00151     }
00152 
00153     if (opened != flag (EXPANDED))
00154         flag (EXPANDED, opened);
00155 
00156     QListViewItem::setOpen (opened);
00157     IgBrowserMethods::commit (this, m_context->object (), CASCADE_FIELD);
00158 }

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

Definition at line 188 of file IgQtTwigRep.cc.

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

Referenced by columnColor().

00189 {
00190     IgQtTwigRep *p = static_cast<IgQtTwigRep *> (parent ());
00191     for (; p; p = static_cast<IgQtTwigRep *> (p->parent ()))
00192         if (! p->flag (TRAVERSE))
00193             return false;
00194 
00195     return true;
00196 }

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

Definition at line 177 of file IgQtTwigRep.cc.

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

00178 {
00179     QFont fnew (lv->font ());
00180     fnew.setBold (bold ());
00181     fnew.setItalic (italic ());
00182     QFontMetrics fm (fnew);
00183     return QListViewItem::width (fm, lv, c);
00184 }


Member Data Documentation

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

Definition at line 90 of file IgQtTwigRep.h.

Referenced by context(), and init().

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

Definition at line 84 of file IgQtTwigRep.h.

Referenced by bold().

const int IgQtTwigRep::CASCADE_FIELD = 3 [static]

Definition at line 27 of file IgQtTwigRep.h.

Referenced by MMM_DEFUN_FUNC(), and setOpen().

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

Definition at line 83 of file IgQtTwigRep.h.

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

Definition at line 87 of file IgQtTwigRep.h.

Referenced by setOpen().

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

Definition at line 85 of file IgQtTwigRep.h.

Referenced by italic().

IgRepContext* IgQtTwigRep::m_context [private]

Definition at line 92 of file IgQtTwigRep.h.

Referenced by check(), context(), setOpen(), and ~IgQtTwigRep().

unsigned IgQtTwigRep::m_flags [private]

Definition at line 93 of file IgQtTwigRep.h.

Referenced by flag().

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

Definition at line 86 of file IgQtTwigRep.h.

Referenced by magic().

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

Definition at line 88 of file IgQtTwigRep.h.

Referenced by checked(), setCheck(), setOpen(), and traversed().

const int IgQtTwigRep::TRAVERSE_FIELD = 2 [static]

Definition at line 26 of file IgQtTwigRep.h.

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

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

Definition at line 89 of file IgQtTwigRep.h.

Referenced by checked(), and setCheck().

const int IgQtTwigRep::VISIBLE_FIELD = 1 [static]

Definition at line 25 of file IgQtTwigRep.h.

Referenced by checked(), init(), IgQtTwigBrowser::isInsideChecker(), 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