示例#1
0
ECode RatingBar::SetIsIndicator(
    /* [in] */ Boolean isIndicator)
{
    mIsUserSeekable = !isIndicator;
    SetFocusable(!isIndicator);
    return NOERROR;
}
示例#2
0
ui::UIListBox::UIListBox(SCROLL_DIRECTION scrollDirection, UISize preferredBitmapSize)
    : m_scrollDirection(scrollDirection)
    , m_preferredBitmapSize(preferredBitmapSize)
    , m_preferredTextAreaSize(UISize(0.0f, 0.0f))
    , m_marginBetweenBitmapAndText(4.0f)
    , m_marginBetweenItems(4.0f)
    , m_itemWidth(0.0f)
    , m_itemHeight(0.0f)
    , m_scrollBarMarginFromSide(8.0f)
    , m_scrollBarThick(20.0f)
    , m_rectFigure(std::make_unique<graphics::figure::RectangleFigure>())
    , m_colorSet(std::make_shared<graphics::color::ColorSet>(UILISTBOX_COLORSETDEF))
    , m_scrollBar(std::make_shared<ui::UIScrollBar>())
    , m_displayPositionOffset(0.0f) {
#ifdef DEBUG_UILISTBOX
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif
  AddElement(m_scrollBar);
  AddBeforeAddElementCallback([&](std::shared_ptr<UIBase> element) -> bool {
    element->SetParentContainer(shared_from_this());
    return true;
  });
  SetFocusable(false);
#ifdef DEBUG_UILISTBOX
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
}
NumberEntry::NumberEntry()
{
	m_count = 0;
	m_index = 0;
	m_items = NULL;
	m_font = NULL;
	SetFocusable(true);
}
示例#4
0
    CheckBox::CheckBox()
    {
        setSelected(false);

        SetFocusable(true);
        addMouseListener(this);
        addKeyListener(this);
    }
示例#5
0
 NativeButton::NativeButton(ButtonListener* listener)
     : Button(listener),
     native_wrapper_(NULL),
     is_default_(false),
     need_elevation_(false),
     ignore_minimum_size_(false)
 {
     InitBorder();
     SetFocusable(true);
 }
示例#6
0
ECode ImageButton::constructor(
    /* [in] */ IContext* context,
    /* [in] */ IAttributeSet* attrs,
    /* [in] */ Int32 defStyleAttr,
    /* [in] */ Int32 defStyleRes)
{
    FAIL_RETURN(ImageView::constructor(context, attrs, defStyleAttr, defStyleRes));
    SetFocusable(TRUE);
    return NOERROR;
}
示例#7
0
    TextField::TextField()
    {
        mCaretPosition = 0;
        mXScroll = 0;

        SetFocusable(true);

        addMouseListener(this);
        addKeyListener(this);
    }
示例#8
0
emClockHandsPanel::emClockHandsPanel(
	ParentArg parent, const emString & name, emColor fgColor
)
	: emPanel(parent,name)
{
	FgColor=fgColor;
	Hour=0;
	Minute=0;
	Second=0;
	SetFocusable(false);
}
示例#9
0
文件: Widget.cpp 项目: MStr3am/sfui
        void    Widget::LoadStyle(const std::string& style)
        {
            ResourceManager* rm = ResourceManager::Get();

            StyleProperties& properties = rm->GetStyle(style);

            if (properties["from"] != "")
                LoadStyle(properties["from"]);

            SetX(rm->GetValue(properties["x"], GetPosition().x));
            SetY(rm->GetValue(properties["y"], GetPosition().y));

            mAlignOffset.x = rm->GetValue(properties["x"], mAlignOffset.x);
            mAlignOffset.y = rm->GetValue(properties["y"], mAlignOffset.y);

            SetWidth(rm->GetValue(properties["width"], GetWidth()));
            SetHeight(rm->GetValue(properties["height"], GetHeight()));

            // Detect alignement
            if (properties["align"] != "")
            {
                std::string strA = properties["align"];

                if (strA == "top_left")
                    mAlign = Align::TOP_LEFT;
                else if (strA == "top_center")
                    mAlign = Align::TOP_CENTER;
                else if (strA == "top_right")
                    mAlign = Align::TOP_RIGHT;
                else if (strA == "left")
                    mAlign = Align::LEFT;
                else if (strA == "center")
                    mAlign = Align::CENTER;
                else if (strA == "right")
                    mAlign = Align::RIGHT;
                else if (strA == "bottom_left")
                    mAlign = Align::BOTTOM_LEFT;
                else if (strA == "bottom_center")
                    mAlign = Align::BOTTOM_CENTER;
                else if (strA == "bottom_right")
                    mAlign = Align::BOTTOM_RIGHT;
                else
                    mAlign = Align::NONE;
            }

            SetColor(rm->GetColorValue(properties["color"], GetColor()));
            SetBorderColor(rm->GetColorValue(properties["borderColor"], GetBorderColor()));

            SetEnabled(rm->GetValue(properties["enabled"], IsEnabled()));
            SetVisible(rm->GetValue(properties["visible"], IsVisible()));
            SetFocusable(rm->GetValue(properties["focusable"], IsFocusable()));

            UpdatePosition();
        }
示例#10
0
TabItem::TabItem()
{
    SetClassName(_T("TabItem"));
    SetMinWidth(16);

    SetHorizontalContentAlignment(suic::CENTER);
    SetVerticalContentAlignment(suic::CENTER);
    SetVerticalAlignment(suic::STRETCH);

    SetFocusable(true);
}
示例#11
0
 NativeButton::NativeButton(ButtonListener* listener, const std::wstring& label)
     : Button(listener),
     native_wrapper_(NULL),
     is_default_(false),
     need_elevation_(false),
     ignore_minimum_size_(false)
 {
     SetLabel(label); // SetLabel takes care of label layout in RTL UI.
     InitBorder();
     SetFocusable(true);
 }
示例#12
0
    CheckBox::CheckBox(const std::string &caption, bool selected)
    {
        setCaption(caption);
        setSelected(selected);

        SetFocusable(true);
        addMouseListener(this);
        addKeyListener(this);

        adjustSize();
    }
示例#13
0
emMainPanel::SliderPanel::SliderPanel(emMainPanel & parent, const emString & name)
	: emPanel(parent,name),
	MainPanel(parent)
{
	MouseOver=false;
	Pressed=false;
	Hidden=false;
	PressMY=0.0;
	PressSliderY=0.0;
	SetFocusable(false);
	SliderImage=emGetInsResImage(GetRootContext(),"emMain","Slider.tga");
}
示例#14
0
文件: jblotpiece.cpp 项目: skopp/rush
JBlotPiece::JBlotPiece()
{
    m_HomePos       = Vec2::null;
    m_MovePos       = Vec2::null;
    m_bAtHome       = false;
    m_pBlot         = NULL;
    m_Scale         = 1.2f;
    m_bSelected     = false;
    m_bRipple       = false;
    m_bMoving       = false;
    SetFocusable( true );
    SetExt( Frame( 0.0f, 0.0f, 140.0f, 130.0f ) );
} // JBlotPiece::JBlotPiece
示例#15
0
    TextField::TextField(const std::string& text)
    {
        mCaretPosition = 0;
        mXScroll = 0;

        mText = text;
        adjustSize();

        SetFocusable(true);

        addMouseListener(this);
        addKeyListener(this);
    }
示例#16
0
bool UITextEditor::InitialisePriv(QDomElement *Element)
{
    if (Element->tagName() == "state")
    {
        // NB don't return true to allow UIWidget to parse base state
        QString focus  = Element->attribute("focusable");

        if (!focus.isEmpty())
            SetFocusable(GetBool(focus));
    }

    return false;
}
ui::UIRadioButtonGroup::UIRadioButtonGroup(void) {
  AddBeforeAddElementCallback([&](std::shared_ptr<UIBase> element) -> bool {
    auto radioButton = std::dynamic_pointer_cast<UIRadioButton>(element);
    if (radioButton != nullptr) {
      radioButton->SetIndex(GetNumberOfElements());
      radioButton->SetRadioButtonGroup(shared_from_this());
      return true;
    } else {
      return false;
    }
  });
  SetFocusable(true);
}
示例#18
0
文件: button.cpp 项目: doveiya/isilme
    Button::Button()
        : mHasMouse(false),
          mKeyPressed(false),
          mMousePressed(false),
          mAlignment(Graphics::CENTER),
          mSpacing(4)
    {
        SetFocusable(true);
        AdjustSize();
        SetFrameSize(1);

        addMouseListener(this);
        addKeyListener(this);
        addFocusListener(this);
    }
示例#19
0
	void MessageBox::construct(Manager *pManager, uint8_t uStyle, sf::String sText, uint8_t uButtons)
	{
		//Save Currently Focused Widget - We need to grab focus to the messagebox so this is needed
		pFocusPrevious = pManager->GetFocused();

		//Setup Focus
		SetFocusable(true);
		pManager->AddFocus(this);
		pManager->SwitchFocus(this);

		//Assign Texture and Drag Area
		SetTexture("win_msgbox.bmp");
		SetDragArea(0, 0, GetWidth(), 20);

		//Now for the Buttons
		int32_t x = -4;
		if ((uButtons & MSG_CANCEL) != 0)
		{
			UI::Button *pButton = new UI::Button(MSGBOX_NBTN, x, -4);
			pButton->SetTexture("btn_cancel.bmp", pButton->INACTIVE );
			pButton->SetTexture("btn_cancel_a.bmp", pButton->ACTIVE );
			pButton->SetTexture("btn_cancel_b.bmp", pButton->PRESSED);
			pButton->SetCallback(MessageBox::SelectButton);
			pButton->SetAlign(UI::RIGHT, UI::BOTTOM);
			x -= (4 + pButton->GetWidth());
			AddChild(pButton);
		}

		if ((uButtons & MSG_OK) != 0)
		{
			UI::Button *pButton = new UI::Button(MSGBOX_PBTN, x, -4);
			pButton->SetTexture("btn_ok.bmp", pButton->INACTIVE );
			pButton->SetTexture("btn_ok_a.bmp", pButton->ACTIVE );
			pButton->SetTexture("btn_ok_b.bmp", pButton->PRESSED);
			pButton->SetCallback(MessageBox::SelectButton);
			pButton->SetAlign(UI::RIGHT, UI::BOTTOM);
			AddChild(pButton);
		}

		//Set selected as NONE - to avoid mischecks
		selected = MSG_NONE;

		//Add the Text
		sf::Vector2i vTextPos = sf::Vector2i(20, GetHeight()/2);
		SetColor(sf::Color::Blue, FOREGROUND);
		UpdateTextVA(dwFontID, sText, uStyle, dwCharSize, GetWidth(), 5, 0, vTextPos);
	}
示例#20
0
	//------------------------------------------------------------------------------
	void CGUIWgtScrollPanel::InitScrollPanel()
	{
		m_bForceVertScrollShow = false;
		m_bForceHorzScrollShow = false;

		//
		m_UseSelfCreatedScrollbar = false;

		m_pScrollbarVert = NULL;
		m_pScrollbarHorz = NULL;

		m_pPanelBG = NULL;
		m_aScrollClientRect.SetRect( CGUIRect(0.f,0.f,0.f,0.f ));

		//set flag
		SetFocusable(true);
		SetGenerateClickEvent( true );
	}
示例#21
0
ContentView::ContentView(
    /* [in] */ IContext* context,
    /* [in] */ ContentViewCore* cvc)
{
    assert(0);
#if 0
    super(context, NULL, android::R::attr::webViewStyle);

    if (GetScrollBarStyle() == IView::SCROLLBARS_INSIDE_OVERLAY) {
        SetHorizontalScrollBarEnabled(FALSE);
        SetVerticalScrollBarEnabled(FALSE);
    }

    SetFocusable(TRUE);
    SetFocusableInTouchMode(TRUE);

    mContentViewCore = cvc;
#endif
}
示例#22
0
// コンストラクタ
ui::UIListBoxItem::UIListBoxItem(void)
    : m_layoutDirection(LAYOUT_DIRECTION_VERTICAL)
    , m_preferredTextAreaSize(0.0f, 0.0f)
    , m_preferredBitmapSize(64.0f, 64.0f)
    , m_marginBetweenBitmapAndText(4.0f)
    , m_textColorSet(std::make_shared<graphics::color::ColorSet>(UILISTBOXITEM_DEFAULT_TEXT_COLORSET))
    , m_textBrushSet(std::make_unique<graphics::brush::BrushSet>())
    , m_bodyColorSet(std::make_shared<graphics::color::ColorSet>(UILISTBOXITEM_DEFAULT_BODY_COLORSET))
    , m_bodyBrushSet(std::make_unique<graphics::brush::BrushSet>())
    , m_bodyRect(std::make_unique<graphics::figure::RectangleFigure>())
    , m_mainText()
    , m_mainTextFontAttribute(12.0f)
    , m_mainTextFormat()
    , m_mainTextLayout()
    , m_mainTextMetrics()
    , m_mainTextLayoutRect()
    , m_subText1()
    , m_subText1FontAttribute(10.0f)
    , m_subText1Format()
    , m_subText1Layout()
    , m_subText1Metrics()
    , m_subText2()
    , m_subText2FontAttribute(10.0f)
    , m_subText2Format()
    , m_subText2Layout()
    , m_subText2Metrics()
    , m_bitmap(std::make_shared<graphics::Bitmap>())
    , m_bitmapLayoutRect(0.0f, 0.0f, 64.0f, 64.0f)
    , m_textLayoutRect(0.0f, 0.0f, 128.0f, 0.0f)
    , m_textChanged(false)
    , m_resourceChanged(false)
    , m_mainTextNumberOfLines(2)
    , m_scrollBar(std::unique_ptr<ui::UIScrollBar>()) {
#ifdef DEBUG_UILISTBOXITEM
  LOG_ENTER(SEVERITY_LEVEL_DEBUG);
#endif

  SetFocusable(true);

#ifdef DEBUG_UILISTBOXITEM
  LOG_LEAVE(SEVERITY_LEVEL_DEBUG);
#endif
}
示例#23
0
void ScrollBar::OnInitialized()
{
    suic::StylePtr & selfStyle = GetStyle();

    suic::StylePtr dBtn(selfStyle->GetStylePart(_T("DecreaseButton")));
    suic::StylePtr iBtn(selfStyle->GetStylePart(_T("IncreaseButton")));

    suic::StylePtr dPage(selfStyle->GetStylePart(_T("DecreasePage")));
    suic::StylePtr iPage(selfStyle->GetStylePart(_T("IncreasePage")));

    suic::StylePtr thumb(selfStyle->GetStylePart(_T("Thumb")));

    if (!dBtn && GetOwner())
    {
        dBtn = GetOwner()->FindResource(GetClassName() + _T(".DecreaseButton"));
        iBtn = GetOwner()->FindResource(GetClassName() + _T(".IncreaseButton"));
        dPage = GetOwner()->FindResource(GetClassName() + _T(".Track.Page"));
        thumb = GetOwner()->FindResource(GetClassName() + _T(".Track.Thumb"));
    }

    if (!iPage || iPage->Setters->GetCount() == 0)
    {
        iPage = dPage;
    }

    _decreasePage.SetOwner(this);

    _decreasePage.SetStyle(dPage);
    _increasePage.SetStyle(iPage);
    _thumb.SetStyle(thumb);

    _decreaseBtn.SetStyle(dBtn);
    _increaseBtn.SetStyle(iBtn);

    if (GetOrientation() == CoreFlags::Horizontal)
    {
        //
        // 附加事件
        //
        _decreasePage.MouseLButtonDown.Add(this, &ScrollBar::OnPageLeft);
        _increasePage.MouseLButtonDown.Add(this, &ScrollBar::OnPageRight);
        _thumb.MouseMove.Add(this, &ScrollBar::OnHorzTrack);

        _decreaseBtn.MouseLButtonDown.Add(this, &ScrollBar::OnLineLeft);
        _increaseBtn.MouseLButtonDown.Add(this, &ScrollBar::OnLineRight);
    }
    else
    {
        _decreasePage.MouseLButtonDown.Add(this, &ScrollBar::OnPageUp);
        _increasePage.MouseLButtonDown.Add(this, &ScrollBar::OnPageDown);
        _thumb.MouseMove.Add(this, &ScrollBar::OnVertTrack);

        _decreaseBtn.MouseLButtonDown.Add(this, &ScrollBar::OnLineUp);
        _increaseBtn.MouseLButtonDown.Add(this, &ScrollBar::OnLineDown);
    }

    _thumb.MouseLButtonDown.Add(this, &ScrollBar::OnBeginTrack);
    _thumb.MouseLButtonUp.Add(this, &ScrollBar::OnEndTrack);

    SetFocusable(false);
    
    // test code
    UpdateScrollLogic(500, false);
}
示例#24
0
JSlidePiece::JSlidePiece()
{
    m_pSlideGame        = NULL;
    SetFocusable( true );
    SetExt( Frame( 0.0f, 0.0f, 140.0f, 130.0f ) );
} // JSlidePiece::JSlidePiece