Beispiel #1
0
HRESULT CTickdataGrid::init()
{
    HRESULT hr = WARMGUI::CGridCtrl::init();
    if (SUCCEEDED(hr)) {
        try {
            char key[MAX_PATH];
            _snprintf_s(key, MAX_PATH, "%s.head", _str_conf);
            //const std::string tmp = _config->getString(key).c_str();
            //CChineseCodeLib::Gb2312ToUnicode(head, MAX_PATH, tmp.c_str());
            WStringArray wsa;
            _config->getStringVector(wsa, key);
            SetColumnCount(wsa.size());
            SetFixedRowCount(1);
            {//test first cell
                GV_ITEM item;
                item.mask = GVIF_TEXT;
    
                item.col = item.row = 0;
                for (int i = 0; i < wsa.size(); i++) {
                    item.col = i;
                    item.strText = wsa[i];
                    SetItem(&item);
                }
            }
       }catch( ... ) {
            hr = -1;
        }
    }
    _count = 1;
    return hr;
}
Beispiel #2
0
void CTradeGridBase::FillHeader(ITradeTable* pTradeTable)
{
	if (pTradeTable)
	{
		m_pTradeTable = pTradeTable;
		int iCount = m_pTradeTable->GetCount();
		SetColumnCount(iCount);
		SetRowCount(1);
		SetFixedRowCount(1);
		SetFixedTextColor(m_crWindowText);	
		SetFixedBkColor(m_cr3DFace);
		SetTextColor(m_crWindowText);
		SetGridBkColor(0xFFFFFF);
		SetTextBkColor(m_crWindowColour);
		//SetAutoSizeStyle(GVS_DEFAULT);
		CClientDC dc(this);
		short tmLen = (short)dc.GetTextExtent("0").cx;
		for (int i = 0; i < iCount; i++)
		{
			ITradeColumn* pItem = m_pTradeTable->GetItems(i);
			if (pItem)
			{
				SetItemData(0, i, (LPARAM)pItem);
				CString sTmp = pItem->GetDispName();
				int nLen = sTmp.GetLength();
				SetItemText(0, i, pItem->GetDispName());
				SetColumnWidth(i, nLen * tmLen);
			}
		}
	}
	
}
Beispiel #3
0
	void Init()
	{
		SetCallbackFunc(GridCallback, (LPARAM)this);
		SetCallbackFuncPrepCache(GridCallbackPrepCache, (LPARAM)this);
		SetCallbackFuncCellClick(GridCallbackCellClick, (LPARAM)this);
		SetFixedRowCount(1);
		SetFixedColumnCount(0);
		SetRowCount(m_attrs.size());
		SetColumnCount(4);
	}
void CVariablesGrid::BuildWatch()
{
	m_gridType = WATCH;

	m_titleList.RemoveAll();
	m_treeLevelArray.RemoveAll();
	m_treeForcePlusArray.RemoveAll();
	AddSection("Name", "Value");
	SetFixedRowCount(1);
	SetRowCount(2);
}
Beispiel #5
0
BOOL GGridCtrl::Create(const RECT& rect, CWnd* parent, UINT nID, DWORD dwStyle )
{	
	RECT rc;
	parent->GetClientRect( &rc );
	rc.left += 3; rc.top += 15; rc.right -= 3; rc.bottom -= 3;
	if( !CGridCtrl::Create( rc, parent, nID, dwStyle ) )	
		return FALSE;

	EnableDragAndDrop(TRUE);
	SetFixedColumnSelection(TRUE);
	SetFixedRowSelection(TRUE);
	EnableColumnHide();
	AutoSize();
	SetCompareFunction(CGridCtrl::pfnCellNumericCompare);
	SetFixedRowCount(1);
	SetFixedColumnCount(1);		
	EnableDragRowMode( FALSE );
	EnableDragAndDrop( FALSE );	
	SetSingleRowSelection(TRUE);
	SetFixedRowSelection( TRUE );
	SetFixedColumnSelection( TRUE );
	SetRowHeight(0,20);
	return TRUE;
}
void CVariablesGrid::BuildLocals( LuaObject tableObj )
{
    SetRedraw(FALSE);
	
	m_gridType = LOCALS;

	m_titleList.RemoveAll();
	m_treeLevelArray.RemoveAll();
	m_treeForcePlusArray.RemoveAll();
	AddSection("Name", "Value");
	SetFixedRowCount(1);
	SetRowCount(1);

	LuaState* state = tableObj.GetState();

	int tableCount = tableObj.GetCount();
	for ( int i = 0; i < tableCount; ++i )
	{
		LuaObject entryObj = tableObj[ i + 1 ];
		LuaObject indentLevelObj = entryObj[ 2 ];
		LuaObject valueObj = entryObj[ 3 ];

		CStringW ident = DebugBasicSerialize(entryObj[ 1 ]);
		int indentLevel = indentLevelObj.GetInteger();
		CStringW value = DebugBasicSerialize( valueObj );

		int curRow = AddEditProperty( indentLevel, ident, true );
		SetEditProperty( curRow, value );

		// Make an extra row.
		if ( valueObj.IsString()  &&  strcmp( valueObj.GetString(), "!!!TABLE!!!" ) == 0 )
		{
			bool addTreeRowForPlusMinus = false;

			if ( i < tableCount - 1 )
			{
				LuaObject nextIndentLevelObj = tableObj[ i + 2 ][ 2 ];
				int nextIndentLevel = nextIndentLevelObj.GetInteger();
				if ( nextIndentLevel != indentLevel + 1 )
				{
					addTreeRowForPlusMinus = true;
				}
			}
			else
			{
				addTreeRowForPlusMinus = true;
			}

			if ( addTreeRowForPlusMinus )
			{
				m_treeForcePlusArray[ curRow - 1 ] = true;
			}
		}
 
		m_treeLevelArray[ curRow - 1 ] |= 0x80;
	}

	FixupRows(true);

    SetRedraw(TRUE);

}