Wt::HBoxLayout Class Reference

#include <layout.h>

Inheritance diagram for Wt::HBoxLayout:

Inheritance graph
[legend]
Collaboration diagram for Wt::HBoxLayout:

Collaboration graph
[legend]
List of all members.

Public Types

 LeftToRight
 RightToLeft
 TopToBottom
 BottomToTop
 Down = TopToBottom
 Up = BottomToTop
enum  Direction {
  LeftToRight, RightToLeft, TopToBottom, BottomToTop,
  Down = TopToBottom, Up = BottomToTop
}
typedef Container::value_type Compound
typedef std::list< Object * > List

Public Member Functions

 HBoxLayout (Widget *parent, int margin=0, int spacing=-1, const std::string &name="HBoxLayout::anon")
 HBoxLayout (Layout *parent_layout, int margin=0, int spacing=-1, const std::string &name="HBoxLayout::anon")
 HBoxLayout (int spacing=-1, const std::string &name="HBoxLayout::anon")
virtual void appendItem (LayoutItem *li)
virtual void prependItem (LayoutItem *li)
virtual void addItem (LayoutItem *li)
virtual void setGeometry (const Rect &r)
 fixup all managed widgets geometry
virtual bool isEmpty () const
virtual bool removeItem (LayoutItem *li)
 returns true if a layoutitem is actually removed
virtual LayoutIterator iterator ()
WidgetmainWidget () const
bool isTopLevel () const
virtual Size sizeHint () const
virtual Size minimumSize () const
virtual bool eventFilter (Object *, Event *)
Objectparent () const
const Listchildren () const
Listchildren ()
bool isDescendant (const Object *p) const
virtual void insertChild (Object *obj)
virtual void removeChild (Object *obj)
void reparent (Object *new_parent)
template<typename T>
void deleteFirstChild ()
template<typename T>
void deleteLastChild ()
template<typename T>
void deleteAllChildren ()
ObjecttopParent () const
 returns top level parent: it may return itself
const std::string & name () const
void installEventFilter (const Object *filterObj)
void removeEventFilter (const Object *obj)
int startTimer (int interval)
void killTimer (int id)
void killTimers ()
virtual bool event (Event *e)
 event handling
virtual void setMinimumSize (const Size &size)
virtual Size maximumSize () const
virtual void setMaximumSize (const Size &size)
virtual SizePolicy sizePolicy () const
virtual void setSizePolicy (const SizePolicy &size_policy)
virtual SizePolicy::ExpandData expanding () const
virtual const Rectgeometry () const
 return the widget's geometry relative to its parent
bool isNonEmpty () const
virtual bool hasHeightForWidth () const
virtual int heightForWidth (int) const
template<typename TEST_TYPE>
TEST_TYPE type () const
template<typename TEST_TYPE>
bool is () const

Public Attributes

Direction direction
WVar< intmargin
WVar< intspacing
WVar< bool > autoAdd
Signal01< void, const Object * > destroyed
 signals
WVar< intalignment

Static Public Attributes

static const int default_max_size = ((int) ((unsigned int) (~0) >> 1))
static const int default_min_size = 30
static const int default_hint_size = 100

Protected Member Functions

virtual void validate ()
 let's calc again sizeHint, minimumSize etc
virtual bool exists (const LayoutItem *li) const
Compound::LayoutItemValue & value (const LayoutItem *li)
Compound::LayoutItemValue & operator[] (const LayoutItem *li)
virtual bool onAboutToChangeAutoAdd (bool auto_add)
virtual int onSpacingOverride (int spacing)
void adjustMaximumSize (int margin)
void markDeleted (LayoutItem *li)
bool isDeleted (LayoutItem *li) const
void enforce ()
 enforces the layout in the mainWidget() children and layouts
void postLayoutHintEvent ()
void setWidthasPrimaryLength (bool width=true)
bool isWidthPrimaryLength () const
template<typename TYPE>
int primaryLength (const TYPE &t) const
int preferredLength (const LayoutItem *li, bool expand) const
template<typename TYPE>
int secondaryLength (const TYPE &t) const
template<typename TYPE>
int primaryOffset (const TYPE &t) const
template<typename TYPE>
int secondaryOffset (const TYPE &t) const
Point getPoint (int primary_offset, int secondary_offset) const
Size getSize (int primary, int secondary) const
Rect getRect (int primary_offset, int secondary_offset, int primary_size, int secondary_size) const
int primaryStretch (const SizePolicy &sp) const
bool mayGrowPrimally (const SizePolicy &sp) const
bool mayShrinkPrimally (const SizePolicy &sp) const
bool expandingPrimally (const SizePolicy &sp) const
virtual void childEvent (ChildEvent *)
 event handling specialization
virtual void customEvent (CustomEvent *)
virtual void timerEvent (TimerEvent *)
bool filterEvent (Event *)
void invalidateRecursively ()
bool invalidated () const
virtual void setSizeHint (const Size &size)

Friends

class Box

Detailed Description

Definition at line 617 of file layout.h.


Member Typedef Documentation

template<typename Container>
typedef Container::value_type Wt::LayoutStdContainer< Container >::Compound [inherited]

Definition at line 463 of file layout.h.

typedef std::list<Object*> Wt::Object::List [inherited]

Definition at line 47 of file object.h.


Member Enumeration Documentation

enum Wt::BoxLayout::Direction [inherited]

Enumerator:
LeftToRight 
RightToLeft 
TopToBottom 
BottomToTop 
Down 
Up 

Definition at line 573 of file layout.h.

00573                   {
00574         LeftToRight,
00575         RightToLeft,
00576         TopToBottom,
00577         BottomToTop,
00578         Down = TopToBottom,
00579         Up = BottomToTop
00580     } Direction;


Constructor & Destructor Documentation

Wt::HBoxLayout::HBoxLayout ( Widget parent,
int  margin = 0,
int  spacing = -1,
const std::string &  name = "HBoxLayout::anon" 
) [inline]

Definition at line 619 of file layout.h.

Wt::HBoxLayout::HBoxLayout ( Layout parent_layout,
int  margin = 0,
int  spacing = -1,
const std::string &  name = "HBoxLayout::anon" 
) [inline]

Definition at line 623 of file layout.h.

00624                                                          :
00625     BoxLayout(parent_layout, LeftToRight, margin, spacing, name) {}

Wt::HBoxLayout::HBoxLayout ( int  spacing = -1,
const std::string &  name = "HBoxLayout::anon" 
) [inline]

Definition at line 627 of file layout.h.

00627                                                                            :
00628     BoxLayout(LeftToRight, spacing, name) {}


Member Function Documentation

void Wt::BoxLayout::addItem ( LayoutItem li  )  [virtual, inherited]

Reimplemented from Wt::LayoutStdContainer< Container >.

Definition at line 441 of file layout.cpp.

References Wt::BoxLayout::appendItem(), Wt::BoxLayout::BottomToTop, Wt::BoxLayout::direction, Wt::BoxLayout::LeftToRight, Wt::BoxLayout::prependItem(), Wt::BoxLayout::RightToLeft, and Wt::BoxLayout::TopToBottom.

00441                                       {
00442     switch(direction) {
00443     case LeftToRight:
00444     case TopToBottom:
00445         appendItem(li);
00446         break;
00447     case RightToLeft:
00448     case BottomToTop:
00449         prependItem(li);
00450         break;
00451     default:
00452         break;
00453     }
00454 }

Here is the call graph for this function:

void Wt::Layout::adjustMaximumSize ( int  margin  )  [protected, inherited]

Definition at line 50 of file layout.cpp.

References Wt::Layout::margin, Wt::LayoutItem::maximumSize(), and Wt::LayoutItem::setMaximumSize().

Referenced by Wt::Layout::init().

00050                                          {
00051     setMaximumSize(maximumSize() >> margin);
00052 }

Here is the call graph for this function:

void Wt::BoxLayout::appendItem ( LayoutItem li  )  [virtual, inherited]

Definition at line 431 of file layout.cpp.

References Wt::Layout::addItem().

Referenced by Wt::BoxLayout::addItem().

00431                                          {
00432     Layout::addItem(li);
00433     push_back(li);
00434 }

Here is the call graph for this function:

virtual void Wt::Object::childEvent ( ChildEvent  )  [inline, protected, virtual, inherited]

event handling specialization

Reimplemented in Wt::Window::Frame.

Definition at line 146 of file object.h.

Referenced by Wt::Object::event().

00146 {}

List& Wt::Object::children (  )  [inline, inherited]

Definition at line 61 of file object.h.

References Wt::Object::children_.

00061                      {
00062         return children_;
00063     }

const List& Wt::Object::children (  )  const [inline, inherited]

Definition at line 57 of file object.h.

References Wt::Object::children_.

Referenced by Wt::RootWindow::blit_region_ex(), Wt::Widget::childAt(), Wt::Object::deleteAllChildren(), Wt::Object::deleteFirstChild(), Wt::Object::deleteLastChild(), Wt::Widget::focusNextPrevChild(), Wt::Widget::fontChange(), Wt::Widget::lower(), Wt::postLayoutHintEventRecursively(), and Wt::Widget::raise().

00057                                  {
00058         return children_;
00059     }

virtual void Wt::Object::customEvent ( CustomEvent  )  [inline, protected, virtual, inherited]

Definition at line 147 of file object.h.

Referenced by Wt::Object::event().

00147 {}

template<typename T>
void Wt::Object::deleteAllChildren (  )  [inline, inherited]

Definition at line 106 of file object.h.

References Wt::Object::children().

00106                              {
00107         List::iterator it(children().begin());
00108         List::iterator end(children().end());
00109 
00110         while (it != end) {
00111             T *t = dynamic_cast<T *>(*it);
00112             // before iteration invalidation
00113             ++it;
00114             // this will invalidate the iterator
00115             if (t) {
00116                 delete t;
00117             }
00118         }
00119     }

Here is the call graph for this function:

template<typename T>
void Wt::Object::deleteFirstChild (  )  [inline, inherited]

Definition at line 72 of file object.h.

References Wt::Object::children().

00072                             {
00073         List::iterator it(children().begin());
00074         List::iterator end(children().end());
00075 
00076         while (it != end) {
00077             T *t = dynamic_cast<T *>(*it);
00078             // before iteration invalidation
00079             ++it;
00080             // this will invalidate the iterator
00081             if (t) {
00082                 delete t;
00083                 break;
00084             }
00085         }
00086     }

Here is the call graph for this function:

template<typename T>
void Wt::Object::deleteLastChild (  )  [inline, inherited]

Definition at line 89 of file object.h.

References Wt::Object::children().

00089                            {
00090         List::reverse_iterator it(children().rbegin());
00091         List::reverse_iterator end(children().rend());
00092 
00093         while (it != end) {
00094             T *t = dynamic_cast<T *>(*it);
00095             // before iteration invalidation
00096             ++it;
00097             // this will invalidate the iterator
00098             if (t) {
00099                 delete t;
00100                 break;
00101             }
00102         }
00103     }

Here is the call graph for this function:

void Wt::Layout::enforce (  )  [protected, inherited]

enforces the layout in the mainWidget() children and layouts

it can be only called if there is a main widget

Definition at line 336 of file layout.cpp.

References Wt::LayoutItem::geometry(), Wt::LayoutItem::invalidateRecursively(), Wt::Layout::mainWidget(), Wt::Layout::minimumSize(), Wt::Layout::setGeometry(), Wt::Layout::sizeHint(), and Wt::Widget::updateGeometry().

Referenced by Wt::Layout::eventFilter().

00336                      {
00337     const Rect rect = geometry();
00338     const Size min_size = minimumSize();
00339     const Size hint_size = sizeHint();
00340 
00341     // top downn invalidate across one widget only
00342     invalidateRecursively();
00343     // calls the virtual reimplementations
00344     setGeometry(rect);
00345     // this will notify parent of mainWidget() if exists
00346     if (rect != geometry() ||
00347             hint_size != sizeHint() ||
00348             min_size != minimumSize()) {
00349         mainWidget()->updateGeometry();
00350     }
00351 }

Here is the call graph for this function:

bool Wt::Object::event ( Event e  )  [virtual, inherited]

event handling

Reimplemented in Wt::Application, and Wt::Widget.

Definition at line 173 of file object.cpp.

References Wt::Object::childEvent(), Wt::Event::ChildInserted, Wt::Event::ChildRemoved, Wt::Object::customEvent(), Wt::Object::filterEvent(), Wt::SDLTimer::scheduleNext(), Wt::Object::timer(), Wt::Event::Timer, Wt::Object::timerEvent(), Wt::Event::type(), and Wt::Event::User.

Referenced by Wt::Widget::event(), Wt::Application::notify(), and Wt::Application::postEvent().

00173                            {
00174     bool handled = true;
00175 
00176     if (filterEvent(e))
00177         return true;
00178 
00179     switch (e->type()) {
00180     case Event::Timer: {
00181             TimerEvent *te = static_cast<TimerEvent *>(e);
00182             int id = te->timerid();
00183             if (timer(id)) {
00184                 timerEvent(te);
00185             }
00186             // if it is signle shot it may have been killed
00187             // during eventhandling
00188             SDLTimer *t = timer(id);
00189             if (t)
00190                 t->scheduleNext();
00191         }
00192         break;
00193     case Event::ChildInserted:
00194     case Event::ChildRemoved:
00195         childEvent(static_cast<ChildEvent *>(e));
00196         break;
00197     default:
00198         if (e->type() >= Event::User) {
00199             customEvent(static_cast<CustomEvent *>(e));
00200         } else {
00201             handled = false;
00202         }
00203         break;
00204     }
00205 
00206     return handled;
00207 }

Here is the call graph for this function:

bool Wt::Layout::eventFilter ( Object obj,
Event e 
) [virtual, inherited]

we get events from the mainWidget only if exists. The type of events are:

The following uses cases has to be covered:

    // we monitor the managed widgets
    // top level layout grabs it (if tll exists)
    Layout::eventFilter() {
        // on layoutHint event calls
        Layout::enforce();
 
        // on resize calls
        Layout::setGeometry(r);
 
        // on child insert / remove in mainWidget
        // this implies enforce called in the next event processing
            Application::postEvent(mainWidget(), new LayoutHintEvent());
    }

Note:
  • if there is no top level layout then layout is not automatically enforced
  • use cases 1,2,3,4 are working if we assume the presence of a tll
  • we do a lot of invalidateRecursively()
  • widgets can only have one layout child (setLayout(), layout()) and no more
  • a widget cannot tell if it is managed or not
  • Layout::setGeometry() reimplementations must call base class implementation

Reimplemented from Wt::Object.

Definition at line 228 of file layout.cpp.

References Wt::Layout::addItem(), Wt::Layout::autoAdd, Wt::ChildEvent::child(), Wt::Event::ChildInserted, Wt::Event::ChildRemoved, Wt::Layout::enforce(), Wt::Object::eventFilter(), Wt::LayoutItem::geometry(), Wt::Event::LayoutHint, Wt::Event::Move, Wt::Layout::removeItem(), Wt::Event::Resize, Wt::LayoutItem::setGeometry(), Wt::Layout::setGeometry(), trace, and Wt::Event::type().

00228                                               {
00229     Widget *w;
00230 
00231     switch (e->type()) {
00232     case Event::ChildInserted:
00233         if (autoAdd) {
00234             ChildEvent *ce = static_cast<ChildEvent *>(e);
00235             Object *child = ce->child();
00236             // It is not possible to add other widgets layout. They will
00237             // be toplevels and that means we are dead
00238             LayoutItem *li = dynamic_cast<LayoutItem *>(child);
00239 
00240             //assert(li == this);
00241             // we can only insert Widget items as childs of our mainWidget
00242             const bool is_window_frame = dynamic_cast<Window::Frame *>(child);
00243             const Window *wnd = dynamic_cast<Window *>(child);
00244             const bool is_frameless_window = wnd &&
00245                                              !dynamic_cast<Window::Frame *>(wnd->parent());
00246             if (li != this && !is_window_frame && !is_frameless_window
00247                     && (w = dynamic_cast<Widget *>(child))) {
00248                 trace("layout") << "Inserting to layout "
00249                 << this << " child " << w << std::endl;
00250                 addItem(w);
00251             }
00252         }
00253         break;
00254     case Event::ChildRemoved: {
00255             // we have to handle the reparenting case.
00256             // delete is handled gracefully. Problem is we don't
00257             // know if it is deleted. But if it is deleted it will
00258             // have been already removed. So we use static_cast to
00259             // go up and down the inheritance tree. It is also possible
00260             // that we don't manage this child.
00261             ChildEvent *ce = static_cast<ChildEvent *>(e);
00262             w = static_cast<Widget *>(ce->child());
00263             LayoutItem *li = static_cast<LayoutItem *>(w);
00264             // if item is already dead (removed) removeItem will do nothing
00265             removeItem(li);
00266         }
00267         break;
00268     case Event::Resize:
00269         w = dynamic_cast<Widget *>(obj);
00270         trace("layout") << "Widget Resize: " << w
00271         << " caused layout resize" << std::endl;
00272         setGeometry(w->geometry());
00273         break;
00274     case Event::Move:
00275         w = dynamic_cast<Widget *>(obj);
00276         trace("layout") << "Widget move: " << w
00277         << " caused layout move" << std::endl;
00278         LayoutItem::setGeometry(w->geometry());
00279         break;
00280     case Event::LayoutHint:
00281         enforce();
00282         break;
00283     default:
00284         break;
00285     }
00286 
00287     return Object::eventFilter(obj, e);
00288 }

Here is the call graph for this function:

template<typename Container>
virtual bool Wt::LayoutStdContainer< Container >::exists ( const LayoutItem li  )  const [inline, protected, virtual, inherited]

Implements Wt::Layout.

Definition at line 514 of file layout.h.

Referenced by Wt::GridLayout::addItem(), and Wt::Box::setStretchFactor().

00514                                                     {
00515         typename Container::const_iterator end = Container::end();
00516         typename Container::const_iterator p = find(Container::begin(), end, li);
00517         return (p != end);
00518     }

virtual SizePolicy::ExpandData Wt::LayoutItem::expanding (  )  const [inline, virtual, inherited]

Reimplemented in Wt::Widget.

Definition at line 170 of file layout.h.

References Wt::SizePolicy::expandData, and Wt::LayoutItem::size_policy_.

Referenced by Wt::Widget::expanding().

00170                                                    {
00171         return size_policy_.expandData;
00172     }

bool Wt::Layout::expandingPrimally ( const SizePolicy sp  )  const [protected, inherited]

Definition at line 410 of file layout.cpp.

References Wt::SizePolicy::expandingHorizontally(), Wt::SizePolicy::expandingVertically(), and Wt::Layout::width_as_primary_length.

Referenced by Wt::BoxLayout::setGeometry().

00410                                                          {
00411     return (width_as_primary_length) ?
00412            sp.expandingHorizontally() : sp.expandingVertically();
00413 }

Here is the call graph for this function:

bool Wt::Object::filterEvent ( Event  )  [protected, inherited]

Definition at line 164 of file object.cpp.

References Wt::Object::eventFilters_.

Referenced by Wt::Object::event(), and Wt::Application::event().

00164                                  {
00165     for (List::iterator filter(eventFilters_.begin()),
00166             end(eventFilters_.end()); filter != end; ++filter) {
00167         if ((*filter)->eventFilter(this, e))
00168             return true;
00169     }
00170     return false;
00171 }

virtual const Rect& Wt::LayoutItem::geometry (  )  const [inline, virtual, inherited]

return the widget's geometry relative to its parent

Definition at line 175 of file layout.h.

References Wt::LayoutItem::geometry_rect_.

Referenced by Wt::Label::drawContents(), Wt::Layout::enforce(), Wt::Layout::eventFilter(), Wt::Window::frameGeometry(), Wt::Widget::height(), Wt::Widget::mapFromGlobal(), Wt::Widget::mapFromParent(), Wt::Widget::mapToGlobal(), Wt::Widget::mapToParent(), Wt::Window::Frame::mousePressEvent(), Wt::Widget::move(), Wt::Widget::resize(), Wt::Widget::setGeometry(), Wt::BoxLayout::setGeometry(), Wt::GridLayout::setGeometry(), Wt::CascadeLayout::setGeometry(), Wt::Widget::size(), Wt::Widget::width(), and Wt::Widget::~Widget().

00175                                          {
00176         return geometry_rect_;
00177     }

Point Wt::Layout::getPoint ( int  primary_offset,
int  secondary_offset 
) const [protected, inherited]

Definition at line 376 of file layout.cpp.

References Wt::Layout::width_as_primary_length.

Referenced by Wt::BoxLayout::setGeometry().

00376                                                                      {
00377     return (width_as_primary_length) ?
00378            Point(primary_offset, secondary_offset) :
00379            Point(secondary_offset, primary_offset);
00380 }

Rect Wt::Layout::getRect ( int  primary_offset,
int  secondary_offset,
int  primary_size,
int  secondary_size 
) const [protected, inherited]

Definition at line 388 of file layout.cpp.

References Wt::Layout::width_as_primary_length.

00389                                                                  {
00390     return (width_as_primary_length) ?
00391            Rect(primary_offset, secondary_offset, primary_size, secondary_size) :
00392            Rect(secondary_offset, primary_offset, secondary_size, primary_size);
00393 }

Size Wt::Layout::getSize ( int  primary,
int  secondary 
) const [protected, inherited]

Definition at line 382 of file layout.cpp.

References Wt::Layout::width_as_primary_length.

Referenced by Wt::BoxLayout::setGeometry(), and Wt::BoxLayout::validate().

00382                                                      {
00383     return (width_as_primary_length) ?
00384            Size(primary, secondary) :
00385            Size(secondary, primary);
00386 }

virtual bool Wt::LayoutItem::hasHeightForWidth (  )  const [inline, virtual, inherited]

Definition at line 192 of file layout.h.

00192                                            {
00193         return false;
00194     }

virtual int Wt::LayoutItem::heightForWidth ( int   )  const [inline, virtual, inherited]

Definition at line 195 of file layout.h.

00195                                           {
00196         return -1;
00197     }

void Wt::Object::insertChild ( Object obj  )  [virtual, inherited]

Definition at line 81 of file object.cpp.

References Wt::Event::ChildInserted, Wt::Object::children_, Wt::Object::parent_, and Wt::Application::postEvent().

Referenced by Wt::Object::Object(), and Wt::Object::reparent().

00081                                     {
00082     children_.push_back(obj);
00083     obj->parent_ = this;
00084     Event *child_event = new ChildEvent(Event::ChildInserted, obj);
00085     Application::postEvent(this, child_event);
00086 }

Here is the call graph for this function:

void Wt::Object::installEventFilter ( const Object filterObj  )  [inherited]

Definition at line 124 of file object.cpp.

References Wt::Object::destroyed, Wt::Object::eventFilters_, and Wt::Object::removeEventFilter().

Referenced by Wt::Widget::setLayout().

00124                                                        {
00125     // we have to deconstify here. We cannot deliver event to const objects
00126     Object *obj = const_cast<Object *>(filterObj);
00127     eventFilters_.push_back(obj);
00128     obj->destroyed.connect(sigc::slot1<void, const Object *>(
00129                                sigc::mem_fun(*this, &Object::removeEventFilter)));
00130 }

Here is the call graph for this function:

bool Wt::LayoutItem::invalidated (  )  const [inline, protected, inherited]

Definition at line 227 of file layout.h.

References Wt::LayoutItem::invalidated_.

Referenced by Wt::Layout::minimumSize(), and Wt::Layout::sizeHint().

00227                              {
00228         return invalidated_;
00229     }

void Wt::LayoutItem::invalidateRecursively (  )  [protected, inherited]

Definition at line 28 of file layout.cpp.

References Wt::LayoutIterator::finish(), Wt::LayoutItem::invalidated_, Wt::LayoutItem::isNonEmpty(), Wt::LayoutItem::iterator(), Wt::LayoutIterator::start(), and trace.

Referenced by Wt::Layout::enforce().

00028                                        {
00029     // if null means empty item. don't bother (used on Grid)
00030     // we can't handle it in isEmpty() because it is virtual
00031     // and the null dereference crashes
00032     trace("layout") << "Trying to invalidate " << this
00033     << " == "  << dynamic_cast<Object *>(this) << std::endl;
00034     if (isNonEmpty()) {
00035         trace("layout") << "Invalidating " << this << std::endl;
00036         LayoutIterator it = iterator();
00037         invalidated_ = true;
00038         for (it.start(); !it.finish(); it++) {
00039             LayoutItem *li = *it;
00040             li->invalidateRecursively();
00041         }
00042         trace("layout") << "Invalidation finished " << this << std::endl;
00043     }
00044 }

Here is the call graph for this function:

template<typename TEST_TYPE>
bool Wt::LayoutItem::is (  )  const [inline, inherited]

Definition at line 209 of file layout.h.

Referenced by Wt::Cascade::pop(), and Wt::Layout::removeItem().

00209                     {
00210         return (type<TEST_TYPE>() != 0);
00211     }

bool Wt::Layout::isDeleted ( LayoutItem li  )  const [inline, protected, inherited]

Definition at line 314 of file layout.h.

References Wt::Layout::deleted_li_.

Referenced by Wt::Layout::removeItem().

00314                                          {
00315         return deleted_li_ == li;
00316     }

bool Wt::Object::isDescendant ( const Object p  )  const [inherited]

Definition at line 67 of file object.cpp.

References Wt::Object::parent().

Referenced by Wt::SDLInput::EventInfo::EventInfo(), and Wt::SDLInput::handleKeyEvent().

00067                                                {
00068     if (!p)
00069         return false;
00070 
00071     const Object *q = this;
00072 
00073     do {
00074         if (p == q)
00075             return true;
00076     } while ((q = q->parent()));
00077 
00078     return false;
00079 }

Here is the call graph for this function:

template<typename Container>
virtual bool Wt::LayoutStdContainer< Container >::isEmpty (  )  const [inline, virtual, inherited]

Reimplemented from Wt::LayoutItem.

Definition at line 490 of file layout.h.

00490                                  {
00491         return Container::empty();
00492     }

bool Wt::LayoutItem::isNonEmpty (  )  const [inline, inherited]

Definition at line 188 of file layout.h.

References Wt::LayoutItem::isEmpty().

Referenced by Wt::LayoutItem::invalidateRecursively().

00188                             {
00189         return (this) ? !isEmpty() : false;
00190     }

Here is the call graph for this function:

bool Wt::Layout::isTopLevel (  )  const [inherited]

Definition at line 129 of file layout.cpp.

References Wt::Layout::mainWidget(), and Wt::Object::parent().

Referenced by Wt::Layout::onAboutToChangeAutoAdd(), and Wt::Layout::setGeometry().

00129                               {
00130     return (parent() && mainWidget() == parent());
00131 }

Here is the call graph for this function:

bool Wt::Layout::isWidthPrimaryLength (  )  const [inline, protected, inherited]

Definition at line 321 of file layout.h.

References Wt::Layout::width_as_primary_length.

Referenced by Wt::GridLayout::calcEdge(), Wt::GridLayout::expandingPrimally(), Wt::GridLayout::mayGrowPrimally(), Wt::GridLayout::primaryCellItemLength(), Wt::GridLayout::primaryCellLength(), Wt::GridLayout::primaryHintLength(), Wt::GridLayout::primaryMinLength(), Wt::GridLayout::secondaryEdges(), Wt::GridLayout::secondaryEffectiveStretch(), Wt::GridLayout::secondaryExtraSpace(), Wt::GridLayout::secondaryStretch(), and Wt::Box::setStretchFactor().

00321                                       {
00322         return width_as_primary_length;
00323     }

template<typename Container>
virtual LayoutIterator Wt::LayoutStdContainer< Container >::iterator (  )  [inline, virtual, inherited]

Reimplemented from Wt::LayoutItem.

Definition at line 509 of file layout.h.

00509                                       {
00510         return LayoutIterator(new LayoutStdContainerIterator<Container>(*this));
00511     }

void Wt::Object::killTimer ( int  id  )  [inherited]

Definition at line 145 of file object.cpp.

References Wt::Object::timers_.

Referenced by Wt::Timer::stop().

00145                              {
00146     delete timers_[id];
00147     timers_.erase(id);
00148 }

void Wt::Object::killTimers (  )  [inherited]

Definition at line 150 of file object.cpp.

References Wt::Object::timers_.

Referenced by Wt::Object::~Object().

00150                         {
00151     uint n = timers_.size() + 1;
00152     for (uint i = 1; i < n; i++) {
00153         delete timers_[i];
00154     }
00155     timers_.clear();
00156 }

Widget * Wt::Layout::mainWidget (  )  const [inherited]

Definition at line 118 of file layout.cpp.

References Wt::Object::parent().

Referenced by Wt::Layout::enforce(), Wt::Layout::isTopLevel(), Wt::Layout::postLayoutHintEvent(), Wt::BoxLayout::setGeometry(), Wt::Layout::setGeometry(), Wt::GridLayout::setGeometry(), and Wt::CascadeLayout::setGeometry().

00118                                  {
00119     const Object *p = this;
00120     while ((p = p->parent())) {
00121         Widget *w = dynamic_cast<Widget *>(const_cast<Object *>(p));
00122         if (w) {
00123             return w;
00124         }
00125     }
00126     return 0;
00127 }

Here is the call graph for this function:

void Wt::Layout::markDeleted ( LayoutItem li  )  [inline, protected, inherited]

Definition at line 311 of file layout.h.

References Wt::Layout::deleted_li_.

Referenced by Wt::Layout::on_wobject_item_death(), and Wt::Layout::~Layout().

00311                                      {
00312         deleted_li_ = li;
00313     }

virtual Size Wt::LayoutItem::maximumSize (  )  const [inline, virtual, inherited]

Reimplemented in Wt::Widget.

Definition at line 155 of file layout.h.

References Wt::LayoutItem::maximum_size_.

Referenced by Wt::Layout::adjustMaximumSize(), Wt::Widget::maximumSize(), and Wt::Layout::setGeometry().

00155                                      {
00156         return maximum_size_;
00157     }

bool Wt::Layout::mayGrowPrimally ( const SizePolicy sp  )  const [protected, inherited]

Definition at line 400 of file layout.cpp.

References Wt::SizePolicy::mayGrowHorizontally(), Wt::SizePolicy::mayGrowVertically(), and Wt::Layout::width_as_primary_length.

Referenced by Wt::BoxLayout::setGeometry().

00400                                                        {
00401     return (width_as_primary_length) ?
00402            sp.mayGrowHorizontally() : sp.mayGrowVertically();
00403 }

Here is the call graph for this function:

bool Wt::Layout::mayShrinkPrimally ( const SizePolicy sp  )  const [protected, inherited]

Definition at line 405 of file layout.cpp.

References Wt::SizePolicy::mayShrinkHorizontally(), Wt::SizePolicy::mayShrinkVertically(), and Wt::Layout::width_as_primary_length.

00405                                                          {
00406     return (width_as_primary_length) ?
00407            sp.mayShrinkHorizontally() : sp.mayShrinkVertically();
00408 }

Here is the call graph for this function:

Size Wt::Layout::minimumSize (  )  const [virtual, inherited]

Reimplemented from Wt::LayoutItem.

Definition at line 415 of file layout.cpp.

References Wt::LayoutItem::invalidated(), and Wt::LayoutItem::minimumSize().

Referenced by Wt::GridLayout::calcEdge(), Wt::Layout::enforce(), Wt::Widget::minimumSize(), Wt::BoxLayout::setGeometry(), and Wt::Layout::setGeometry().

00415                                {
00416     if (invalidated()) {
00417         Layout &self(*const_cast<Layout *>(this));
00418         self.validate();
00419     }
00420     return LayoutItem::minimumSize();
00421 }

Here is the call graph for this function:

const std::string& Wt::Object::name (  )  const [inline, inherited]

Definition at line 124 of file object.h.

References Wt::Object::name_.

Referenced by Wt::operator<<(), Wt::Application::parseArgs(), and Wt::PushButton::setButtonSize().

00124                                   {
00125         return name_;
00126     }

bool Wt::Layout::onAboutToChangeAutoAdd ( bool  auto_add  )  [protected, virtual, inherited]

Definition at line 133 of file layout.cpp.

References Wt::Layout::isTopLevel().

Referenced by Wt::Layout::init().

00133                                                  {
00134     return (auto_add && !isTopLevel());
00135 }

Here is the call graph for this function:

int Wt::Layout::onSpacingOverride ( int  spacing  )  [protected, virtual, inherited]

Definition at line 46 of file layout.cpp.

References Wt::Layout::margin.

Referenced by Wt::Layout::init().

00046                                     {
00047     return (sp == -1) ? static_cast<int>(margin) : sp;
00048 }

template<typename Container>
Compound::LayoutItemValue& Wt::LayoutStdContainer< Container >::operator[] ( const LayoutItem li  )  [inline, protected, inherited]

Definition at line 528 of file layout.h.

00528                                                                        {
00529         return value(li);
00530     }

Object* Wt::Object::parent (  )  const [inline, inherited]

Definition at line 53 of file object.h.

References Wt::Object::parent_.

Referenced by Wt::Widget::event(), Wt::Widget::focusNextPrevChild(), Wt::Window::Frame::Frame(), Wt::Widget::is_hidden(), Wt::Object::isDescendant(), Wt::Layout::isTopLevel(), Wt::Layout::Layout(), Wt::Widget::lower(), Wt::Layout::mainWidget(), Wt::operator<<(), Wt::Widget::paintEvent(), Wt::Widget::parentWidget(), Wt::Application::postEvent(), Wt::Widget::raise(), Wt::Widget::updateGeometry(), Wt::Widget::Widget(), Wt::Window::Window(), Wt::Layout::~Layout(), and Wt::Widget::~Widget().

00053                            {
00054         return parent_;
00055     };

void Wt::Layout::postLayoutHintEvent (  )  [protected, inherited]

Definition at line 137 of file layout.cpp.

References Wt::Layout::mainWidget(), and Wt::Application::postEvent().

Referenced by Wt::Layout::addItem(), Wt::Layout::init(), Wt::CascadeLayout::init(), Wt::Layout::removeItem(), Wt::GridLayout::setColStretch(), and Wt::GridLayout::setRowStretch().

00137                                  {
00138     if (mainWidget()) {
00139         Application::postEvent(mainWidget(), new LayoutHintEvent());
00140     }
00141 }

Here is the call graph for this function:

int Wt::Layout::preferredLength ( const LayoutItem li,
bool  expand 
) const [protected, inherited]

Definition at line 357 of file layout.cpp.

References Wt::LayoutItem::minimumSize(), Wt::Layout::primaryLength(), and Wt::LayoutItem::sizeHint().

Referenced by Wt::BoxLayout::setGeometry().

00357                                                                    {
00358     return primaryLength((expand) ? li->sizeHint() : li->minimumSize());
00359 }

Here is the call graph for this function:

void Wt::BoxLayout::prependItem ( LayoutItem li  )  [virtual, inherited]

Definition at line 436 of file layout.cpp.

References Wt::Layout::addItem().

Referenced by Wt::BoxLayout::addItem().

00436                                           {
00437     Layout::addItem(li);
00438     push_front(li);
00439 }

Here is the call graph for this function:

template<typename TYPE>
int Wt::Layout::primaryLength ( const TYPE &  t  )  const [inline, protected, inherited]

Definition at line 326 of file layout.h.

References Wt::Layout::width_as_primary_length.

Referenced by Wt::GridLayout::calcEdge(), Wt::Layout::preferredLength(), Wt::BoxLayout::setGeometry(), and Wt::BoxLayout::validate().

00326                                            {
00327         return (width_as_primary_length) ? t.width() : t.height();
00328     }

template<typename TYPE>
int Wt::Layout::primaryOffset ( const TYPE &  t  )  const [protected, inherited]

Definition at line 367 of file layout.cpp.

References Wt::Layout::width_as_primary_length.

Referenced by Wt::BoxLayout::setGeometry().

00367                                              {
00368     return (width_as_primary_length) ? t.left() : t.top();
00369 }

int Wt::Layout::primaryStretch ( const SizePolicy sp  )  const [protected, inherited]

Definition at line 395 of file layout.cpp.

References Wt::SizePolicy::horizontalStretch, Wt::SizePolicy::verticalStretch, and Wt::Layout::width_as_primary_length.

Referenced by Wt::BoxLayout::setGeometry().

00395                                                      {
00396     return (width_as_primary_length) ?
00397            sp.horizontalStretch : sp.verticalStretch;
00398 }

void Wt::Object::removeChild ( Object obj  )  [virtual, inherited]

Definition at line 88 of file object.cpp.

References Wt::Event::ChildRemoved, Wt::Object::children_, Wt::Object::parent_, and Wt::Application::postEvent().

Referenced by Wt::Object::reparent(), and Wt::Object::~Object().

00088                                     {
00089     List::iterator end = children_.end();
00090     List::iterator p = find(children_.begin(), end, obj);
00091 
00092     if (p != end) {
00093         children_.erase(p);
00094         obj->parent_ = 0;
00095         Event *child_event = new ChildEvent(Event::ChildRemoved, obj);
00096         Application::postEvent(this, child_event);
00097     }
00098 }

Here is the call graph for this function:

void Wt::Object::removeEventFilter ( const Object obj  )  [inherited]

Definition at line 132 of file object.cpp.

References Wt::Object::eventFilters_.

Referenced by Wt::Object::installEventFilter().

00132                                                 {
00133     List::iterator p, end(eventFilters_.end());
00134     p = find(eventFilters_.begin(), end, obj);
00135     if (p != end)
00136         eventFilters_.erase(p);
00137 }

template<typename Container>
virtual bool Wt::LayoutStdContainer< Container >::removeItem ( LayoutItem li  )  [inline, virtual, inherited]

returns true if a layoutitem is actually removed

Reimplemented from Wt::Layout.

Definition at line 500 of file layout.h.

Referenced by Wt::GridLayout::addItem(), and Wt::Cascade::pop().

00500                                             {
00501         bool exist = Layout::removeItem(li);
00502         if (exist) {
00503             Container::remove
00504                 (li);
00505         }
00506         return exist;
00507     }

void Wt::Object::reparent ( Object new_parent  )  [inherited]

Definition at line 100 of file object.cpp.

References Wt::Object::insertChild(), Wt::Object::parent_, Wt::Object::removeChild(), and trace.

Referenced by Wt::Layout::addItem(), Wt::Widget::reparent(), and Wt::Widget::setLayout().

00100                                         {
00101     if (parent_ == new_parent)
00102         return;
00103     trace("obj") << "Reparenting " <<  this << std::endl;
00104 
00105     if (parent_) {
00106         trace("obj") << "   Leaving parent " <<  parent_ << std::endl;
00107         parent_->removeChild(this);
00108     }
00109     if (new_parent) {
00110         trace("obj") << "   Going to new parent " <<  new_parent << std::endl;
00111         new_parent->insertChild(this);
00112     }
00113     parent_ = new_parent;
00114 }

Here is the call graph for this function:

template<typename TYPE>
int Wt::Layout::secondaryLength ( const TYPE &  t  )  const [protected, inherited]

Definition at line 362 of file layout.cpp.

References Wt::Layout::width_as_primary_length.

Referenced by Wt::BoxLayout::setGeometry(), and Wt::BoxLayout::validate().

00362                                                {
00363     return (width_as_primary_length) ? t.height() : t.width();
00364 }

template<typename TYPE>
int Wt::Layout::secondaryOffset ( const TYPE &  t  )  const [protected, inherited]

Definition at line 372 of file layout.cpp.

References Wt::Layout::width_as_primary_length.

Referenced by Wt::BoxLayout::setGeometry().

00372                                                {
00373     return (width_as_primary_length) ? t.top() : t.left();
00374 }

void Wt::BoxLayout::setGeometry ( const Rect r  )  [virtual, inherited]

fixup all managed widgets geometry

Todo:
find biggest offender not the first one

Reimplemented from Wt::Layout.

Definition at line 490 of file layout.cpp.

References Wt::Rect::align(), Wt::Layout::expandingPrimally(), Wt::LayoutStdContainerIterator< Container >::finish(), Wt::LayoutItem::geometry(), Wt::Layout::getPoint(), Wt::Layout::getSize(), Wt::Size::height(), Wt::Layout::mainWidget(), Wt::Layout::margin, Wt::Layout::mayGrowPrimally(), Wt::Layout::minimumSize(), Wt::Layout::preferredLength(), Wt::Layout::primaryLength(), Wt::Layout::primaryOffset(), Wt::Layout::primaryStretch(), Wt::Layout::secondaryLength(), Wt::Layout::secondaryOffset(), Wt::Layout::setGeometry(), Wt::Layout::sizeHint(), Wt::Layout::spacing, Wt::LayoutStdContainerIterator< Container >::start(), trace, Wt::LayoutStdContainer< Container >::value(), and Wt::Size::width().

00490                                          {
00491     BoxLayoutIterator it(*this);
00492     trace("layout") << this << " BoxLayout::setGeometry()" << r << std::endl;
00493 
00494     // store geometry first
00495     Layout::setGeometry(r);
00496     // if smaller than the minSize it is possible that
00497     // we have to reacquire the size to perform the layout
00498     Rect rect = LayoutItem::geometry() >> margin;
00499 
00500     // obvious optimization. If they are empty do nothing
00501     bool empty = true;
00502     for (it.start(); !it.finish(); it++) {
00503         LayoutItem *li = *it;
00504         if (!li->isEmpty()) {
00505             empty = false;
00506             break;
00507         }
00508     }
00509     if (empty)
00510         return;
00511 
00512     int expansion = primaryLength(rect) - primaryLength(sizeHint());
00513     bool expand = expansion >= 0;
00514 
00515     if (!expand) {
00516         expansion = primaryLength(rect) - primaryLength(minimumSize());
00517     }
00518 
00519     // we have to expand
00520     int stretch_sum = 0;
00521     int may_grow_num;
00522     int unclaimed_space;
00523 
00524     // initialize effective stretch to zero
00525     for (it.start(); !it.finish(); it++) {
00526         LayoutItem *li = *it;
00527         value(li).stretch = 0;
00528     }
00529 
00530     // first check if there are any stretch values
00531     may_grow_num = 0;
00532     unclaimed_space = 0;
00533     for (it.start(); !it.finish(); it++) {
00534         LayoutItem *li = *it;
00535         int li_stretch = primaryStretch(li->sizePolicy());
00536         if (!li->isEmpty() && li_stretch &&
00537                 mayGrowPrimally(li->sizePolicy())) {
00538             unclaimed_space += preferredLength(li, expand);
00539             stretch_sum += li_stretch;
00540             value(li).stretch = li_stretch;
00541             may_grow_num++;
00542         }
00543     }
00544 
00545     // check if we have to split the extra space among expanding
00546     if (!stretch_sum) {
00547         may_grow_num = 0;
00548         unclaimed_space = 0;
00549         for (it.start(); !it.finish(); it++) {
00550             LayoutItem *li = *it;
00551             if (!li->isEmpty() && expandingPrimally(li->sizePolicy())) {
00552                 unclaimed_space += preferredLength(li, expand);
00553                 value(li).stretch = 1;
00554                 may_grow_num++;
00555             }
00556         }
00557         stretch_sum = may_grow_num;
00558     }
00559 
00560     // check if we have to split the extra space among may Grow simply (preffered)
00561     if (!may_grow_num) {
00562         unclaimed_space = 0;
00563         for (it.start(); !it.finish(); it++) {
00564             LayoutItem *li = *it;
00565             if (!li->isEmpty() && mayGrowPrimally(li->sizePolicy())) {
00566                 unclaimed_space += preferredLength(li, expand);
00567                 value(li).stretch = 1;
00568                 may_grow_num++;
00569             }
00570         }
00571         stretch_sum = may_grow_num;
00572     }
00573 
00574     // none of the fuckers grows -- all fixed size
00575     if (!may_grow_num) {
00576         unclaimed_space = 0;
00577         for (it.start(); !it.finish(); it++) {
00578             LayoutItem *li = *it;
00579             if (!li->isEmpty()) {
00580                 unclaimed_space += preferredLength(li, expand);
00581                 value(li).stretch = 1;
00582                 may_grow_num++;
00583             }
00584         }
00585         stretch_sum = may_grow_num;
00586     }
00587 
00588     // Now we will remove offenders until we can distribute evenly
00589     int available_space;
00590     int claimed_space;
00591 restart:
00592     /// \todo find biggest offender not the first one
00593     available_space = expansion + unclaimed_space;
00594     claimed_space = 0;
00595     for (it.start(); !it.finish(); it++) {
00596         LayoutItem *li = *it;
00597         if (!li->isEmpty() && value(li).stretch) {
00598             int li_p = (value(li).stretch *
00599                         available_space) / stretch_sum;
00600             if (li_p < preferredLength(li, expand)) {
00601                 // problem: offender found, remove him
00602                 trace("layout", "Removing offender %p with "
00603                       "stretch %d stretch_sum %d\n",
00604                       li, value(li).stretch, stretch_sum);
00605                 unclaimed_space -= preferredLength(li, expand);
00606                 stretch_sum -= value(li).stretch;
00607                 value(li).stretch = 0;
00608                 may_grow_num--;
00609                 goto restart;
00610             }
00611             claimed_space += li_p;
00612         }
00613     }
00614 
00615     // now we have to distribute evenly the difference
00616     // that got truncated in the integer division
00617     int rest_space = available_space - claimed_space;
00618     int div = 0;
00619     int modulo = 0;
00620     if (may_grow_num) {
00621         div = rest_space / may_grow_num;
00622         modulo = rest_space % may_grow_num;
00623     }
00624 
00625     int count = 0;
00626     for (it.start(); !it.finish(); it++) {
00627         LayoutItem *li = *it;
00628         if (value(li).stretch) {
00629             value(li).extra_space = div + (count < modulo) ? 1 : 0;
00630         } else {
00631             value(li).extra_space = 0;
00632         }
00633         count++;
00634     }
00635 
00636     // finally place them
00637     int covered = primaryOffset(rect);
00638     int sp = spacing;
00639     for (it.start(); !it.finish(); it++) {
00640         LayoutItem *li = *it;
00641 
00642         if (li->isEmpty())
00643             continue;
00644 
00645         int space = ( (value(li).stretch) ?
00646                       (value(li).stretch * available_space) / stretch_sum :
00647                       preferredLength(li, expand) ) + value(li).extra_space;
00648         const Size& container_size = getSize(space,
00649                                              secondaryLength(rect));
00650         const Size& hint_size = li->sizeHint();
00651         const Size& min_size = li->minimumSize();
00652         const int w = (li->sizePolicy().mayGrowHorizontally())
00653                       ? container_size.width()
00654                       : (hint_size.width() <= container_size.width())
00655                       ? hint_size.width()
00656                       : min_size.width();
00657         const int h = (li->sizePolicy().mayGrowVertically())
00658                       ? container_size.height()
00659                       : (hint_size.height() <= container_size.height())
00660                       ? hint_size.height()
00661                       : min_size.height();
00662         const Size& cell_size = Size(w, h);
00663 
00664         trace("layout", "BoxLayout:: Allocating space %d for layoutItem %p\n", space, li);
00665         trace("layout") <<  "BoxLayout:: Container size: "
00666         << container_size << " cell_size " << cell_size << std::endl;
00667         li->setGeometry(
00668             Rect::align(Rect(mainWidget()->mapFromParent(getPoint(covered,
00669                              secondaryOffset(rect))), container_size),
00670                         cell_size, li->alignment));
00671         covered += space + sp;
00672     }
00673 }

Here is the call graph for this function:

virtual void Wt::LayoutItem::setMaximumSize ( const Size size  )  [inline, virtual, inherited]

Reimplemented in Wt::Widget.

Definition at line 158 of file layout.h.

References Wt::LayoutItem::maximum_size_.

Referenced by Wt::Layout::adjustMaximumSize(), and Wt::Widget::setMaximumSize().

00158                                                   {
00159         maximum_size_ = size;
00160     }

virtual void Wt::LayoutItem::setMinimumSize ( const Size size  )  [inline, virtual, inherited]

Reimplemented in Wt::Widget.

Definition at line 151 of file layout.h.

References Wt::LayoutItem::minimum_size_.

Referenced by Wt::Widget::setMinimumSize(), Wt::BoxLayout::validate(), Wt::GridLayout::validate(), and Wt::CascadeLayout::validate().

00151                                                   {
00152         minimum_size_ = size;
00153     }

virtual void Wt::LayoutItem::setSizeHint ( const Size size  )  [inline, protected, virtual, inherited]

Reimplemented in Wt::Widget.

Definition at line 231 of file layout.h.

References Wt::LayoutItem::size_hint_.

Referenced by Wt::Widget::setSizeHint(), Wt::BoxLayout::validate(), Wt::GridLayout::validate(), and Wt::CascadeLayout::validate().

00231                                                {
00232         size_hint_ = size;
00233     }

virtual void Wt::LayoutItem::setSizePolicy ( const SizePolicy size_policy  )  [inline, virtual, inherited]

Reimplemented in Wt::Widget.

Definition at line 166 of file layout.h.

References Wt::LayoutItem::size_policy_.

Referenced by Wt::Widget::setSizePolicy().

00166                                                               {
00167         size_policy_ = size_policy;
00168     }

void Wt::Layout::setWidthasPrimaryLength ( bool  width = true  )  [protected, inherited]

Definition at line 353 of file layout.cpp.

References Wt::Layout::width_as_primary_length.

Referenced by Wt::GridLayout::calcEdge().

00353                                                {
00354     width_as_primary_length = width;
00355 }

Size Wt::Layout::sizeHint (  )  const [virtual, inherited]

Reimplemented from Wt::LayoutItem.

Definition at line 423 of file layout.cpp.

References Wt::LayoutItem::invalidated(), and Wt::LayoutItem::sizeHint().

Referenced by Wt::GridLayout::calcEdge(), Wt::Layout::enforce(), Wt::BoxLayout::setGeometry(), Wt::Layout::setGeometry(), Wt::CascadeLayout::setGeometry(), and Wt::Widget::sizeHint().

00423                             {
00424     if (invalidated()) {
00425         Layout &self(*const_cast<Layout *>(this));
00426         self.validate();
00427     }
00428     return LayoutItem::sizeHint();
00429 }

Here is the call graph for this function:

virtual SizePolicy Wt::LayoutItem::sizePolicy (  )  const [inline, virtual, inherited]

Reimplemented in Wt::Widget.

Definition at line 162 of file layout.h.

References Wt::LayoutItem::size_policy_.

Referenced by Wt::Widget::sizePolicy().

00162                                           {
00163         return size_policy_;
00164     }

int Wt::Object::startTimer ( int  interval  )  [inherited]

Definition at line 139 of file object.cpp.

References Wt::Object::timers_.

Referenced by Wt::Timer::start().

00139                                    {
00140     int id = timers_.size() + 1;
00141     timers_[id] = new SDLTimer(this, id, interval);
00142     return id;
00143 }

virtual void Wt::Object::timerEvent ( TimerEvent  )  [inline, protected, virtual, inherited]

Reimplemented in Wt::Timer.

Definition at line 148 of file object.h.

Referenced by Wt::Object::event(), and Wt::Timer::timerEvent().

00148 {}

Object * Wt::Object::topParent (  )  const [inherited]

returns top level parent: it may return itself

Definition at line 116 of file object.cpp.

References Wt::Object::parent_.

Referenced by Wt::Widget::topParentWidget().

00116                                 {
00117     const Object *p = this;
00118     while (p->parent_) {
00119         p = p->parent_;
00120     }
00121     return const_cast<Object *>(p);
00122 }

template<typename TEST_TYPE>
TEST_TYPE Wt::LayoutItem::type (  )  const [inline, inherited]

Definition at line 204 of file layout.h.

Referenced by Wt::Layout::addItem().

00204                            {
00205         return dynamic_cast<TEST_TYPE>(const_cast<LayoutItem *>(this));
00206     }

void Wt::BoxLayout::validate (  )  [protected, virtual, inherited]

let's calc again sizeHint, minimumSize etc

Reimplemented from Wt::LayoutItem.

Definition at line 457 of file layout.cpp.

References Wt::LayoutStdContainerIterator< Container >::finish(), Wt::Layout::getSize(), Wt::Layout::primaryLength(), Wt::Layout::secondaryLength(), Wt::LayoutItem::setMinimumSize(), Wt::LayoutItem::setSizeHint(), Wt::Layout::spacing, Wt::LayoutStdContainerIterator< Container >::start(), trace, and Wt::LayoutItem::validate().

00457                          {
00458     int hint_p = 0, hint_s = 0;
00459     int min_p = 0, min_s = 0;
00460     int count = 0;
00461     int sp;
00462 
00463     trace("layout") << this << " BoxLayout::invalidate()" << std::endl;
00464 
00465     BoxLayoutIterator it(*this);
00466     for (it.start(); !it.finish(); it++) {
00467         LayoutItem *li = *it;
00468         if (!li->isEmpty()) {
00469             min_p += primaryLength(li->minimumSize());
00470             min_s = std::max(min_s, secondaryLength(li->minimumSize()));
00471             hint_p += primaryLength(li->sizeHint());
00472             hint_s = std::max(hint_s, secondaryLength(li->sizeHint()));
00473             trace("layout", "Up to item %d (%p) min_size %d hint_size %d\n", count, li, min_p, hint_p);
00474             count++;
00475         }
00476     }
00477     // don't forget spacing
00478     sp = spacing;
00479     if (count) {
00480         min_p += (count - 1) * sp;
00481         hint_p += (count - 1) * sp;
00482     }
00483 
00484     setSizeHint(getSize(hint_p, hint_s));
00485     setMinimumSize(getSize(min_p, min_s));
00486     Layout::validate();
00487 }

Here is the call graph for this function:

template<typename Container>
Compound::LayoutItemValue& Wt::LayoutStdContainer< Container >::value ( const LayoutItem li  )  [inline, protected, inherited]

Definition at line 520 of file layout.h.

Referenced by Wt::GridLayout::addItem(), Wt::GridLayout::insert(), and Wt::BoxLayout::setGeometry().

00520                                                                   {
00521         if (li != cached_li_) {
00522             cached_li_ = li;
00523             cached_it_ = find(Container::begin(), Container::end(), li);
00524         }
00525         return (cached_it_ != Container::end()) ? *cached_it_ : null_;
00526     }


Friends And Related Function Documentation

friend class Box [friend, inherited]

Definition at line 571 of file layout.h.


Member Data Documentation

WVar<int> Wt::LayoutItem::alignment [inherited]

Reimplemented in Wt::Label.

Definition at line 218 of file layout.h.

Referenced by Wt::PushButton::drawButtonLabel(), Wt::CascadeLayout::init(), Wt::Cascade::setAlignment(), Wt::Widget::setBackgroundPixmap(), Wt::Widget::setBackgroundPixmapFlags(), and Wt::CascadeLayout::setGeometry().

WVar<bool> Wt::Layout::autoAdd [inherited]

Definition at line 304 of file layout.h.

Referenced by Wt::Box::Box(), Wt::Cascade::Cascade(), Wt::Layout::eventFilter(), Wt::Grid::Grid(), and Wt::Layout::init().

const int Wt::LayoutItem::default_hint_size = 100 [static, inherited]

Definition at line 216 of file layout.h.

const int Wt::LayoutItem::default_max_size = ((int) ((unsigned int) (~0) >> 1)) [static, inherited]

Definition at line 214 of file layout.h.

const int Wt::LayoutItem::default_min_size = 30 [static, inherited]

Definition at line 215 of file layout.h.

Signal01<void, const Object *> Wt::Object::destroyed [inherited]

signals

Definition at line 139 of file object.h.

Referenced by Wt::Layout::addItem(), Wt::Object::installEventFilter(), and Wt::Object::~Object().

Direction Wt::BoxLayout::direction [inherited]

Definition at line 606 of file layout.h.

Referenced by Wt::BoxLayout::addItem().

WVar<int> Wt::Layout::margin [inherited]

Definition at line 302 of file layout.h.

Referenced by Wt::Layout::adjustMaximumSize(), Wt::Layout::init(), Wt::Widget::maximumSize(), Wt::Widget::minimumSize(), Wt::Frame::onLayoutChange(), Wt::Layout::onSpacingOverride(), Wt::BoxLayout::setGeometry(), Wt::Layout::setGeometry(), Wt::GridLayout::setGeometry(), Wt::CascadeLayout::setGeometry(), Wt::Widget::setMaximumSize(), Wt::Widget::setMinimumSize(), and Wt::Widget::sizeHint().

WVar<int> Wt::Layout::spacing [inherited]

Definition at line 303 of file layout.h.

Referenced by Wt::Layout::init(), Wt::Frame::onLayoutChange(), Wt::BoxLayout::setGeometry(), Wt::GridLayout::setGeometry(), Wt::BoxLayout::validate(), and Wt::GridLayout::validate().


The documentation for this class was generated from the following file:

Generated Fri Jul 28 19:30:14 2006.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.