#include <gridlayout.h>
Inheritance diagram for Wt::GridLayout:
Public Types | |
typedef Container::value_type | Compound |
typedef std::list< Object * > | List |
Public Member Functions | |
GridLayout (Widget *parent, int margin=0, int spacing=-1, const std::string &name="GridLayout::anon") | |
GridLayout (Layout *parent_layout, int margin=0, int spacing=-1, const std::string &name="GridLayout::anon") | |
GridLayout (int spacing=-1, const std::string &name="GridLayout::anon") | |
void | insert (const LayoutItem *li, int row, int column) |
void | insert (const LayoutItem *li, int row_from, int row_to, int column_from, int column_to) |
virtual void | addItem (LayoutItem *li) |
virtual void | setGeometry (const Rect &r) |
fixup all managed widgets geometry | |
virtual void | setRowStretch (int row, int stretch) |
virtual void | setColStretch (int col, int stretch) |
int | rowStretch (int row) const |
int | colStretch (int col) const |
virtual bool | isEmpty () const |
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 *) |
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 void | validate () |
let's calc again sizeHint, minimumSize etc | |
int | secondaryEdges () const |
std::vector< int > & | secondaryStretch () |
std::vector< int > & | secondaryEffectiveStretch () |
std::vector< int > & | secondaryExtraSpace () |
std::vector< int > & | primaryCellItemLength () |
std::vector< int > & | primaryCellLength () |
bool | mayGrowPrimally (int edge_index) const |
bool | expandingPrimally (int edge_index) const |
std::vector< int > & | primaryMinLength () |
std::vector< int > & | primaryHintLength () |
int | preferredLength (int edge_index, bool expand) |
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) |
Protected Attributes | |
std::queue< CellSpan > | cellSpanQueue |
Private Types | |
typedef MatrixLayoutItemMatrix::Edge | Edge |
Private Member Functions | |
void | init () |
void | onGridSizeChange (int rows_old, int cols_old, int rows, int cols) |
void | calcEdge (const int available_space, bool width_as_primary) |
calcs the width of the columns and the height of the rows | |
Private Attributes | |
std::vector< int > | max_min_width |
std::vector< int > | max_min_height |
std::vector< int > | max_hint_width |
std::vector< int > | max_hint_height |
std::vector< bool > | row_empty |
std::vector< bool > | col_empty |
std::vector< bool > | may_grow_horizontally |
std::vector< bool > | may_grow_vertically |
std::vector< bool > | expanding_horizontally |
std::vector< bool > | expanding_vertically |
std::vector< int > | row_stretch |
std::vector< int > | column_stretch |
std::vector< int > | row_stretch_effective |
std::vector< int > | column_stretch_effective |
std::vector< int > | row_extra_space |
std::vector< int > | column_extra_space |
std::vector< int > | row_height |
std::vector< int > | column_width |
std::vector< int > | container_row_height |
std::vector< int > | container_column_width |
Friends | |
class | Grid |
Classes | |
class | CellSpan |
Definition at line 79 of file gridlayout.h.
typedef Container::value_type Wt::LayoutStdContainer< Container >::Compound [inherited] |
typedef MatrixLayoutItemMatrix::Edge Wt::GridLayout::Edge [private] |
Definition at line 82 of file gridlayout.h.
typedef std::list<Object*> Wt::Object::List [inherited] |
Wt::GridLayout::GridLayout | ( | Widget * | parent, | |
int | margin = 0 , |
|||
int | spacing = -1 , |
|||
const std::string & | name = "GridLayout::anon" | |||
) |
Definition at line 44 of file gridlayout.cpp.
References init().
Here is the call graph for this function:
Wt::GridLayout::GridLayout | ( | Layout * | parent_layout, | |
int | margin = 0 , |
|||
int | spacing = -1 , |
|||
const std::string & | name = "GridLayout::anon" | |||
) |
Definition at line 50 of file gridlayout.cpp.
References init().
00051 : 00052 GridLayoutBase(parent_layout, margin, spacing, name) { 00053 init(); 00054 }
Here is the call graph for this function:
Wt::GridLayout::GridLayout | ( | int | spacing = -1 , |
|
const std::string & | name = "GridLayout::anon" | |||
) |
Definition at line 56 of file gridlayout.cpp.
References init().
00056 : 00057 GridLayoutBase(spacing, name) { 00058 init(); 00059 }
Here is the call graph for this function:
void Wt::GridLayout::addItem | ( | LayoutItem * | li | ) | [virtual] |
Reimplemented from Wt::LayoutStdContainer< Container >.
Definition at line 497 of file gridlayout.cpp.
References Wt::Layout::addItem(), cellSpanQueue, Wt::LayoutStdContainer< Container >::exists(), insert(), Wt::LayoutStdContainer< Container >::removeItem(), trace, and Wt::LayoutStdContainer< Container >::value().
Referenced by Wt::Grid::operator=().
00497 { 00498 // obvious optimization. if exists and it is already in position do nothing 00499 GridLayout::const_iterator it = find(begin(), end(), li); 00500 bool exists = (it != end()); 00501 00502 if (exists && !cellSpanQueue.empty()) { 00503 const CellSpan& cs = cellSpanQueue.front(); 00504 const MatrixLayoutItemValue& value = *it; 00505 if (it.row() == cs.rowFrom() && it.column() == cs.columnFrom() && 00506 value.rowSpan() == cs.rowSpan() && value.columnSpan() == cs.columnSpan()) { 00507 cellSpanQueue.pop(); 00508 return; 00509 } 00510 } 00511 00512 // remove if already exists. This is used for cell reassigning 00513 if (exists) { 00514 removeItem(li); 00515 } 00516 trace("gridlayout", "GridLayout::addItem layoutItem %p\n", li); 00517 Layout::addItem(li); 00518 00519 if (!cellSpanQueue.empty()) { 00520 const CellSpan& cs = cellSpanQueue.front(); 00521 if (cs.layoutItem() == li) { 00522 insert(cs.layoutItem(), cs.rowFrom(), cs.rowTo(), 00523 cs.columnFrom(), cs.columnTo()); 00524 cellSpanQueue.pop(); 00525 return; 00526 } 00527 } 00528 push_back(li); 00529 }
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::GridLayout::calcEdge | ( | const int | available_space, | |
bool | width_as_primary | |||
) | [private] |
calcs the width of the columns and the height of the rows
it's not funny if we have to do it two times both for width and height so we are are heavily using the generic names length and edge to indicate width or height and row or column.
Definition at line 228 of file gridlayout.cpp.
References expandingPrimally(), Wt::Layout::isWidthPrimaryLength(), mayGrowPrimally(), Wt::Layout::minimumSize(), preferredLength(), primaryCellItemLength(), primaryCellLength(), primaryHintLength(), Wt::Layout::primaryLength(), primaryMinLength(), secondaryEdges(), secondaryEffectiveStretch(), secondaryExtraSpace(), secondaryStretch(), Wt::Layout::setWidthasPrimaryLength(), Wt::Layout::sizeHint(), and trace.
Referenced by setGeometry().
00228 { 00229 int expansion; 00230 bool expand; 00231 int stretch_sum = 0; 00232 int may_grow_num = 0; 00233 int unclaimed_space = 0; 00234 int j; 00235 00236 setWidthasPrimaryLength(width_as_primary); 00237 00238 std::vector<int>& hint_length = primaryHintLength(); 00239 std::vector<int>& min_length = primaryMinLength(); 00240 std::vector<int>& effective_stretch = secondaryEffectiveStretch(); 00241 std::vector<int>& stretch = secondaryStretch(); 00242 std::vector<int>& extra_space = secondaryExtraSpace(); 00243 std::vector<int>& length = primaryCellItemLength(); 00244 std::vector<int>& container_length = primaryCellLength(); 00245 00246 int edges = secondaryEdges(); 00247 00248 effective_stretch.resize(edges); 00249 extra_space.resize(edges); 00250 length.resize(edges); 00251 container_length.resize(edges); 00252 00253 trace("gridlayout", "GridLayout:: Available space for %s %d\n", 00254 (isWidthPrimaryLength()) ? "width" : "height", total_space); 00255 expansion = total_space - Layout::primaryLength(sizeHint()); 00256 expand = expansion >= 0; 00257 if (!expand) { 00258 expansion = total_space - Layout::primaryLength(minimumSize()); 00259 } 00260 00261 // initialize effective stretch to zero 00262 for (j = 0; j < edges; j++) { 00263 effective_stretch[j] = 0; 00264 } 00265 00266 // we have to expand 00267 // first check if there are any stretch values 00268 for (j = 0; j < edges; j++) { 00269 int li_stretch = stretch[j]; 00270 if (li_stretch && mayGrowPrimally(j)) { 00271 unclaimed_space += preferredLength(j, expand); 00272 stretch_sum += li_stretch; 00273 effective_stretch[j] = li_stretch; 00274 may_grow_num++; 00275 } 00276 } 00277 00278 // check if we have to split the extra space among expanding 00279 if (!stretch_sum) { 00280 may_grow_num = 0; 00281 unclaimed_space = 0; 00282 for (j = 0; j < edges; j++) { 00283 if (expandingPrimally(j)) { 00284 unclaimed_space += preferredLength(j, expand); 00285 effective_stretch[j] = 1; 00286 may_grow_num++; 00287 } 00288 } 00289 stretch_sum = may_grow_num; 00290 } 00291 00292 // check if we have to split the extra space among may Grow simply (preferred) 00293 if (!may_grow_num) { 00294 unclaimed_space = 0; 00295 for (j = 0; j < edges; j++) { 00296 if (mayGrowPrimally(j)) { 00297 unclaimed_space += preferredLength(j, expand); 00298 effective_stretch[j] = 1; 00299 may_grow_num++; 00300 } 00301 } 00302 stretch_sum = may_grow_num; 00303 } 00304 00305 // none of the fuckers grows -- all fixed size 00306 if (!may_grow_num) { 00307 unclaimed_space = 0; 00308 for (j = 0; j < edges; j++) { 00309 int preferred_length = preferredLength(j, expand); 00310 if (preferred_length) { 00311 unclaimed_space += preferred_length; 00312 effective_stretch[j] = 1; 00313 may_grow_num++; 00314 } 00315 } 00316 stretch_sum = may_grow_num; 00317 } 00318 00319 // Now we will remove offenders until we can distribute evenly 00320 int available_space; 00321 int claimed_space; 00322 restart: 00323 /// \todo find biggest offender not the first one 00324 available_space = expansion + unclaimed_space; 00325 claimed_space = 0; 00326 for (j = 0; j < edges; j++) { 00327 if (effective_stretch[j]) { 00328 int li_p = (effective_stretch[j] * 00329 available_space) / stretch_sum; 00330 int preferred_length = preferredLength(j, expand); 00331 if (li_p < preferred_length) { 00332 // problem: offender found, remove him 00333 trace("gridlayout", "Removing offender at pos %d with " 00334 "stretch %d stretch_sum %d unclaimed_space %d\n", 00335 j, effective_stretch[j], stretch_sum, unclaimed_space); 00336 unclaimed_space -= preferred_length; 00337 stretch_sum -= effective_stretch[j]; 00338 effective_stretch[j] = 0; 00339 may_grow_num--; 00340 goto restart; 00341 } 00342 claimed_space += li_p; 00343 } 00344 } 00345 00346 // now we have to distribute evenly the difference 00347 // that got truncated in the integer division 00348 int rest_space = available_space - claimed_space; 00349 int div = 0; 00350 int modulo = 0; 00351 if (may_grow_num) { 00352 div = rest_space / may_grow_num; 00353 modulo = rest_space % may_grow_num; 00354 } 00355 00356 int count = 0; 00357 for (j = 0; j < edges; j++) { 00358 if (effective_stretch[j]) { 00359 extra_space[j] = div + (count < modulo) ? 1 : 0; 00360 } else { 00361 extra_space[j] = 0; 00362 } 00363 count++; 00364 } 00365 00366 // finally calc the size 00367 for (j = 0; j < edges; j++) { 00368 const int space = ( (effective_stretch[j]) ? 00369 (effective_stretch[j] * available_space) / 00370 stretch_sum : 00371 preferredLength(j, expand) ) + extra_space[j]; 00372 container_length[j] = space; 00373 length[j] = (mayGrowPrimally(j)) ? 00374 space : (hint_length[j] <= space) ? 00375 hint_length[j] : min_length[j]; 00376 trace("gridlayout", "GridLayout:: Allocating space " 00377 "(%d) %d for edge %d\n", isWidthPrimaryLength(), space, j); 00378 } 00379 }
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 }
Definition at line 107 of file gridlayout.h.
References column_stretch.
00107 { 00108 return column_stretch[col]; 00109 }
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, inherited] |
Implements Wt::Layout.
Definition at line 514 of file layout.h.
Referenced by 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::GridLayout::expandingPrimally | ( | int | edge_index | ) | const [inline, protected] |
Definition at line 146 of file gridlayout.h.
References expanding_horizontally, expanding_vertically, and Wt::Layout::isWidthPrimaryLength().
Referenced by calcEdge().
00146 { 00147 return isWidthPrimaryLength() ? 00148 expanding_horizontally[edge_index] : 00149 expanding_vertically[edge_index]; 00150 }
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(), 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::GridLayout::init | ( | ) | [private] |
Reimplemented from Wt::Layout.
Definition at line 40 of file gridlayout.cpp.
References onGridSizeChange().
Referenced by GridLayout().
00040 { 00041 gridSizeChanged.connect(sigc::mem_fun(*this, &GridLayout::onGridSizeChange)); 00042 }
Here is the call graph for this function:
void Wt::GridLayout::insert | ( | const LayoutItem * | li, | |
int | row_from, | |||
int | row_to, | |||
int | column_from, | |||
int | column_to | |||
) |
Definition at line 480 of file gridlayout.cpp.
References Wt::MatrixLayoutItemValue::Original, Wt::MatrixLayoutItemValue::Reference, trace, and Wt::LayoutStdContainer< Container >::value().
00481 { 00482 const int row_span = row_to - row_from + 1; 00483 const int col_span = column_to - column_from + 1; 00484 trace("gridlayout", "Span insertion [%d %d] to [%d %d]\n", 00485 row_from, column_from, row_to, column_to); 00486 for (int r = row_from; r <= row_to; r++) { 00487 for (int c = column_from; c <= column_to; c++) { 00488 MatrixLayoutItemValue value( 00489 (r == row_from && c == column_from) ? 00490 MatrixLayoutItemValue::Original : 00491 MatrixLayoutItemValue::Reference, row_span, col_span); 00492 (*this)(r, c) = MatrixLayoutItemCompound(li, value); 00493 } 00494 } 00495 }
Here is the call graph for this function:
void Wt::GridLayout::insert | ( | const LayoutItem * | li, | |
int | row, | |||
int | column | |||
) |
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, inherited] |
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 calcEdge(), expandingPrimally(), mayGrowPrimally(), primaryCellItemLength(), primaryCellLength(), primaryHintLength(), primaryMinLength(), secondaryEdges(), secondaryEffectiveStretch(), secondaryExtraSpace(), secondaryStretch(), and Wt::Box::setStretchFactor().
00321 { 00322 return width_as_primary_length; 00323 }
virtual LayoutIterator Wt::LayoutStdContainer< Container >::iterator | ( | ) | [inline, virtual, inherited] |
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(), 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::GridLayout::mayGrowPrimally | ( | int | edge_index | ) | const [inline, protected] |
Definition at line 140 of file gridlayout.h.
References Wt::Layout::isWidthPrimaryLength(), may_grow_horizontally, and may_grow_vertically.
Referenced by calcEdge().
00140 { 00141 return isWidthPrimaryLength() ? 00142 may_grow_horizontally[edge_index] : 00143 may_grow_vertically[edge_index]; 00144 }
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 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 61 of file gridlayout.cpp.
References col_empty, column_stretch, expanding_horizontally, expanding_vertically, max_hint_height, max_hint_width, max_min_height, max_min_width, may_grow_horizontally, may_grow_vertically, row_empty, row_stretch, and trace.
Referenced by init().
00062 { 00063 trace("gridlayout", 00064 "GridSizeChange: from %dx%d --> %dx%d\n", 00065 rows_old, cols_old, rows, cols); 00066 00067 if (!rows || !cols) 00068 return; 00069 00070 row_stretch.resize(rows); 00071 column_stretch.resize(cols); 00072 00073 max_min_width.resize(cols); 00074 max_min_height.resize(rows); 00075 max_hint_width.resize(cols); 00076 max_hint_height.resize(rows); 00077 row_empty.resize(rows); 00078 col_empty.resize(cols); 00079 00080 may_grow_horizontally.resize(cols); 00081 may_grow_vertically.resize(rows); 00082 expanding_horizontally.resize(cols); 00083 expanding_vertically.resize(rows); 00084 00085 for (int r = rows_old; r < rows; r++) { 00086 row_stretch[r] = 0; 00087 max_min_height[r] = 0; 00088 max_hint_height[r] = 0; 00089 row_empty[r] = true; 00090 may_grow_vertically[r] = false; 00091 expanding_vertically[r] = false; 00092 } 00093 00094 for (int c = 0; c < cols_old; c++) { 00095 column_stretch[c] = 0; 00096 max_min_width[c] = 0; 00097 max_hint_width[c] = 0; 00098 col_empty[c] = true; 00099 may_grow_horizontally[c] = false; 00100 expanding_horizontally[c] = false; 00101 } 00102 }
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, inherited] |
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(), setColStretch(), and 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:
Definition at line 160 of file gridlayout.h.
References primaryHintLength(), and primaryMinLength().
Referenced by calcEdge().
00160 { 00161 return (expand) ? primaryHintLength()[edge_index] : 00162 primaryMinLength()[edge_index]; 00163 }
Here is the call graph for this function:
std::vector<int>& Wt::GridLayout::primaryCellItemLength | ( | ) | [inline, protected] |
Definition at line 131 of file gridlayout.h.
References column_width, Wt::Layout::isWidthPrimaryLength(), and row_height.
Referenced by calcEdge().
00131 { 00132 return isWidthPrimaryLength() ? column_width : row_height; 00133 }
Here is the call graph for this function:
std::vector<int>& Wt::GridLayout::primaryCellLength | ( | ) | [inline, protected] |
Definition at line 135 of file gridlayout.h.
References container_column_width, container_row_height, and Wt::Layout::isWidthPrimaryLength().
Referenced by calcEdge().
00135 { 00136 return isWidthPrimaryLength() ? 00137 container_column_width : container_row_height; 00138 }
Here is the call graph for this function:
std::vector<int>& Wt::GridLayout::primaryHintLength | ( | ) | [inline, protected] |
Definition at line 156 of file gridlayout.h.
References Wt::Layout::isWidthPrimaryLength(), max_hint_height, and max_hint_width.
Referenced by calcEdge(), and preferredLength().
00156 { 00157 return isWidthPrimaryLength() ? max_hint_width : max_hint_height; 00158 }
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 calcEdge(), Wt::Layout::preferredLength(), Wt::BoxLayout::setGeometry(), and Wt::BoxLayout::validate().
00326 { 00327 return (width_as_primary_length) ? t.width() : t.height(); 00328 }
std::vector<int>& Wt::GridLayout::primaryMinLength | ( | ) | [inline, protected] |
Definition at line 152 of file gridlayout.h.
References Wt::Layout::isWidthPrimaryLength(), max_min_height, and max_min_width.
Referenced by calcEdge(), and preferredLength().
00152 { 00153 return isWidthPrimaryLength() ? max_min_width : max_min_height; 00154 }
Here is the call graph for this function:
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, inherited] |
returns true if a layoutitem is actually removed
Reimplemented from Wt::Layout.
Definition at line 500 of file layout.h.
Referenced by 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:
Definition at line 104 of file gridlayout.h.
References row_stretch.
00104 { 00105 return row_stretch[row]; 00106 }
int Wt::GridLayout::secondaryEdges | ( | ) | const [inline, protected] |
Definition at line 114 of file gridlayout.h.
References Wt::Layout::isWidthPrimaryLength().
Referenced by calcEdge().
00114 { 00115 return isWidthPrimaryLength() ? numCols() : numRows(); 00116 }
Here is the call graph for this function:
std::vector<int>& Wt::GridLayout::secondaryEffectiveStretch | ( | ) | [inline, protected] |
Definition at line 122 of file gridlayout.h.
References column_stretch_effective, Wt::Layout::isWidthPrimaryLength(), and row_stretch_effective.
Referenced by calcEdge().
00122 { 00123 return isWidthPrimaryLength() ? 00124 column_stretch_effective : row_stretch_effective; 00125 }
Here is the call graph for this function:
std::vector<int>& Wt::GridLayout::secondaryExtraSpace | ( | ) | [inline, protected] |
Definition at line 127 of file gridlayout.h.
References column_extra_space, Wt::Layout::isWidthPrimaryLength(), and row_extra_space.
Referenced by calcEdge().
00127 { 00128 return isWidthPrimaryLength() ? column_extra_space : row_extra_space; 00129 }
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 }
std::vector<int>& Wt::GridLayout::secondaryStretch | ( | ) | [inline, protected] |
Definition at line 118 of file gridlayout.h.
References column_stretch, Wt::Layout::isWidthPrimaryLength(), and row_stretch.
Referenced by calcEdge().
00118 { 00119 return isWidthPrimaryLength() ? column_stretch : row_stretch; 00120 }
Here is the call graph for this function:
Definition at line 471 of file gridlayout.cpp.
References column_stretch, and Wt::Layout::postLayoutHintEvent().
00471 { 00472 column_stretch[col] = stretch; 00473 postLayoutHintEvent(); 00474 }
Here is the call graph for this function:
void Wt::GridLayout::setGeometry | ( | const Rect & | r | ) | [virtual] |
fixup all managed widgets geometry
Reimplemented from Wt::Layout.
Definition at line 382 of file gridlayout.cpp.
References Wt::Rect::align(), calcEdge(), column_width, Wt::MatrixLayoutItemValue::columnSpan(), container_column_width, container_row_height, Wt::LayoutStdContainerIterator< Container >::finish(), Wt::LayoutItem::geometry(), Wt::Size::height(), Wt::SDLRect::height(), Wt::MatrixLayoutItemValue::isReference(), Wt::Layout::mainWidget(), Wt::Layout::margin, row_height, Wt::MatrixLayoutItemValue::rowSpan(), Wt::Layout::setGeometry(), Wt::Layout::spacing, Wt::LayoutStdContainerIterator< Container >::start(), trace, Wt::Size::width(), Wt::SDLRect::width(), Wt::SDLRect::x(), and Wt::SDLRect::y().
00382 { 00383 GridLayoutIterator it(*this); 00384 trace("gridlayout") << this << " GridLayout::setGeometry()" << std::endl; 00385 00386 // store geometry first 00387 Layout::setGeometry(r); 00388 // if smaller than the minSize it is possible that 00389 // we have to reacquire the size to perform the layout 00390 Rect rect = LayoutItem::geometry() >> margin; 00391 00392 // obvious optimization. If they are empty do nothing 00393 bool empty = true; 00394 for (it.start(); !it.finish(); it++) { 00395 LayoutItem *li = *it; 00396 if (li->isNonEmpty()) { 00397 empty = false; 00398 break; 00399 } 00400 } 00401 if (empty) 00402 return; 00403 00404 calcEdge(rect.width(), true); 00405 calcEdge(rect.height(), false); 00406 00407 // finally place them 00408 int covered_y = rect.y(); 00409 GridLayout& self = *this; 00410 for (int i = 0; i < numRows(); i++) { 00411 int covered_x = rect.x(); 00412 for (int j = 0; j < numCols(); j++) { 00413 LayoutItem *li = self(i, j); 00414 const MatrixLayoutItemValue& v = self(i, j); 00415 00416 if (!li->isNonEmpty()) 00417 continue; 00418 00419 // let's count the relevent sizes 00420 int container_width = 0; 00421 int container_height = 0; 00422 00423 const Size& hint_size = li->sizeHint(); 00424 const Size& min_size = li->minimumSize(); 00425 00426 for (int dr = 0; dr < v.rowSpan(); dr++) 00427 container_height += container_row_height[i + dr]; 00428 container_height += (v.rowSpan() - 1) * spacing; 00429 00430 for (int dc = 0; dc < v.columnSpan(); dc++) 00431 container_width += container_column_width[j + dc]; 00432 container_width += (v.columnSpan() - 1) * spacing; 00433 00434 const Size& container_size = Size(container_width, 00435 container_height); 00436 00437 const int cell_height = (li->sizePolicy().mayGrowVertically()) 00438 ? container_size.height() 00439 : (hint_size.height() <= container_size.height()) 00440 ? hint_size.height() 00441 : min_size.height(); 00442 00443 const int cell_width = (li->sizePolicy().mayGrowHorizontally()) 00444 ? container_size.width() 00445 : (hint_size.width() <= container_size.width()) 00446 ? hint_size.width() 00447 : min_size.width(); 00448 00449 const Size& cell_size = Size(cell_width, cell_height); 00450 00451 if (!v.isReference()) { 00452 trace("gridlayout") << "GridLayout:: layoutItem " << li 00453 << " in (" << i << "," << j << ") " << cell_size 00454 << " in " << container_size << std::endl; 00455 li->setGeometry( 00456 Rect::align(Rect(mainWidget()-> 00457 mapFromParent(Point(covered_x, covered_y)), 00458 container_size), cell_size, li->alignment)); 00459 } 00460 covered_x += column_width[j] + spacing; 00461 } 00462 covered_y += row_height[i] + spacing; 00463 } 00464 }
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(), validate(), and Wt::CascadeLayout::validate().
00151 { 00152 minimum_size_ = size; 00153 }
Definition at line 466 of file gridlayout.cpp.
References Wt::Layout::postLayoutHintEvent(), and row_stretch.
00466 { 00467 row_stretch[row] = stretch; 00468 postLayoutHintEvent(); 00469 }
Here is the call graph for this function:
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(), 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 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 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] |
void Wt::GridLayout::validate | ( | ) | [protected, virtual] |
let's calc again sizeHint, minimumSize etc
Reimplemented from Wt::LayoutItem.
Definition at line 105 of file gridlayout.cpp.
References Wt::adjust_cell_size(), col_empty, Wt::MatrixLayoutItemValue::columnSpan(), expanding_horizontally, expanding_vertically, Wt::MatrixLayoutItemValue::isMultiCell(), Wt::MatrixLayoutItemValue::isReference(), max_hint_height, max_hint_width, max_min_height, max_min_width, may_grow_horizontally, may_grow_vertically, row_empty, Wt::MatrixLayoutItemValue::rowSpan(), Wt::LayoutItem::setMinimumSize(), Wt::LayoutItem::setSizeHint(), Wt::Layout::spacing, trace, and Wt::LayoutItem::validate().
00105 { 00106 int hint_w = 0, hint_h = 0; 00107 int min_w = 0, min_h = 0; 00108 int row_count = 0, col_count = 0; 00109 int r, c; 00110 GridLayout& self = *this; 00111 int sp = spacing; 00112 00113 trace("gridlayout") << this << " GridLayout::invalidate()" << std::endl; 00114 00115 for (c = 0; c < numCols(); c++) { 00116 max_min_width[c] = 0; 00117 max_hint_width[c] = 0; 00118 col_empty[c] = true; 00119 may_grow_horizontally[c] = false; 00120 expanding_horizontally[c] = false; 00121 } 00122 00123 for (r = 0; r < numRows(); r++) { 00124 max_min_height[r] = 0; 00125 max_hint_height[r] = 0; 00126 row_empty[r] = true; 00127 may_grow_vertically[r] = false; 00128 expanding_vertically[r] = false; 00129 00130 for (c = 0; c < numCols(); c++) { 00131 const LayoutItem *li = self(r, c); 00132 const MatrixLayoutItemValue& v = self(r, c); 00133 00134 // skip multicells 00135 if (li->isNonEmpty() && !v.isMultiCell()) { 00136 max_min_width[c] = std::max(max_min_width[c], li->minimumSize().width()); 00137 max_min_height[r] = std::max(max_min_height[r], li->minimumSize().height()); 00138 max_hint_width[c] = std::max(max_hint_width[c], li->sizeHint().width()); 00139 max_hint_height[r] = std::max(max_hint_height[r], li->sizeHint().height()); 00140 } 00141 if (li->isNonEmpty()) { 00142 row_empty[r] = false; 00143 col_empty[c] = false; 00144 may_grow_horizontally[c] = may_grow_horizontally[c] || 00145 li->sizePolicy().mayGrowHorizontally(); 00146 may_grow_vertically[r] = may_grow_vertically[r] || 00147 li->sizePolicy().mayGrowVertically(); 00148 expanding_horizontally[c] = expanding_horizontally[c] || 00149 li->sizePolicy().expandingHorizontally(); 00150 expanding_vertically[r] = expanding_vertically[r] || 00151 li->sizePolicy().expandingVertically(); 00152 } 00153 } 00154 } 00155 00156 // for all multicells 00157 for (r = 0; r < numRows(); r++) { 00158 for (c = 0; c < numCols(); c++) { 00159 const LayoutItem *li = self(r, c); 00160 const MatrixLayoutItemValue& v = self(r, c); 00161 if (li->isNonEmpty() && v.isMultiCell() && !v.isReference()) { 00162 int dr, dc; 00163 int min_width_sum = 0, hint_width_sum = 0; 00164 int min_height_sum = 0, hint_height_sum = 0; 00165 // first mark the relevent row and columns non-empty 00166 // also let's count the relevent sizes 00167 for (dr = 0; dr < v.rowSpan(); dr++) { 00168 row_empty[r + dr] = false; 00169 min_height_sum += max_min_height[r + dr]; 00170 hint_height_sum += max_hint_height[r + dr]; 00171 } 00172 00173 for (dc = 0; dc < v.columnSpan(); dc++) { 00174 col_empty[c + dc] = false; 00175 min_width_sum += max_min_width[c + dc]; 00176 hint_width_sum += max_hint_width[c + dc]; 00177 } 00178 // for rows and columns for hint and min sizes 00179 adjust_cell_size(li->minimumSize().width(), min_width_sum, 00180 v.columnSpan(), c, max_min_width); 00181 adjust_cell_size(li->minimumSize().height(), min_height_sum, 00182 v.rowSpan(), r, max_min_height); 00183 adjust_cell_size(li->sizeHint().width(), hint_width_sum, 00184 v.columnSpan(), c, max_hint_width); 00185 adjust_cell_size(li->sizeHint().height(), hint_height_sum, 00186 v.rowSpan(), r, max_hint_height); 00187 } 00188 } 00189 } 00190 00191 for (r = 0; r < numRows(); r++) { 00192 if (!row_empty[r]) { 00193 row_count++; 00194 min_h += max_min_height[r]; 00195 hint_h += max_hint_height[r]; 00196 } 00197 } 00198 00199 for (c = 0; c < numCols(); c++) { 00200 if (!col_empty[c]) { 00201 col_count++; 00202 min_w += max_min_width[c]; 00203 hint_w += max_hint_width[c]; 00204 } 00205 } 00206 00207 // don't forget spacing 00208 if (row_count) { 00209 min_h += (row_count - 1) * sp; 00210 hint_h += (row_count - 1) * sp; 00211 } 00212 00213 if (col_count) { 00214 min_w += (col_count - 1) * sp; 00215 hint_w += (col_count - 1) * sp; 00216 } 00217 00218 setSizeHint(Size(hint_w, hint_h)); 00219 setMinimumSize(Size(min_w, min_h)); 00220 Layout::validate(); 00221 }
Here is the call graph for this function:
Compound::LayoutItemValue& Wt::LayoutStdContainer< Container >::value | ( | const LayoutItem * | li | ) | [inline, protected, inherited] |
Definition at line 520 of file layout.h.
Referenced by addItem(), 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 }
friend class Grid [friend] |
Definition at line 80 of file gridlayout.h.
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().
std::queue<CellSpan> Wt::GridLayout::cellSpanQueue [protected] |
std::vector<bool> Wt::GridLayout::col_empty [private] |
std::vector<int> Wt::GridLayout::column_extra_space [private] |
std::vector<int> Wt::GridLayout::column_stretch [private] |
Definition at line 262 of file gridlayout.h.
Referenced by colStretch(), onGridSizeChange(), secondaryStretch(), and setColStretch().
std::vector<int> Wt::GridLayout::column_stretch_effective [private] |
std::vector<int> Wt::GridLayout::column_width [private] |
Definition at line 268 of file gridlayout.h.
Referenced by primaryCellItemLength(), and setGeometry().
std::vector<int> Wt::GridLayout::container_column_width [private] |
std::vector<int> Wt::GridLayout::container_row_height [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().
std::vector<bool> Wt::GridLayout::expanding_horizontally [private] |
Definition at line 258 of file gridlayout.h.
Referenced by expandingPrimally(), onGridSizeChange(), and validate().
std::vector<bool> Wt::GridLayout::expanding_vertically [private] |
Definition at line 259 of file gridlayout.h.
Referenced by expandingPrimally(), onGridSizeChange(), and validate().
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(), setGeometry(), Wt::CascadeLayout::setGeometry(), Wt::Widget::setMaximumSize(), Wt::Widget::setMinimumSize(), and Wt::Widget::sizeHint().
std::vector<int> Wt::GridLayout::max_hint_height [private] |
Definition at line 252 of file gridlayout.h.
Referenced by onGridSizeChange(), primaryHintLength(), and validate().
std::vector<int> Wt::GridLayout::max_hint_width [private] |
Definition at line 251 of file gridlayout.h.
Referenced by onGridSizeChange(), primaryHintLength(), and validate().
std::vector<int> Wt::GridLayout::max_min_height [private] |
Definition at line 250 of file gridlayout.h.
Referenced by onGridSizeChange(), primaryMinLength(), and validate().
std::vector<int> Wt::GridLayout::max_min_width [private] |
Definition at line 249 of file gridlayout.h.
Referenced by onGridSizeChange(), primaryMinLength(), and validate().
std::vector<bool> Wt::GridLayout::may_grow_horizontally [private] |
Definition at line 256 of file gridlayout.h.
Referenced by mayGrowPrimally(), onGridSizeChange(), and validate().
std::vector<bool> Wt::GridLayout::may_grow_vertically [private] |
Definition at line 257 of file gridlayout.h.
Referenced by mayGrowPrimally(), onGridSizeChange(), and validate().
std::vector<bool> Wt::GridLayout::row_empty [private] |
std::vector<int> Wt::GridLayout::row_extra_space [private] |
std::vector<int> Wt::GridLayout::row_height [private] |
Definition at line 267 of file gridlayout.h.
Referenced by primaryCellItemLength(), and setGeometry().
std::vector<int> Wt::GridLayout::row_stretch [private] |
Definition at line 261 of file gridlayout.h.
Referenced by onGridSizeChange(), rowStretch(), secondaryStretch(), and setRowStretch().
std::vector<int> Wt::GridLayout::row_stretch_effective [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(), setGeometry(), Wt::BoxLayout::validate(), and 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.