cBitmapFontEditable::cBitmapFontEditable(const CRect &size, CControlListener *listener, long tag, CBitmap *background, int spacing, int characters) : cBitmapFont(size, listener, tag, background, spacing, characters) { setWantsFocus(true); #ifdef MAC pluginResID = CurResFile(); #endif setMouseEnabled(true); setMouseableArea(size); memset(m_edit_buffer, 0x0, sizeof(char) * MAX_EDIT_CHARS); m_editing = false; m_edit_index = 0; }
Slider::Slider(BulletWorld * _world, float _defaultValue, float _valueMin, float _valueMax, bool _horizontal, bool _flipped) : NodeUI(_world), layout(_horizontal ? (LinearLayout *)new HorizontalLinearLayout(_world) : (LinearLayout *)new VerticalLinearLayout(_world)), fill(new NodeUI(_world)), thumb(new NodeUI(_world)), valueMin(_valueMin), valueMax(_valueMax), value(0), prevValue(0), horizontal(_horizontal), stepped(false), valueStep(0), flipped(_flipped) { setBackgroundColour(0.f, 0.f, 0.f); if(horizontal){ layout->horizontalAlignment = kLEFT; //setRationalWidth(1.f); setHeight(10); fill->setRationalHeight(1.f, this); thumb->setRationalHeight(1.f, this); thumb->setWidth(thumb->getHeight(true, false)); thumb->background->meshTransform->translate(-0.5f, 0, 0); layout->addChild(fill); layout->addChild(thumb); }else{ layout->verticalAlignment = kBOTTOM; //setRationalHeight(1.f); setWidth(10); fill->setRationalWidth(1.f, this); thumb->setRationalWidth(1.f, this); thumb->setHeight(thumb->getWidth(true, false)); thumb->background->meshTransform->translate(0, -0.5f, 0); layout->addChild(thumb); layout->addChild(fill); } fill->setBackgroundColour(1.f, 1.f, 1.f); thumb->setBackgroundColour(0.5f, 1.f, 1.f, 0.5f); layout->setRationalWidth(1.f, this); layout->setRationalHeight(1.f, this); addChild(layout); setMouseEnabled(true); setValue(_defaultValue); }
//------------------------------------------------------------------------ CMessageResult CAnimationSplashScreen::notify (CBaseObject* sender, IdStringPtr message) { if (message == Animation::kMsgAnimationFinished) { if (modalView) { modalView->invalid (); modalView->setMouseEnabled (true); } if (getFrame ()) getFrame ()->setModalView (NULL); setMouseEnabled (true); return kMessageNotified; } return CSplashScreen::notify (sender, message); }
//------------------------------------------------------------------------ void CAnimationSplashScreen::unSplash () { value = getMin (); if (getFrame ()) { if (getFrame ()->getModalView () == modalView) { if (!createAnimation (animationIndex, animationTime, modalView, true)) { if (modalView) modalView->invalid (); getFrame ()->setModalView (NULL); setMouseEnabled (true); } } } }
//------------------------------------------------------------------------ bool CAnimationSplashScreen::createAnimation (int32_t animationIndex, int32_t animationTime, CView* splashView, bool removeViewAnimation) { switch (animationIndex) { case 0: { if (removeViewAnimation) { splashView->setMouseEnabled (false); splashView->addAnimation ("AnimationSplashScreenAnimation", new Animation::AlphaValueAnimation (0.f), new Animation::PowerTimingFunction (animationTime, 2), this); return true; } else { setMouseEnabled (false); splashView->setAlphaValue (0.f); splashView->addAnimation ("AnimationSplashScreenAnimation", new Animation::AlphaValueAnimation (1.f), new Animation::PowerTimingFunction (animationTime, 2)); return true; } break; } } return false; }
SliderControlled::SliderControlled(BulletWorld * _world, float * _target, float _valueMin, float _valueMax, bool _horizontal, bool _flipped) : Slider(_world, *_target, _valueMin, _valueMax, _horizontal, _flipped), target(_target) { setMouseEnabled(false); }
void controlUC::setAttribute(PCWSTR pstrName, PCWSTR pstrValue) { if( _tcscmp(pstrName, L"pos") == 0 ) { RECT rcPos = { 0 }; PWSTR 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( _tcscmp(pstrName, L"relativepos") == 0 ) { SIZE szMove,szZoom; PWSTR pstr = NULL; szMove.cx = _tcstol(pstrValue, &pstr, 10); assert(pstr); szMove.cy = _tcstol(pstr + 1, &pstr, 10); assert(pstr); szZoom.cx = _tcstol(pstr + 1, &pstr, 10); assert(pstr); szZoom.cy = _tcstol(pstr + 1, &pstr, 10); assert(pstr); setRelativePos(szMove,szZoom); } else if( _tcscmp(pstrName, L"padding") == 0 ) { RECT rcPadding = { 0 }; PWSTR 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( _tcscmp(pstrName, L"bkcolor") == 0 || _tcscmp(pstrName, L"bkcolor1") == 0 ) { while( *pstrValue > L'\0' && *pstrValue <= L' ') pstrValue = ::CharNext(pstrValue); if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue); PWSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); setBkColor(clrColor); } else if( _tcscmp(pstrName, L"bordercolor") == 0 ) { if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue); PWSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); setBorderColor(clrColor); } else if( _tcscmp(pstrName, L"focusbordercolor") == 0 ) { if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue); PWSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); setFocusBorderColor(clrColor); } else if( _tcscmp(pstrName, L"bordersize") == 0 ) setBorderSize(_ttoi(pstrValue)); else if( _tcscmp(pstrName, L"borderround") == 0 ) { SIZE cxyRound = { 0 }; PWSTR pstr = NULL; cxyRound.cx = _tcstol(pstrValue, &pstr, 10); assert(pstr); cxyRound.cy = _tcstol(pstr + 1, &pstr, 10); assert(pstr); setBorderRound(cxyRound); } else if( _tcscmp(pstrName, L"width") == 0 ) setFixedWidth(_ttoi(pstrValue)); else if( _tcscmp(pstrName, L"height") == 0 ) setFixedHeight(_ttoi(pstrValue)); else if( _tcscmp(pstrName, L"minwidth") == 0 ) setMinWidth(_ttoi(pstrValue)); else if( _tcscmp(pstrName, L"minheight") == 0 ) setMinHeight(_ttoi(pstrValue)); else if( _tcscmp(pstrName, L"maxwidth") == 0 ) setMaxWidth(_ttoi(pstrValue)); else if( _tcscmp(pstrName, L"maxheight") == 0 ) setMaxHeight(_ttoi(pstrValue)); else if( _tcscmp(pstrName, L"name") == 0 ) setName(pstrValue); else if( _tcscmp(pstrName, L"text") == 0 ) setText(pstrValue); else if( _tcscmp(pstrName, L"tooltip") == 0 ) setToolTip(pstrValue); else if( _tcscmp(pstrName, L"userdata") == 0 ) setUserData(pstrValue); else if( _tcscmp(pstrName, L"enabled") == 0 ) setEnabled(_tcscmp(pstrValue, L"true") == 0); else if( _tcscmp(pstrName, L"mouse") == 0 ) setMouseEnabled(_tcscmp(pstrValue, L"true") == 0); else if( _tcscmp(pstrName, L"visible") == 0 ) setVisible(_tcscmp(pstrValue, L"true") == 0); else if( _tcscmp(pstrName, L"float") == 0 ) setFloat(_tcscmp(pstrValue, L"true") == 0); else if( _tcscmp(pstrName, L"shortcut") == 0 ) setShortcut(pstrValue[0]); else if( _tcscmp(pstrName, L"menu") == 0 ) setContextMenuUsed(_tcscmp(pstrValue, L"true") == 0); }