#include <layout.h>
Inheritance diagram for Wt::LayoutStdContainer< Container >:
Public Types | |
typedef Container::value_type | Compound |
typedef std::list< Object * > | List |
Public Member Functions | |
LayoutStdContainer (Widget *parent, int margin=0, int spacing=-1, const std::string &name="StdLayout::anon") | |
LayoutStdContainer (Layout *parent_layout, int margin=0, int spacing=-1, const std::string &name="StdLayout::anon") | |
LayoutStdContainer (int spacing=-1, const std::string &name="StdLayout::anon") | |
~LayoutStdContainer () | |
virtual bool | isEmpty () const |
virtual void | addItem (LayoutItem *li) |
virtual bool | removeItem (LayoutItem *li) |
returns true if a layoutitem is actually removed | |
virtual LayoutIterator | iterator () |
Widget * | mainWidget () const |
bool | isTopLevel () const |
virtual Size | sizeHint () const |
virtual Size | minimumSize () const |
virtual bool | eventFilter (Object *, Event *) |
virtual void | setGeometry (const Rect &r) |
Object * | parent () const |
const List & | children () const |
List & | children () |
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 () |
Object * | topParent () 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 Rect & | geometry () 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 | |
WVar< int > | margin |
WVar< int > | spacing |
WVar< bool > | autoAdd |
Signal01< void, const Object * > | destroyed |
signals | |
WVar< int > | alignment |
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 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 () |
virtual void | validate () |
bool | invalidated () const |
virtual void | setSizeHint (const Size &size) |
Private Attributes | |
const LayoutItem * | cached_li_ |
Container::iterator | cached_it_ |
Compound::LayoutItemValue | null_ |
The ways to access the value part are: (*this)[li].stretch = 1; or XXXLayout& self(*this); self[li].stretch = 1; or value(li).stretch = 1;
where stretch is a member of the value part of the compound type
Definition at line 461 of file layout.h.
typedef Container::value_type Wt::LayoutStdContainer< Container >::Compound |
typedef std::list<Object*> Wt::Object::List [inherited] |
Wt::LayoutStdContainer< Container >::LayoutStdContainer | ( | Widget * | parent, | |
int | margin = 0 , |
|||
int | spacing = -1 , |
|||
const std::string & | name = "StdLayout::anon" | |||
) | [inline] |
Wt::LayoutStdContainer< Container >::LayoutStdContainer | ( | Layout * | parent_layout, | |
int | margin = 0 , |
|||
int | spacing = -1 , |
|||
const std::string & | name = "StdLayout::anon" | |||
) | [inline] |
Wt::LayoutStdContainer< Container >::LayoutStdContainer | ( | int | spacing = -1 , |
|
const std::string & | name = "StdLayout::anon" | |||
) | [inline] |
Wt::LayoutStdContainer< Container >::~LayoutStdContainer | ( | ) | [inline] |
Definition at line 478 of file layout.h.
00478 { 00479 for (typename Container::iterator it(Container::begin()), 00480 e(Container::end()); it != e;) { 00481 LayoutItem *li = *it; 00482 // Delete only non Objects, Objects will be deleted by ~Object() 00483 if (li && !li->is<Object *>()) { 00484 delete li; 00485 } 00486 it = Container::erase(it); 00487 } 00488 }
virtual void Wt::LayoutStdContainer< Container >::addItem | ( | LayoutItem * | li | ) | [inline, virtual] |
Reimplemented from Wt::Layout.
Reimplemented in Wt::GridLayout, and Wt::BoxLayout.
Definition at line 495 of file layout.h.
00495 { 00496 Layout::addItem(li); 00497 Container::push_back(li); 00498 }
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:
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().
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] |
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:
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:
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:
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()); }
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:
virtual bool Wt::LayoutStdContainer< Container >::exists | ( | const LayoutItem * | li | ) | const [inline, protected, virtual] |
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 }
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] |
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:
bool Wt::LayoutItem::is | ( | ) | const [inline, inherited] |
Definition at line 209 of file layout.h.
Referenced by Wt::Cascade::pop(), and Wt::Layout::removeItem().
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:
virtual bool Wt::LayoutStdContainer< Container >::isEmpty | ( | ) | const [inline, virtual] |
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 }
virtual LayoutIterator Wt::LayoutStdContainer< Container >::iterator | ( | ) | [inline, virtual] |
void Wt::Object::killTimer | ( | int | id | ) | [inherited] |
Definition at line 145 of file object.cpp.
References Wt::Object::timers_.
Referenced by Wt::Timer::stop().
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:
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 }
Compound::LayoutItemValue& Wt::LayoutStdContainer< Container >::operator[] | ( | const LayoutItem * | li | ) | [inline, protected] |
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:
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 }
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 }
virtual bool Wt::LayoutStdContainer< Container >::removeItem | ( | LayoutItem * | li | ) | [inline, virtual] |
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:
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 }
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::Layout::setGeometry | ( | const Rect & | r | ) | [virtual, inherited] |
Reimplemented from Wt::LayoutItem.
Reimplemented in Wt::CascadeLayout, Wt::GridLayout, and Wt::BoxLayout.
Definition at line 290 of file layout.cpp.
References Wt::Size::boundedTo(), Wt::Size::contains(), Wt::Size::expandedTo(), Wt::LayoutIterator::finish(), Wt::Widget::isHidden(), Wt::Layout::isTopLevel(), isTrace, Wt::LayoutItem::iterator(), Wt::Layout::mainWidget(), Wt::Layout::margin, Wt::LayoutItem::maximumSize(), Wt::Layout::minimumSize(), Wt::LayoutItem::setGeometry(), Wt::Widget::setGeometry(), Wt::Rect::setSize(), Wt::Rect::size(), Wt::Layout::sizeHint(), Wt::LayoutIterator::start(), and trace.
Referenced by Wt::Layout::enforce(), Wt::Layout::eventFilter(), Wt::BoxLayout::setGeometry(), Wt::GridLayout::setGeometry(), and Wt::CascadeLayout::setGeometry().
00290 { 00291 Rect widget_rect = r; 00292 00293 if (isTopLevel()) { 00294 const Rect& layout_rect = r >> margin; 00295 Size new_size = layout_rect.size(); 00296 00297 trace("layout") << "Is Widget hidden ? " 00298 << mainWidget()->isHidden() << std::endl; 00299 trace("layout") << this << " requested new_size " << new_size 00300 << " min_size " << minimumSize() 00301 << " hint_size " << sizeHint() << std::endl; 00302 00303 if (isTrace("layout")) { 00304 LayoutIterator it = iterator(); 00305 for (it.start(); !it.finish(); it++) { 00306 LayoutItem *li = *it; 00307 if (li->is<Object *>()) { 00308 trace("layout") << "Listing item " << dynamic_cast<Object *>(li) 00309 << " min_size " << li->minimumSize() 00310 << " hint_size " << li->sizeHint() << std::endl; 00311 } 00312 } 00313 } 00314 00315 if (!new_size.contains(minimumSize())) { 00316 new_size = minimumSize().expandedTo(new_size); 00317 } 00318 00319 if (!maximumSize().contains(new_size)) { 00320 new_size = new_size.boundedTo(maximumSize()); 00321 } 00322 00323 trace("layout") << this << " accepted new_size " << new_size << std::endl; 00324 00325 widget_rect.setSize(new_size << margin); 00326 mainWidget()->setGeometry(widget_rect); 00327 } 00328 trace("layout") << this << " Layout::setGeometry()" << widget_rect << std::endl; 00329 // It is weird but in the layout::LayoutItem component 00330 // we store widget's geometry (<< margin) 00331 LayoutItem::setGeometry(widget_rect); 00332 }
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 }
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().
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 }
TEST_TYPE Wt::LayoutItem::type | ( | ) | const [inline, inherited] |
virtual void Wt::LayoutItem::validate | ( | ) | [inline, protected, virtual, inherited] |
Reimplemented in Wt::CascadeLayout, Wt::GridLayout, and Wt::BoxLayout.
Definition at line 223 of file layout.h.
References Wt::LayoutItem::invalidated_.
Referenced by Wt::BoxLayout::validate(), Wt::GridLayout::validate(), and Wt::CascadeLayout::validate().
00223 { 00224 invalidated_ = false; 00225 }
Compound::LayoutItemValue& Wt::LayoutStdContainer< Container >::value | ( | const LayoutItem * | li | ) | [inline, protected] |
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 }
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().
Container::iterator Wt::LayoutStdContainer< Container >::cached_it_ [private] |
const LayoutItem* Wt::LayoutStdContainer< Container >::cached_li_ [private] |
const int Wt::LayoutItem::default_hint_size = 100 [static, inherited] |
const int Wt::LayoutItem::default_max_size = ((int) ((unsigned int) (~0) >> 1)) [static, inherited] |
const int Wt::LayoutItem::default_min_size = 30 [static, inherited] |
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().
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().
Compound::LayoutItemValue Wt::LayoutStdContainer< Container >::null_ [private] |
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().
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.