+ _window = XCreateWindow(**display, (_parent ?
+ _parent->_window :
+ RootWindow(**display, _screen)),
+ _area.x(), _area.y(),
+ _area.width(), _area.height(),
+ _borderwidth,
+ info->depth(),
+ InputOutput,
+ info->visual(),
+ mask,
+ &attrib);
+ assert(_window != None);
+ ++_ignore_config;
+}
+
+void Widget::calcDefaultSizes()
+{
+ std::list<Widget*>::const_iterator it, end = _children.end();
+ int min_biggest = 0, max_biggest = 0;
+ int min_sum = _bevel + _borderwidth * 2;
+ int max_sum = _bevel + _borderwidth * 2;
+ bool fullmax = false;
+
+ for (it = _children.begin(); it != end; ++it) {
+ const otk::Size &min = (*it)->minSize();
+ const otk::Size &max = (*it)->maxSize();
+ if (_direction == Horizontal) {
+ if (min.height() > min_biggest) min_biggest = min.height();
+ if (max.height() > max_biggest) max_biggest = max.height();
+ min_sum += _bevel + min.width();
+ if (max.width() == INT_MAX)
+ fullmax = true;
+ else if (!fullmax)
+ max_sum += _bevel + max.width();
+ } else {
+ if (min.width() > min_biggest) min_biggest = min.width();
+ if (max.width() > max_biggest) max_biggest = max.width();
+ min_sum += _bevel + min.height();
+ if (max.height() == INT_MAX)
+ fullmax = true;
+ else if (!fullmax)
+ max_sum += _bevel + max.height();
+ }
+ }
+ if (_direction == Horizontal) {
+ _min_size = otk::Size(min_sum, min_biggest + (_bevel + _borderwidth) * 2);
+ _max_size = otk::Size((fullmax ? INT_MAX :
+ max_sum + (_bevel + _borderwidth) * 2),
+ max_biggest);
+ } else {
+ _min_size = otk::Size(min_biggest, min_sum + (_bevel + _borderwidth) * 2);
+ _max_size = otk::Size(max_biggest, (fullmax ? INT_MAX : max_sum +
+ (_bevel + _borderwidth) * 2));
+ }
+ update();