コード例 #1
0
ファイル: ExpandoTextCtrl.cpp プロジェクト: niterain/digsby
//Set a MinHeight so that the Expando won't get any shorter than this
void ExpandoTextCtrl::SetMinHeight(const int &h) {
    if(minHeight != h) {
        minHeight = h;
        RequestResize();
    }

}
コード例 #2
0
ファイル: Table.cpp プロジェクト: screwt/glassomium
void Table::Attach( const Widget::Ptr& widget, const sf::Rect<sf::Uint32>& rect, int x_options, int y_options, const sf::Vector2f& padding ) {
    assert( rect.width > 0 );
    assert( rect.height > 0 );

    // Store widget in a table cell object.
    priv::TableCell cell( widget, rect, x_options, y_options, padding );
    m_cells.push_back( cell );

    // Check if we need to enlarge rows/columns.
    if( rect.left + rect.width >= m_columns.size() ) {
        std::size_t old_size( m_columns.size() );
        m_columns.resize( rect.left + rect.width );

        // Set default spacings.
        for( std::size_t col_index = old_size; col_index < m_columns.size(); ++col_index ) {
            m_columns[col_index].spacing = m_general_spacings.x;
        }
    }

    if( rect.top + rect.height >= m_rows.size() ) {
        std::size_t old_size( m_rows.size() );
        m_rows.resize( rect.top + rect.height );

        // Set default spacings.
        for( std::size_t row_index = old_size; row_index < m_rows.size(); ++row_index ) {
            m_rows[row_index].spacing = m_general_spacings.y;
        }
    }

    // Add widget to container.
    Add( widget );

    // Request new size.
    RequestResize();
}
コード例 #3
0
void CTabItem_Normal::SetCaption(LPCTSTR lpszCaption)
{
	m_strCaption = lpszCaption; 
	CTabItem::SetCaption(lpszCaption);
	if (IsDynDesireLength()) 
		RequestResize();
}
コード例 #4
0
ファイル: Widget.cpp プロジェクト: Cruel/SFGUI
void Widget::RequestResize() {
	m_requisition = CalculateRequisition();

	if( m_custom_requisition ) {
		if( m_custom_requisition->x > 0.f ) {
			m_requisition.x = std::max( m_custom_requisition->x, m_requisition.x );
		}

		if( m_custom_requisition->y > 0.f ) {
			m_requisition.y = std::max( m_custom_requisition->y, m_requisition.y );
		}
	}

	HandleRequisitionChange();

	auto parent = m_parent.lock();

	// Notify observers.
	GetSignals().Emit( OnSizeRequest );

	if( parent ) {
		parent->RequestResize();
	}
	else {
		sf::FloatRect allocation(
			GetAllocation().left,
			GetAllocation().top,
			std::max( GetAllocation().width, m_requisition.x ),
			std::max( GetAllocation().height, m_requisition.y )
		);

		SetAllocation( allocation );
	}
}
コード例 #5
0
ファイル: ComboBox.cpp プロジェクト: Soth1985/Survive
void ComboBox::RemoveItem( IndexType index ) {
	if( index >= m_entries.size() ) {
		return;
	}

	m_entries.erase( m_entries.begin() + index );

	// Make sure active item index keeps valid.
	if( m_active_item != NONE ) {
		if( m_active_item == index ) {
			m_active_item = NONE;
		}
		else if( m_active_item > index ) {
			m_active_item = m_entries.size() == 0 ? NONE : m_active_item - 1;
		}
	}

	if( IsMouseInWidget() ) {
		SetState( PRELIGHT );
	}
	else {
		SetState( NORMAL );
	}

	RequestResize();
}
コード例 #6
0
FilePickerDialog::Ptr FilePickerDialog::Create( boost::filesystem::path initial_path ) {
    auto ptr = Ptr( new FilePickerDialog( initial_path ) );
    ptr->Add(ptr->m_main_box);

    ptr->m_main_box->PackEnd(ptr->m_panel_box, true, true);
    ptr->m_main_box->PackEnd(ptr->m_buttons_box, false, true);

    ptr->m_panel_box->PackEnd(ptr->m_locations_listbox, false, true);
    ptr->m_panel_box->PackEnd(ptr->m_directory_box, true, true);

    ptr->m_directory_box->PackEnd(ptr->m_directory_entry_box, false, true);
    ptr->m_directory_box->PackEnd(ptr->m_directory_paths_listbox, true, true);
    ptr->m_directory_box->PackEnd(ptr->m_filename_box, false, true);

    ptr->m_directory_entry_box->PackEnd(ptr->m_current_directory_entry, true, true);
    ptr->m_directory_entry_box->PackEnd(ptr->m_new_directory_button, false, true);

    ptr->m_filename_box->PackEnd(ptr->m_filename_entry, true, true);

    ptr->m_buttons_box->PackEnd(ptr->m_ok_button, true, true);
    ptr->m_buttons_box->PackEnd(ptr->m_cancel_button, false, true);

    ptr->RequestResize();
    ptr->m_locations_listbox->RequestResize();
    ptr->m_new_directory_button->RequestResize();
    ptr->m_current_directory_entry->RequestResize();
    ptr->m_directory_paths_listbox->RequestResize();
    ptr->m_filename_entry->RequestResize();
    ptr->m_ok_button->RequestResize();
    ptr->m_cancel_button->RequestResize();

    return ptr;
}
コード例 #7
0
ファイル: ComboBox.cpp プロジェクト: spacechase0/SFGUI
void ComboBox::ChangeItem( IndexType index, const sf::String& text ) {
	if( index >= m_entries.size() ) {
		return;
	}

	m_entries[index] = text;
	RequestResize();
}
コード例 #8
0
ファイル: ComboBox.cpp プロジェクト: spacechase0/SFGUI
void ComboBox::PrependItem( const sf::String& text ) {
	m_entries.insert( m_entries.begin(), text );

	if( m_active_item != NONE ) {
		++m_active_item;
	}

	RequestResize();
}
コード例 #9
0
ファイル: ComboBox.cpp プロジェクト: spacechase0/SFGUI
void ComboBox::InsertItem( IndexType index, const sf::String& text ) {
	m_entries.insert( m_entries.begin() + index, text );

	if( m_active_item != NONE && m_active_item >= index ) {
		++m_active_item;
	}

	RequestResize();
}
コード例 #10
0
ファイル: Window.cpp プロジェクト: Chiranjivee/SFML-book
void Window::HandleAdd( Widget::Ptr child ) {
	Bin::HandleAdd( child );

	if( GetChild() ) {
		// Reset allocation so the window will be as large as required.
		SetAllocation( sf::FloatRect( GetAllocation().left, GetAllocation().top, 1.f, 1.f ) );
		RequestResize();
	}
}
コード例 #11
0
ファイル: Container.cpp プロジェクト: Stigmatized/glassomium
void Container::Remove( const Widget::Ptr& widget ) {
	WidgetsList::iterator iter( std::find( m_children.begin(), m_children.end(), widget ) );

	if( iter != m_children.end() ) {
		m_children.erase( iter );
		RequestResize();

		HandleRemove( widget );
	}
}
コード例 #12
0
ファイル: Label.cpp プロジェクト: Chiranjivee/SFML-book
void Label::SetText( const sf::String& text ) {
	m_text = text;

	if( m_wrap ) {
		WrapText();
	}

	RequestResize();
	Invalidate();
}
コード例 #13
0
ファイル: Table.cpp プロジェクト: screwt/glassomium
void Table::SetRowSpacings( float spacing ) {
    for( std::size_t row_index = 0; row_index < m_rows.size(); ++row_index ) {
        m_rows[row_index].spacing = spacing;
    }

    m_general_spacings.y = spacing;

    UpdateRequisitions();
    RequestResize();
}
コード例 #14
0
ファイル: ExpandoTextCtrl.cpp プロジェクト: niterain/digsby
bool
ExpandoTextCtrl::SetStyle(long start, long end, const wxTextAttr &style) {

    bool success = InputBox::SetStyle(start, end, style);

    //Force resize check
    RequestResize();

    return success;
}
コード例 #15
0
ファイル: Table.cpp プロジェクト: screwt/glassomium
void Table::SetColumnSpacings( float spacing ) {
    for( std::size_t column_index = 0; column_index < m_columns.size(); ++column_index ) {
        m_columns[column_index].spacing = spacing;
    }

    m_general_spacings.x = spacing;

    UpdateRequisitions();
    RequestResize();
}
コード例 #16
0
ファイル: Table.cpp プロジェクト: screwt/glassomium
void Table::SetRowSpacing( std::size_t index, float spacing ) {
    if( index >= m_rows.size() ) {
        return;
    }

    m_rows[index].spacing = spacing;

    UpdateRequisitions();
    RequestResize();
}
コード例 #17
0
ファイル: Widget.cpp プロジェクト: Cruel/SFGUI
void Widget::SetRequisition( const sf::Vector2f& requisition ) {
	if( requisition.x > 0.f || requisition.y > 0.f ) {
		m_custom_requisition.reset( new sf::Vector2f( requisition ) );
	}
	else {
		m_custom_requisition.reset();
	}

	RequestResize();
}
コード例 #18
0
ファイル: Container.cpp プロジェクト: Soth1985/Survive
void Container::RemoveAll() {
	while( !m_children.empty() ) {
		Widget::Ptr widget = m_children.back();

		m_children.pop_back();
		widget->SetParent( Widget::Ptr() );
		HandleRemove( widget );
	}

	RequestResize();
}
コード例 #19
0
ファイル: Window.cpp プロジェクト: soarqin/SFGUI
bool Window::HandleAdd( Widget::Ptr child ) {
	if( !Bin::HandleAdd( child ) ) {
		return false;
	}

	// Reset allocation so the window will be as large as required.
	SetAllocation( sf::FloatRect( GetAllocation().left, GetAllocation().top, 1.f, 1.f ) );
	RequestResize();

	return true;
}
コード例 #20
0
ファイル: ComboBox.cpp プロジェクト: Cruel/SFGUI
void ComboBox::AppendItem( const sf::String& text ) {
	m_entries.push_back( text );

	if( IsMouseInWidget() ) {
		SetState( State::PRELIGHT );
	}
	else {
		SetState( State::NORMAL );
	}

	RequestResize();
}
コード例 #21
0
ファイル: Widget.cpp プロジェクト: ksandison/sfgui
void Widget::SetRequisition( const sf::Vector2f& requisition ) {
	if( requisition.x > 0.f || requisition.y > 0.f ) {
		delete m_custom_requisition;
		m_custom_requisition = new sf::Vector2f( requisition );
	}
	else {
		delete m_custom_requisition;
		m_custom_requisition = 0;
	}

	RequestResize();
}
コード例 #22
0
ファイル: Container.cpp プロジェクト: Stigmatized/glassomium
void Container::Add( const Widget::Ptr& widget ) {
	if( IsChild( widget ) ) {
		return;
	}

	m_children.push_back( widget );
	HandleAdd( widget );

	// Check if HandleAdd still wants the little boy.
	if( IsChild( widget ) ) {
		widget->SetParent( shared_from_this() );
		RequestResize();
	}
}
コード例 #23
0
ファイル: Window.cpp プロジェクト: Chiranjivee/SFML-book
void Window::SetStyle( std::uint8_t style ) {
	m_style = style;

	// Make sure dragging and resizing operations are cancelled.
	m_dragging = false;
	m_resizing = false;

	RequestResize();
	Invalidate();

	if( GetChild() ) {
		GetChild()->SetAllocation( GetClientRect() );
	}
}
コード例 #24
0
ファイル: Label.cpp プロジェクト: Chiranjivee/SFML-book
void Label::HandleRequisitionChange() {
	if( m_wrap ) {
		WrapText();
	}

	static auto calculate_y_requisition = false;

	if( !calculate_y_requisition ) {
		calculate_y_requisition = true;
		RequestResize();
	}
	else {
		calculate_y_requisition = false;
	}
}
コード例 #25
0
ファイル: ComboBox.cpp プロジェクト: Cruel/SFGUI
void ComboBox::PrependItem( const sf::String& text ) {
	m_entries.insert( m_entries.begin(), text );

	if( m_active_item != NONE ) {
		++m_active_item;
	}

	if( IsMouseInWidget() ) {
		SetState( State::PRELIGHT );
	}
	else {
		SetState( State::NORMAL );
	}

	RequestResize();
}
コード例 #26
0
ファイル: ComboBox.cpp プロジェクト: Cruel/SFGUI
void ComboBox::InsertItem( IndexType index, const sf::String& text ) {
	m_entries.insert( m_entries.begin() + index, text );

	if( m_active_item != NONE && m_active_item >= index ) {
		++m_active_item;
	}

	if( IsMouseInWidget() ) {
		SetState( State::PRELIGHT );
	}
	else {
		SetState( State::NORMAL );
	}

	RequestResize();
}
コード例 #27
0
ファイル: ComboBox.cpp プロジェクト: Soth1985/Survive
void ComboBox::ChangeItem( IndexType index, const sf::String& text ) {
	if( index >= m_entries.size() ) {
		return;
	}

	m_entries[index] = text;

	if( IsMouseInWidget() ) {
		SetState( PRELIGHT );
	}
	else {
		SetState( NORMAL );
	}

	RequestResize();
}
コード例 #28
0
ファイル: Image.cpp プロジェクト: Cruel/SFGUI
void Image::SetImage( const sf::Image& image ) {
	if( !image.getSize().x || !image.getSize().y ) {
		return;
	}

	if( m_image.getSize() == image.getSize() ) {
		m_image = image;

		sfg::Renderer::Get().UpdateImage( m_texture_offset, image );
	}
	else {
		m_image = image;

		RequestResize();
		Invalidate();
	}
}
コード例 #29
0
ファイル: Label.cpp プロジェクト: Chiranjivee/SFML-book
void Label::HandleSizeChange() {
	if( !m_wrap || ( GetAllocation().width <= 0 ) ) {
		return;
	}

	WrapText();

	static auto calculate_y_requisition = false;

	if( !calculate_y_requisition ) {
		calculate_y_requisition = true;
		RequestResize();
	}
	else {
		calculate_y_requisition = false;
	}
}
コード例 #30
0
ファイル: Widget.cpp プロジェクト: Cruel/SFGUI
void Widget::Show( bool show ) {
	if( show == IsLocallyVisible() ) {
		return;
	}

	auto old_global_visibility = IsGloballyVisible();

	// Flip the visible bit since we know show != IsLocallyVisible()
	m_visible = !m_visible;

	HandleLocalVisibilityChange();

	if( old_global_visibility != IsGloballyVisible() ) {
		HandleGlobalVisibilityChange();
	}

	RequestResize();
}