本文整理汇总了C++中PreferredSizeEvent::setPreferredSize方法的典型用法代码示例。如果您正苦于以下问题:C++ PreferredSizeEvent::setPreferredSize方法的具体用法?C++ PreferredSizeEvent::setPreferredSize怎么用?C++ PreferredSizeEvent::setPreferredSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PreferredSizeEvent
的用法示例。
在下文中一共展示了PreferredSizeEvent::setPreferredSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onPreferredSize
void Window::onPreferredSize(PreferredSizeEvent& ev)
{
Widget* manager = getManager();
if (m_isDesktop) {
Rect cpos = manager->getChildrenBounds();
ev.setPreferredSize(cpos.w, cpos.h);
}
else {
Size maxSize(0, 0);
Size reqSize;
UI_FOREACH_WIDGET(getChildren(), it) {
Widget* child = *it;
if (!child->isDecorative()) {
reqSize = child->getPreferredSize();
maxSize.w = MAX(maxSize.w, reqSize.w);
maxSize.h = MAX(maxSize.h, reqSize.h);
}
}
if (hasText())
maxSize.w = MAX(maxSize.w, jwidget_get_text_length(this));
ev.setPreferredSize(this->border_width.l + maxSize.w + this->border_width.r,
this->border_width.t + maxSize.h + this->border_width.b);
}
示例2: onPreferredSize
/**
Adds space for the non-client size.
@see getNonClientSize
*/
void TabBase::onPreferredSize(PreferredSizeEvent& ev)
{
Size ncSize = getNonClientSize();
if (ev.fitInWidth() || ev.fitInHeight()) {
ev.setPreferredSize(max_value(0, ev.fitInWidth() - ncSize.w),
max_value(0, ev.fitInHeight() - ncSize.h));
}
Widget::onPreferredSize(ev);
ev.setPreferredSize(ev.getPreferredSize() + ncSize);
}
示例3: onPreferredSize
void View::onPreferredSize(PreferredSizeEvent& ev)
{
Size viewSize = m_viewport.getPreferredSize();
viewSize.w += this->border_width.l + this->border_width.r;
viewSize.h += this->border_width.t + this->border_width.b;
ev.setPreferredSize(viewSize);
}
示例4: onPreferredSize
void TextBox::onPreferredSize(PreferredSizeEvent& ev)
{
int w = 0;
int h = 0;
// TODO is it necessary?
//w = widget->border_width.l + widget->border_width.r;
//h = widget->border_width.t + widget->border_width.b;
_ji_theme_textbox_draw(NULL, this, &w, &h, 0, 0);
if (this->getAlign() & JI_WORDWRAP) {
View* view = View::getView(this);
int width, min = w;
if (view) {
width = view->getViewportBounds().w;
}
else {
width = jrect_w(this->rc);
}
w = MAX(min, width);
_ji_theme_textbox_draw(NULL, this, &w, &h, 0, 0);
w = min;
}
ev.setPreferredSize(gfx::Size(w, h));
}
示例5: onPreferredSize
void ToolBar::onPreferredSize(PreferredSizeEvent& ev)
{
Size iconsize = getToolIconSize(this);
iconsize.w += this->border_width.l + this->border_width.r;
iconsize.h += this->border_width.t + this->border_width.b;
ev.setPreferredSize(iconsize);
}
示例6: onPreferredSize
void ComboBox::onPreferredSize(PreferredSizeEvent& ev)
{
Size sz(m_maxItemSize.w + (::GetSystemMetrics(SM_CXEDGE)*4 +
::GetSystemMetrics(SM_CXVSCROLL)),
m_maxItemSize.h + (::GetSystemMetrics(SM_CYEDGE)*4));
ev.setPreferredSize(sz);
}
示例7: onPreferredSize
void ImageView::onPreferredSize(PreferredSizeEvent& ev)
{
struct jrect box, text, icon;
jwidget_get_texticon_info(this, &box, &text, &icon,
getAlign(), m_bmp->w, m_bmp->h);
ev.setPreferredSize(gfx::Size(border_width.l + jrect_w(&box) + border_width.r,
border_width.t + jrect_h(&box) + border_width.b));
}
示例8: onPreferredSize
void ColorButton::onPreferredSize(PreferredSizeEvent& ev)
{
gfx::Rect box;
getTextIconInfo(&box);
box.w = 64*guiscale();
ev.setPreferredSize(box.w + border_width.l + border_width.r,
box.h + border_width.t + border_width.b);
}
示例9: onPreferredSize
void ImageView::onPreferredSize(PreferredSizeEvent& ev)
{
gfx::Rect box;
getTextIconInfo(&box, NULL, NULL,
getAlign(), m_bmp->w, m_bmp->h);
ev.setPreferredSize(gfx::Size(border_width.l + box.w + border_width.r,
border_width.t + box.h + border_width.b));
}
示例10: onPreferredSize
void onPreferredSize(PreferredSizeEvent& ev) override {
ListItem::onPreferredSize(ev);
if (m_image) {
gfx::Size sz = ev.getPreferredSize();
ev.setPreferredSize(
sz.w + 4 + m_image->width(),
MAX(sz.h, m_image->height()));
}
}
示例11: onPreferredSize
void ColorButton::onPreferredSize(PreferredSizeEvent& ev)
{
gfx::Rect box;
getTextIconInfo(&box);
box.w = 64*guiscale();
ev.setPreferredSize(box.w + border().width(),
box.h + border().height());
}
示例12: onPreferredSize
void ColorButton::onPreferredSize(PreferredSizeEvent& ev)
{
gfx::Rect box;
jwidget_get_texticon_info(this, &box, NULL, NULL, 0, 0, 0);
box.w = 64;
ev.setPreferredSize(box.w + border_width.l + border_width.r,
box.h + border_width.t + border_width.b);
}
示例13: onPreferredSize
void ImageView::onPreferredSize(PreferredSizeEvent& ev)
{
gfx::Rect box;
getTextIconInfo(&box, NULL, NULL,
getAlign(), m_sur->width(), m_sur->height());
ev.setPreferredSize(
gfx::Size(
box.w + border().width(),
box.h + border().height()));
}
示例14: onPreferredSize
void SearchEntry::onPreferredSize(PreferredSizeEvent& ev)
{
Entry::onPreferredSize(ev);
Size sz = ev.getPreferredSize();
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
auto icon = theme->parts.iconSearch()->getBitmap(0);
sz.h = MAX(sz.h, icon->height()+border().height());
ev.setPreferredSize(sz);
}
示例15: onPreferredSize
void Tabs::onPreferredSize(PreferredSizeEvent& ev)
{
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
gfx::Size reqsize(0, theme->get_part(PART_TAB_BOTTOM_NORMAL)->height());
if (!m_list_of_tabs.empty()) {
reqsize.h += theme->get_part(PART_TAB_FILLER)->height();
}
ev.setPreferredSize(reqsize);
}