Exemplo n.º 1
0
void CListBox::SetDropDown(CWindow* pDropDown)
{
  m_pDropDown = pDropDown;
  if (pDropDown == nullptr) {
    SetIsFocusable(true);
  } else {
    SetIsFocusable(false);
  }
}
Exemplo n.º 2
0
TBEditField::TBEditField()
	: m_edit_type(EDIT_TYPE_TEXT)
	, m_adapt_to_content_size(false)
	, m_virtual_width(250)
{
	SetIsFocusable(true);
	SetWantLongClick(true);
	AddChild(&m_scrollbar_x);
	AddChild(&m_scrollbar_y);
	AddChild(&m_root);
	m_root.SetGravity(WIDGET_GRAVITY_ALL);
	m_scrollbar_x.SetGravity(WIDGET_GRAVITY_BOTTOM | WIDGET_GRAVITY_LEFT_RIGHT);
	m_scrollbar_y.SetGravity(WIDGET_GRAVITY_RIGHT | WIDGET_GRAVITY_TOP_BOTTOM);
	m_scrollbar_y.SetAxis(AXIS_Y);
	int scrollbar_y_w = m_scrollbar_y.GetPreferredSize().pref_w;
	int scrollbar_x_h = m_scrollbar_x.GetPreferredSize().pref_h;
	m_scrollbar_x.SetRect(TBRect(0, - scrollbar_x_h, - scrollbar_y_w, scrollbar_x_h));
	m_scrollbar_y.SetRect(TBRect(- scrollbar_y_w, 0, scrollbar_y_w, 0));
	m_scrollbar_x.SetOpacity(0);
	m_scrollbar_y.SetOpacity(0);

	SetSkinBg(TBIDC("TBEditField"), WIDGET_INVOKE_INFO_NO_CALLBACKS);
	m_style_edit.SetListener(this);

	m_root.SetRect(GetVisibleRect());

	m_placeholder.SetTextAlign(TB_TEXT_ALIGN_LEFT);

	m_content_factory.editfield = this;
	m_style_edit.SetContentFactory(&m_content_factory);
}
Exemplo n.º 3
0
	//----------------------------------------------------------------------------------------------------
	EEComboBox::EEComboBox(const Rect_Float& _rect, const EEColor& _color, const EEColor& _fontColor)
		:
		EELineBrowser(_rect, _color, _fontColor),
		m_isSelecting(false),
		m_options(),
		m_selected(-1),
		m_isSelectedDirty(true)
	{
		SetIsFocusable(true);
	}
Exemplo n.º 4
0
	//EEProgressBar
	//----------------------------------------------------------------------------------------------------
	EEProgressbar::EEProgressbar(const Rect_Float& _progressRect, const EETexture& _progressTex, const EETexture& _frameTex, std::function<void(float)> _funcPtr)
		:
		EEQuad2D(_progressRect, _progressTex),
		m_progressFrame(Rect_Float(0.0f, 0.0f, _progressRect.z - _progressRect.x, _progressRect.w - _progressRect.y) - FLOAT2(GetWidht() / 2, GetHeight() / 2), _frameTex),
		m_progress(0.0f),
		m_isProgressDirty(false),
		m_callbackFunc(_funcPtr)
	{
		m_progressFrame.SetParent(this);
		SetIsFocusable(true);
	}
Exemplo n.º 5
0
	//----------------------------------------------------------------------------------------------------
	EEProgressbar::EEProgressbar(const EEProgressbar& _progressbar)
		:
		EEQuad2D(_progressbar),
		m_progressFrame(_progressbar.m_progressFrame),
		m_progress(_progressbar.m_progress),
		m_isProgressDirty(_progressbar.m_isProgressDirty),
		m_callbackFunc(_progressbar.m_callbackFunc)
	{
		m_progressFrame.SetParent(this);
		SetIsFocusable(true);
	}
Exemplo n.º 6
0
TBSlider::TBSlider()
	: m_axis(AXIS_Y) ///< Make SetAxis below always succeed and set the skin
	, m_value(0)
	, m_min(0)
	, m_max(1)
	, m_to_pixel_factor(0)
{
	SetIsFocusable(true);
	SetAxis(AXIS_X);
	AddChild(&m_handle);
}
Exemplo n.º 7
0
TBButton::TBButton()
	: m_auto_repeat_click(false)
	, m_toggle_mode(false)
{
	SetIsFocusable(true);
	SetClickByKey(true);
	SetSkinBg(TBIDC("TBButton"), WIDGET_INVOKE_INFO_NO_CALLBACKS);
	AddChild(&m_layout);
	// Set the textfield gravity to all, even though it would display the same with default gravity.
	// This will make the buttons layout expand if there is space available, without forcing the parent
	// layout to grow to make the space available.
	m_textfield.SetGravity(WIDGET_GRAVITY_ALL);
	m_layout.AddChild(&m_textfield);
	m_layout.SetRect(GetPaddingRect());
	m_layout.SetGravity(WIDGET_GRAVITY_ALL);
	m_layout.SetPaintOverflowFadeout(false);
}
Exemplo n.º 8
0
TBSelectList::TBSelectList()
    : m_value(-1)
    , m_list_is_invalid(false)
    , m_scroll_to_current(false)
    , m_header_lng_string_id(TBIDC("TBList.header"))
{
    SetSource(&m_default_source);
    SetIsFocusable(true);
    SetSkinBg(TBIDC("TBSelectList"), WIDGET_INVOKE_INFO_NO_CALLBACKS);
    m_container.SetGravity(WIDGET_GRAVITY_ALL);
    m_container.SetRect(GetPaddingRect());
    AddChild(&m_container);
    m_layout.SetGravity(WIDGET_GRAVITY_ALL);
    m_layout.SetAxis(AXIS_Y);
    m_layout.SetSpacing(0);
    m_layout.SetLayoutPosition(LAYOUT_POSITION_LEFT_TOP);
    m_layout.SetLayoutDistributionPosition(LAYOUT_DISTRIBUTION_POSITION_LEFT_TOP);
    m_layout.SetLayoutSize(LAYOUT_SIZE_AVAILABLE);
    m_container.GetContentRoot()->AddChild(&m_layout);
    m_container.SetScrollMode(SCROLL_MODE_Y_AUTO);
    m_container.SetAdaptContentSize(true);
}
Exemplo n.º 9
0
TBRadioCheckBox::TBRadioCheckBox()
	: m_value(0)
{
	SetIsFocusable(true);
	SetClickByKey(true);
}