예제 #1
0
void CLTGUIColumnCtrl::CalculateSize()
{
    m_nWidth = 0;
    m_nBaseWidth = 0;
    m_nHeight = 0;

    // find the size
    for (int i=0; i < GetNumColumns(); i++)
    {
        m_nBaseWidth += (m_columnArray[i]->GetFixedWidth() + (m_nBaseFontSize/2));
        if (m_columnArray[i]->GetHeight() > m_nHeight)
        {
            m_nHeight = m_columnArray[i]->GetHeight();
        }
    }

    m_nWidth = (uint16) ((float)m_nBaseWidth * m_fScale);

    //adjust vertical positions
    for (int i=0; i < GetNumColumns(); i++)
    {
        uint16 nHt = m_columnArray[i]->GetHeight();
        if (nHt < m_nHeight)
        {
            LTIntPt pos = m_columnArray[i]->GetBasePos();
            uint16 nOffset = (uint16) ( (LTFLOAT)(m_nHeight - nHt) / m_fScale );
            pos.y = m_basePos.y + nOffset / 2;
            m_columnArray[i]->SetBasePos(pos);
        }
    }
}
void TableListedItems::PaintClients( const WidgetPainter &painter )
{
    Pos p;
    Dim2i d( GetWidth(), 0);

    Rect client_area = GetParent()->GetClientRect(this)-GetPosition();
    Rect visibile = TableWidget::GetCrossing( client_area );
    
    p.y = RowRect( visibile.GetY1() ).GetY();
    for ( int i=visibile.GetY1(); i<visibile.GetY2(); ++i )
    {
        d.y = GetRowHeight(i);

        int last_col = GetNumColumns() -1;
        Rect fa = RowRect( i );

        if ( _skins.Select( GetState(i) ) )
        {
            _skins.SetSize( Dim2i(fa.GetW(),fa.GetH()) );
        }
        _skins.Paint( painter, fa.GetPos(), fa );

        p.y += d.y;
    }
}
// Returns the control's inherent size, based on the length of the input field and the current font size.
bool ElementFormControlTextArea::GetIntrinsicDimensions(Rocket::Core::Vector2f& dimensions)
{
	dimensions.x = (float) (GetNumColumns() * Core::ElementUtilities::GetStringWidth(this, "m"));
	dimensions.y = (float) (GetNumRows() * Core::ElementUtilities::GetLineHeight(this));

	return true;
}
 void WidgetTableWidget::RemoveColumns( int column, int num_columns )
 {
     int columns = GetNumColumns();
     {
         DirtyLock guard_dirty(this);
         {
             for( int j=column; j < column+num_columns; ++j )
             {
                 for( int i=0; i < GetNumRows(); ++i )
                 {
                     if( Settled( j,i ) ) Retrieve( j,i );
                 }
             }
         }
         {
             for( int j=column; j < columns - num_columns; ++j )
             {
                 for( int i=0; i < GetNumRows(); ++i )
                 {
                     if( Settled( j+num_columns, i ) )
                     {
                         Cell *pcell = _settlers.Find( Pos( j+num_columns, i ) );
                         Widget *client = pcell->_settler;
                         Rect::Alignment align = pcell->_alignment;
                         Retrieve( pcell->_settler );
                         Insert( j,i,client,align );
                     }
                 }
             }
         }
     }
     TableWidget::RemoveColumns( column,num_columns );	
 }
예제 #5
0
void CLTGUIColumnCtrl::SetColors(uint32 argbSelected, uint32 argbNormal, uint32 argbDisabled)
{
    CLTGUICtrl::SetColors(argbSelected, argbNormal, argbDisabled);
    for (int i=0; i < GetNumColumns(); i++)
    {
        m_columnArray[i]->SetColors(m_argbSelected, m_argbNormal, m_argbDisabled);
    }
}
예제 #6
0
// Render the control
void CLTGUIColumnCtrl::OnSelChange()
{

    for (int i=0; i < GetNumColumns(); i++)
    {
        m_columnArray[i]->Select(IsSelected());
    }
}
예제 #7
0
void ListViewControl::AddRow()
{
    LVITEM item = { };
    item.mask = LVIF_COLUMNS;
    item.cColumns = GetNumColumns();

    ListView_InsertItem(getHandle(), &item);
}
예제 #8
0
Rect TableWidget::RowRect( int row ) const
{
    int last_col = GetNumColumns() -1;
    
    Rect R = CellRect( 0, row) | CellRect( last_col, row);
    Rect r = ClientRect( 0, row) | ClientRect( last_col, row);

    return Rect( R.GetX1(), r.GetY1(), R.GetW(), r.GetH() );
}
예제 #9
0
// Render the control
void CLTGUIColumnCtrl::Render ()
{
    if (!IsVisible()) return;

    for (int i=0; i < GetNumColumns(); i++)
    {
        if (m_columnArray[i]->IsVisible())
            m_columnArray[i]->Render();
    }
}
예제 #10
0
void CLTGUIColumnCtrl::SetScale(float fScale)
{
    CLTGUICtrl::SetScale(fScale);
    m_nFontSize = (uint8)(m_fScale * (float)m_nBaseFontSize);
    for (int i=0; i < GetNumColumns(); i++)
    {
        m_columnArray[i]->SetScale(fScale);
    }
    CalculateSize();

}
예제 #11
0
void CLTGUIColumnCtrl::SetBasePos ( LTIntPt pos )
{
    CLTGUICtrl::SetBasePos(pos);
    LTIntPt tmpPos = m_basePos;
    for (int i=0; i < GetNumColumns(); i++)
    {
        m_columnArray[i]->SetBasePos(tmpPos);
        tmpPos.x += (m_columnArray[i]->GetFixedWidth() + (m_nBaseFontSize/2) );
    }

    CalculateSize();

}
예제 #12
0
// Clears all data associated with cells of one row (string, blob and guid)    
void CValueTable::DeleteRowData(int RowIdx)
{
	for (int ColIdx = 0; ColIdx < GetNumColumns(); ColIdx++)
	{
		const CType* Type = GetColumnID(ColIdx)->GetType();

		if (Type == TString)
			DATA_TYPE_NV(nString)::Delete(GetValuePtr(ColIdx, RowIdx));
		else if (Type == DATA_TYPE(CBuffer))
			DATA_TYPE_NV(CBuffer)::Delete(GetValuePtr(ColIdx, RowIdx));
		else if (!Type)
			((CData*)GetValuePtr(ColIdx, RowIdx))->Clear();
	}
}
 bool WidgetTableWidget::Insert( int column, int row, Widget *client, int align_flg )
 {
     Rect::Alignment align = Rect::Alignment(align_flg);
     if ( column < GetNumColumns() && row < GetNumRows() && !Settled( column, row) )
     {
         Rect area = client->GetBoundingRect().Align( ClientRect( column, row), align ) ;
         Cell cell;
         cell._alignment = align;
         cell._settler = client;
         _settlers.Insert( Pos(column,row), cell);
         _placement.Insert( client, Pos(column,row) );
         HubWidget::Insert( client, area.GetX(), area.GetY() );
         return true;
     }
     else { assert(!"No such column or row"); return false; }
 }
예제 #14
0
// Set the font
void CLTGUIColumnCtrl::SetFont(CUIFont *pFont, uint8 nFontSize, LTBOOL bSetForAll)
{
    if (!pFont && !nFontSize)
    {
        return;
    }

    if (pFont)
        m_pFont = pFont;
    if (nFontSize)
        m_nBaseFontSize = nFontSize;

    m_nFontSize = (uint8)(m_fScale * (float)m_nBaseFontSize);

    if (bSetForAll)
    {
        for (int i=0; i < GetNumColumns(); i++)
        {
            m_columnArray[i]->SetFont(pFont,nFontSize);
        }
        CalculateSize();
    }

}