Exemple #1
0
void TreeViewItem::OnInitialized()
{
    __super::OnInitialized();

    suic::ObjectPtr Expanded = FindResource(_T("Expanded"));
    suic::ObjectPtr Collapsed = FindResource(_T("Collapsed"));

    TreeButton* pBtn = new TreeButton(Expanded, Collapsed);
    _expand = pBtn;

    _expand->SetVisible(false);

    pBtn->Expanded.Add(this, &TreeViewItem::OnExpanded);
    pBtn->Collapsed.Add(this, &TreeViewItem::OnCollapsed);

    SetWidth(suic::NonInt);
    SetHeight(suic::NonInt);

    SetMinHeight(16);

    TreeItemHeaderPtr itemHead(_header);

    itemHead->SetStyle(FindResource(itemHead->GetClassName()));

    SetText(_T(""));

    _icon = suic::ImageBrushPtr::cast(GetStyle()->GetValue(_T("Icon")));

    _check.SetStyle(FindResource(_check.GetClassName()));
    _check.BeginInit();
    _check.EndInit();
}
void t4p::StatusBarWithGaugeClass::RedrawGauges() {
    // Each gauge takes it 2 columns (one for the gauge title and one for the gauge itself),
    // plus the leftmost default status bar columns (for the menu help and other messages)
    const int DEFAULT_COLUMNS = 2;
    int newColumnCount = (Gauges.size() * 2) + DEFAULT_COLUMNS;
    int* widths = new int[newColumnCount];
    for (int i = 0; i < DEFAULT_COLUMNS; ++i) {
        widths[i] = -1;
    }
    for (int i = DEFAULT_COLUMNS; i < newColumnCount; i += 2) {
        widths[i] = 150;
        widths[i + 1] = 300;
    }
    SetFieldsCount(newColumnCount);
    SetStatusWidths(newColumnCount, widths);

    // ATTN: in MSW this line results in a crash why??
    wxPlatformInfo platform;
    if (!(wxOS_WINDOWS | platform.GetOperatingSystemId())) {
        SetMinHeight(BITMAP_SIZE_Y);
    }
    int col = DEFAULT_COLUMNS;
    for (std::map<int, wxGauge*>::iterator it = Gauges.begin(); it != Gauges.end(); ++it) {
        SetStatusText(GaugeTitles[it->first], col++);
        wxRect rect;
        GetFieldRect(col++, rect);
        it->second->SetSize(rect.x + 2, rect.y + 2, rect.width - 4, rect.height - 4);
    }
    delete[] widths;
}
Exemple #3
0
void CControlUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
{
    if( _tcscmp(pstrName, _T("id")) == 0 ) SetID(_ttoi(pstrValue));
	else if(_tcscmp(pstrName,_T("font")) == 0)  SetFont(_ttoi(pstrValue));
	else if(_tcscmp(pstrName, _T("name")) == 0) SetName(pstrValue);
    else if( _tcscmp(pstrName, _T("width")) == 0 ) SetFixedWidth(_ttoi(pstrValue));
    else if( _tcscmp(pstrName, _T("height")) == 0 ) SetFixedHeight(_ttoi(pstrValue));
    else if( _tcscmp(pstrName, _T("minwidth")) == 0 ) SetMinWidth(_ttoi(pstrValue));
    else if( _tcscmp(pstrName, _T("minheight")) == 0 ) SetMinHeight(_ttoi(pstrValue));
    else if( _tcscmp(pstrName, _T("maxwidth")) == 0 ) SetMaxWidth(_ttoi(pstrValue));
    else if( _tcscmp(pstrName, _T("maxheight")) == 0 ) SetMaxHeight(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, _T("inset")) == 0) {
		RECT rcInset = { 0 };
		LPTSTR pstr = NULL;
		rcInset.left = _tcstol(pstrValue, &pstr, 10);
		rcInset.top = _tcstol(pstr + 1, &pstr, 10); 
		rcInset.right = _tcstol(pstr + 1, &pstr, 10);
		rcInset.bottom = _tcstol(pstr + 1, &pstr, 10);
		SetInset(rcInset);
	}
	else if(_tcscmp(pstrName, _T("visible")) == 0){
		bool bVisible = _tcscmp(pstrValue, _T("true"))==0;
		SetVisible(bVisible);
	}
	else if(_tcscmp(pstrName, _T("display")) == 0) SetDisplayed(_tcscmp(pstrValue, _T("true"))==0);
	else{
#ifdef _DEBUG
		MessageBox(NULL, pstrValue, pstrName, MB_ICONEXCLAMATION);
#endif
	}
}
Exemple #4
0
void AnimateBox::OnInitialized()
{
    __super::OnInitialized();

    SetMinWidth(_wid);
    SetMinHeight(_hei);
}
CInputField::CInputField(const std::string &t, EInputType e, int max,
                         char out) : m_Text(t), m_iMaxChars(max), m_cOut(out), m_eInputType(e),
                                     m_StartPos(0), m_CursorPos(0)
{
//     SetFColors(COLOR_YELLOW, COLOR_RED);
//     SetDFColors(COLOR_WHITE, COLOR_RED);
    SetMinHeight(3);
    SetBox(true);
}
Exemple #6
0
void EBox::SetMargin(float left, float right, float up, float down) {
	_marginLeft = left;
	_marginRight = right;
	_marginUp = up;
	_marginDown = down;

	SetMinWidth();
	SetMinHeight();
	UpdateGeometry();
	UpdateChild();
}
Exemple #7
0
void AnimateBox::AddGif(const suic::String& strPath)
{
    suic::GifDescriptor gd;

    gd.w = 0;
    gd.h = 0;

    suic::SystemHelper::LoadGif(strPath, gd, _frames);

    _wid = gd.w;
    _hei = gd.h;
    _bkcolor = gd.bkcolor;

    SetMinWidth(_wid);
    SetMinHeight(_hei);
}
Exemple #8
0
Slider::Slider()
{
    SetClassName(_T("Slider"));

    SetMinHeight(10);
    SetMinWidth(50);

    SetHorizontalContentAlignment(suic::LEFT);
    SetHorizontalAlignment(suic::LEFT);

    SetVerticalContentAlignment(suic::TOP);
    SetVerticalAlignment(suic::TOP);

    SliderButton* pSliderBtn = new SliderButton(this);
    _thumbBtn = pSliderBtn;

    pSliderBtn->ThumbDragDelta.Add(this, &Slider::OnThumbDragDelta);
}
Exemple #9
0
MyStatusBar::MyStatusBar(wxWindow *parent, long style)
        : wxStatusBar(parent, wxID_ANY, style, "MyStatusBar")
#if wxUSE_TIMER
            , m_timer(this)
#endif
#if wxUSE_CHECKBOX
            , m_checkbox(NULL)
#endif
{
    // compute the size needed for num lock indicator pane
    wxClientDC dc(this);
    wxSize sizeNumLock = dc.GetTextExtent(numlockIndicators[0]);
    sizeNumLock.IncTo(dc.GetTextExtent(numlockIndicators[1]));

    int widths[Field_Max];
    widths[Field_Text] = -1; // growable
    widths[Field_Checkbox] = 150;
    widths[Field_Bitmap] = BITMAP_SIZE_X;
    widths[Field_NumLockIndicator] = sizeNumLock.x;
    widths[Field_Clock] = 100;
    widths[Field_CapsLockIndicator] = dc.GetTextExtent(capslockIndicators[1]).x;

    SetFieldsCount(Field_Max);
    SetStatusWidths(Field_Max, widths);

#if wxUSE_CHECKBOX
    m_checkbox = new wxCheckBox(this, StatusBar_Checkbox, wxT("&Toggle clock"));
    m_checkbox->SetValue(true);
#endif

    m_statbmp = new wxStaticBitmap(this, wxID_ANY, wxIcon(green_xpm));

#if wxUSE_TIMER
    m_timer.Start(1000);
#endif

    SetMinHeight(wxMax(m_statbmp->GetBestSize().GetHeight(),
                       m_checkbox->GetBestSize().GetHeight()));

    UpdateClock();
}
Exemple #10
0
void TreeViewItem::OnInitialized()
{
    __super::OnInitialized();

    _headerHost->SetClassName(_T("TreeViewItem"));

    TreeButton* pBtn = dynamic_cast<TreeButton*>(_expand.get());

    suic::ObjectPtr Expanded = FindResource(_T("Expanded"));
    suic::ObjectPtr Collapsed = FindResource(_T("Collapsed"));

    _check.SetVisible(false);
    pBtn->SetButton(Expanded, Collapsed);

    pBtn->Expanded += TreeButtonClickEventHandler(this, &TreeViewItem::OnExpanded);
    pBtn->Collapsed += TreeButtonClickEventHandler(this, &TreeViewItem::OnCollapsed);

    SetWidth(suic::NonInt);
    SetHeight(suic::NonInt);

    SetMinHeight(16);
    _headerHost->DoInit();
}
CProgressBar::CProgressBar(float min, float max) : m_fMin(min), m_fMax(max), m_fCurrent(min)
{
    SetMinHeight(3);
    SetBox(true);
}
Exemple #12
0
	void CControlUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
	{
		// ÊÇ·ñÑùʽ±í
		if(m_pManager != NULL) {
			LPCTSTR pStyle = m_pManager->GetStyle(pstrValue);
			if( pStyle != NULL) {
				ApplyAttributeList(pStyle);
				return;
			}
		}
		if( _tcsicmp(pstrName, _T("pos")) == 0 ) {
			RECT rcPos = { 0 };
			LPTSTR pstr = NULL;
			rcPos.left = _tcstol(pstrValue, &pstr, 10);  ASSERT(pstr);    
			rcPos.top = _tcstol(pstr + 1, &pstr, 10);    ASSERT(pstr);    
			rcPos.right = _tcstol(pstr + 1, &pstr, 10);  ASSERT(pstr);    
			rcPos.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);    
			SIZE szXY = {rcPos.left >= 0 ? rcPos.left : rcPos.right, rcPos.top >= 0 ? rcPos.top : rcPos.bottom};
			SetFixedXY(szXY);
			SetFixedWidth(rcPos.right - rcPos.left);
			SetFixedHeight(rcPos.bottom - rcPos.top);
		}
		else if( _tcsicmp(pstrName, _T("float")) == 0 ) {
			CDuiString nValue = pstrValue;
			// ¶¯Ì¬¼ÆËãÏà¶Ô±ÈÀý
			if(nValue.Find(',') < 0) {
				SetFloat(_tcsicmp(pstrValue, _T("true")) == 0);
			}
			else {
				TPercentInfo piFloatPercent = { 0 };
				LPTSTR pstr = NULL;
				piFloatPercent.left = _tcstod(pstrValue, &pstr);  ASSERT(pstr);
				piFloatPercent.top = _tcstod(pstr + 1, &pstr);    ASSERT(pstr);
				piFloatPercent.right = _tcstod(pstr + 1, &pstr);  ASSERT(pstr);
				piFloatPercent.bottom = _tcstod(pstr + 1, &pstr); ASSERT(pstr);
				SetFloatPercent(piFloatPercent);
				SetFloat(true);
			}
		}
		else if( _tcsicmp(pstrName, _T("padding")) == 0 ) {
			RECT rcPadding = { 0 };
			LPTSTR pstr = NULL;
			rcPadding.left = _tcstol(pstrValue, &pstr, 10);  ASSERT(pstr);    
			rcPadding.top = _tcstol(pstr + 1, &pstr, 10);    ASSERT(pstr);    
			rcPadding.right = _tcstol(pstr + 1, &pstr, 10);  ASSERT(pstr);    
			rcPadding.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);    
			SetPadding(rcPadding);
		}
		else if( _tcsicmp(pstrName, _T("bkcolor")) == 0 || _tcsicmp(pstrName, _T("bkcolor1")) == 0 ) {
			while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue);
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetBkColor(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("bkcolor2")) == 0 ) {
			while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue);
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetBkColor2(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("bkcolor3")) == 0 ) {
			while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue);
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetBkColor3(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("forecolor")) == 0 ) {
			while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue);
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetForeColor(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("bordercolor")) == 0 ) {
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetBorderColor(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("focusbordercolor")) == 0 ) {
			if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
			LPTSTR pstr = NULL;
			DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
			SetFocusBorderColor(clrColor);
		}
		else if( _tcsicmp(pstrName, _T("colorhsl")) == 0 ) SetColorHSL(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("bordersize")) == 0 ) {
			CDuiString nValue = pstrValue;
			if(nValue.Find(',') < 0) {
				SetBorderSize(_ttoi(pstrValue));
				RECT rcPadding = {0};
				SetBorderSize(rcPadding);
			}
			else {
				RECT rcPadding = { 0 };
				LPTSTR pstr = NULL;
				rcPadding.left = _tcstol(pstrValue, &pstr, 10);  ASSERT(pstr);
				rcPadding.top = _tcstol(pstr + 1, &pstr, 10);    ASSERT(pstr);
				rcPadding.right = _tcstol(pstr + 1, &pstr, 10);  ASSERT(pstr);
				rcPadding.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
				SetBorderSize(rcPadding);
			}
		}
		else if( _tcsicmp(pstrName, _T("leftbordersize")) == 0 ) SetLeftBorderSize(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("topbordersize")) == 0 ) SetTopBorderSize(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("rightbordersize")) == 0 ) SetRightBorderSize(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("bottombordersize")) == 0 ) SetBottomBorderSize(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("borderstyle")) == 0 ) SetBorderStyle(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("borderround")) == 0 ) {
			SIZE cxyRound = { 0 };
			LPTSTR pstr = NULL;
			cxyRound.cx = _tcstol(pstrValue, &pstr, 10);  ASSERT(pstr);    
			cxyRound.cy = _tcstol(pstr + 1, &pstr, 10);    ASSERT(pstr);
			SetBorderRound(cxyRound);
		}
		else if( _tcsicmp(pstrName, _T("bkimage")) == 0 ) SetBkImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("foreimage")) == 0 ) SetForeImage(pstrValue);
		else if( _tcsicmp(pstrName, _T("width")) == 0 ) SetFixedWidth(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("height")) == 0 ) SetFixedHeight(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("minwidth")) == 0 ) SetMinWidth(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("minheight")) == 0 ) SetMinHeight(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("maxwidth")) == 0 ) SetMaxWidth(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("maxheight")) == 0 ) SetMaxHeight(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("name")) == 0 ) SetName(pstrValue);
		else if( _tcsicmp(pstrName, _T("drag")) == 0 ) SetDragEnable(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("drop")) == 0 ) SetDropEnable(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("resourcetext")) == 0 ) SetResourceText(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("text")) == 0 ) SetText(pstrValue);
		else if( _tcsicmp(pstrName, _T("tooltip")) == 0 ) SetToolTip(pstrValue);
		else if( _tcsicmp(pstrName, _T("userdata")) == 0 ) SetUserData(pstrValue);
		else if( _tcsicmp(pstrName, _T("enabled")) == 0 ) SetEnabled(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("mouse")) == 0 ) SetMouseEnabled(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("keyboard")) == 0 ) SetKeyboardEnabled(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("visible")) == 0 ) SetVisible(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("float")) == 0 ) SetFloat(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("shortcut")) == 0 ) SetShortcut(pstrValue[0]);
		else if( _tcsicmp(pstrName, _T("menu")) == 0 ) SetContextMenuUsed(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("cursor")) == 0 && pstrValue) {
			if( _tcsicmp(pstrValue, _T("arrow")) == 0 )			SetCursor(DUI_ARROW);
			else if( _tcsicmp(pstrValue, _T("ibeam")) == 0 )	SetCursor(DUI_IBEAM);
			else if( _tcsicmp(pstrValue, _T("wait")) == 0 )		SetCursor(DUI_WAIT);
			else if( _tcsicmp(pstrValue, _T("cross")) == 0 )	SetCursor(DUI_CROSS);
			else if( _tcsicmp(pstrValue, _T("uparrow")) == 0 )	SetCursor(DUI_UPARROW);
			else if( _tcsicmp(pstrValue, _T("size")) == 0 )		SetCursor(DUI_SIZE);
			else if( _tcsicmp(pstrValue, _T("icon")) == 0 )		SetCursor(DUI_ICON);
			else if( _tcsicmp(pstrValue, _T("sizenwse")) == 0 )	SetCursor(DUI_SIZENWSE);
			else if( _tcsicmp(pstrValue, _T("sizenesw")) == 0 )	SetCursor(DUI_SIZENESW);
			else if( _tcsicmp(pstrValue, _T("sizewe")) == 0 )	SetCursor(DUI_SIZEWE);
			else if( _tcsicmp(pstrValue, _T("sizens")) == 0 )	SetCursor(DUI_SIZENS);
			else if( _tcsicmp(pstrValue, _T("sizeall")) == 0 )	SetCursor(DUI_SIZEALL);
			else if( _tcsicmp(pstrValue, _T("no")) == 0 )		SetCursor(DUI_NO);
			else if( _tcsicmp(pstrValue, _T("hand")) == 0 )		SetCursor(DUI_HAND);
		}
		else if( _tcsicmp(pstrName, _T("virtualwnd")) == 0 ) SetVirtualWnd(pstrValue);
		else if( _tcsicmp(pstrName, _T("innerstyle")) == 0 ) {
			CDuiString sXmlData = pstrValue;
			sXmlData.Replace(_T("&quot;"), _T("\""));
			LPCTSTR pstrList = sXmlData.GetData();
			CDuiString sItem;
			CDuiString sValue;
			while( *pstrList != _T('\0') ) {
				sItem.Empty();
				sValue.Empty();
				while( *pstrList != _T('\0') && *pstrList != _T('=') ) {
					LPTSTR pstrTemp = ::CharNext(pstrList);
					while( pstrList < pstrTemp) {
						sItem += *pstrList++;
					}
				}
				ASSERT( *pstrList == _T('=') );
				if( *pstrList++ != _T('=') ) return;
				ASSERT( *pstrList == _T('\"') );
				if( *pstrList++ != _T('\"') ) return;
				while( *pstrList != _T('\0') && *pstrList != _T('\"') ) {
					LPTSTR pstrTemp = ::CharNext(pstrList);
					while( pstrList < pstrTemp) {
						sValue += *pstrList++;
					}
				}
				ASSERT( *pstrList == _T('\"') );
				if( *pstrList++ != _T('\"') ) return;
				SetAttribute(sItem, sValue);
				if( *pstrList++ != _T(' ') && *pstrList++ != _T(',') ) return;
			}
		}
	}
Exemple #13
0
  void Button::CalcSize()
  {
    /* Let the frame calculate its size */
    switch (type) {
      case typeNormal:
      SetBackground(OS::display->GetFill(OS::Display::buttonBackgroundFillIndex));
      if (!OS::display->GetTheme()->FocusOnEditableControlsOnly()) {
        RequestFocus();
      }

      if (OS::display->GetTheme()->RequestFingerFriendlyControls()) {
        SetMinWidth(OS::display->GetTheme()->GetFingerFriendlyMinWidth());
        SetMinHeight(OS::display->GetTheme()->GetFingerFriendlyMinHeight());
      }
      break;
    case typeDefault:
      SetBackground(OS::display->GetFill(OS::Display::defaultButtonBackgroundFillIndex));

      if (!OS::display->GetTheme()->FocusOnEditableControlsOnly()) {
        RequestFocus();
      }

      if (OS::display->GetTheme()->RequestFingerFriendlyControls()) {
        SetMinWidth(OS::display->GetTheme()->GetFingerFriendlyMinWidth());
        SetMinHeight(OS::display->GetTheme()->GetFingerFriendlyMinHeight());
      }
      break;
    case typeCommit:
      SetBackground(OS::display->GetFill(OS::Display::positiveButtonBackgroundFillIndex));

      if (!OS::display->GetTheme()->FocusOnEditableControlsOnly()) {
        RequestFocus();
      }

      if (OS::display->GetTheme()->RequestFingerFriendlyControls()) {
        SetMinWidth(OS::display->GetTheme()->GetFingerFriendlyMinWidth());
        SetMinHeight(OS::display->GetTheme()->GetFingerFriendlyMinHeight());
      }
      break;
    case typeCancel:
      SetBackground(OS::display->GetFill(OS::Display::negativeButtonBackgroundFillIndex));

      if (!OS::display->GetTheme()->FocusOnEditableControlsOnly()) {
        RequestFocus();
      }

      if (OS::display->GetTheme()->RequestFingerFriendlyControls()) {
        SetMinWidth(OS::display->GetTheme()->GetFingerFriendlyMinWidth());
        SetMinHeight(OS::display->GetTheme()->GetFingerFriendlyMinHeight());
      }
      break;
    case typeIcon:
      SetBackground(OS::display->GetFill(OS::Display::buttonBackgroundFillIndex));

      if (!OS::display->GetTheme()->FocusOnEditableControlsOnly()) {
        RequestFocus();
      }

      break;
    case typeAdditional:
      SetBackground(OS::display->GetFill(OS::Display::buttonBackgroundFillIndex));

      if (!OS::display->GetTheme()->FocusOnEditableControlsOnly()) {
        RequestFocus();
      }

      break;
    case typeToolBar:
      SetBackground(OS::display->GetFill(OS::Display::toolbarButtonBackgroundFillIndex));
      SetCanFocus(false);
      break;
    case typeScroll:
      SetBackground(OS::display->GetFill(OS::Display::scrollButtonBackgroundFillIndex));
      SetCanFocus(false);
      break;
    }

    width=0;
    height=0;
    minWidth=0;
    minHeight=0;

    if (ShowObject()) {
      /*
        Now we let the image calculate its bounds and simply add its size
        to the size of the button.
      */
      object->CalcSize();
      width=object->GetOWidth();
      height=object->GetOHeight();
      minWidth=object->GetOMinWidth();
      minHeight=object->GetOMinHeight();
    }

    if (ShowImage()) {
      minWidth+=image->GetWidth();
      width+=image->GetWidth();
      minHeight=std::max(minHeight,image->GetHeight());
      height=std::max(height,image->GetHeight());
    }

    if (ShowObject() && ShowImage()) {
      minWidth+=OS::display->GetSpaceHorizontal(OS::Display::spaceIntraObject);
      width+=OS::display->GetSpaceHorizontal(OS::Display::spaceIntraObject);
    }

    maxWidth=30000;
    maxHeight=30000;

    /* We *must* call CalcSize of our superclass! */
    Control::CalcSize();
  }