void
CFileSystemDialogImp::OnPostLayoutLoad( void )
{GUCE_TRACE;

    GUCEF::GUI::CFileSystemDialog::OnPostLayoutLoad();
    
    // Try and link the icon imageset
    CEGUI::ImagesetManager* imgSetManager = CEGUI::ImagesetManager::getSingletonPtr();
    if ( imgSetManager->isImagesetPresent( "Icons" ) )
    {
        m_iconsImageSet = imgSetManager->getImageset( "Icons" );
    }

    // Hook up the event handlers
    CEGUI::FrameWindow* window = static_cast< CEGUI::FrameWindow* >( GetWindow()->GetImplementationPtr() );
    window->subscribeEvent( CEGUI::FrameWindow::EventCloseClicked                                ,
                            CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnCancelButtonClick , 
                                                      this                                       ) );    

    CEGUI::MultiColumnList* fsViewWidget = static_cast< CEGUI::MultiColumnList* >( GetFileSystemGridView()->GetImplementationPtr() );
    fsViewWidget->subscribeEvent( CEGUI::MultiColumnList::EventSelectionChanged                   ,
                                  CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnItemSelected , 
                                                            this                                  ) );    
    fsViewWidget->subscribeEvent( CEGUI::MultiColumnList::EventMouseDoubleClick                     ,
                                  CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnItemDblClicked , 
                                                            this                                    ) );  
    CEGUI::PushButton* okButton = static_cast< CEGUI::PushButton* >( GetOkButton()->GetImplementationPtr() );
    okButton->subscribeEvent( CEGUI::PushButton::EventClicked                                  ,
                              CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnOkButtonClick , 
                                                        this                                   ) );
    CEGUI::PushButton* cancelButton = static_cast< CEGUI::PushButton* >( GetCancelButton()->GetImplementationPtr() );
    cancelButton->subscribeEvent( CEGUI::PushButton::EventClicked                                      ,
                                  CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnCancelButtonClick , 
                                                            this                                       ) );
}
示例#2
0
_MEMBER_FUNCTION_IMPL(GUIMultiColumnList, setItem)
{
	CEGUI::MultiColumnList * pWindow = sq_getinstance<CEGUI::MultiColumnList *>(pVM);
	if(!pWindow)
	{
		sq_pushbool(pVM, false);
		return 1;
	}

	SQInteger sqiRow;
	SQInteger sqiColumn;
	const char * value;
	//CEGUI::colour color(0xFFFFFFFF); // TODO: color from hex param

	// FIXME: order of params -> invert	
	sq_getstring(pVM, 2, &value);
	sq_getinteger(pVM, 3, &sqiColumn);
	sq_getinteger(pVM, 4, &sqiRow);
	
	try
	{
		MultiColumnListItem* pItem = new MultiColumnListItem(value);
		//pItem->setTextColours(color);
		pWindow->setItem(pItem, sqiColumn, sqiRow);
		
		sq_pushbool(pVM, true);
	}
	catch(...)
	{
		sq_pushbool(pVM, false);
	}
	return 1;
}
const char* CGUIGridList_Impl::GetItemText ( int iRow, int hColumn )
{
    try
    {
        CEGUI::MultiColumnList* pMultiColumnList = reinterpret_cast < CEGUI::MultiColumnList* > ( m_pWindow );
        if ( (uint)iRow >= pMultiColumnList->getRowCount() || (uint)GetColumnIndex( hColumn ) >= pMultiColumnList->getColumnCount() )
            return "";

        // Grab the item at the chosen row / column
        CEGUI::ListboxItem* pItem = reinterpret_cast < CEGUI::MultiColumnList* > ( m_pWindow ) -> getItemAtGridReference ( CEGUI::MCLGridRef ( iRow, GetColumnIndex ( hColumn ) ) );
        if ( pItem )
        {
            const char *szRet = pItem->getText().c_str ();

            if ( !m_bIgnoreTextSpacer )
            {
                unsigned char ucSpacerSize = (unsigned char)(strlen ( CGUIGRIDLIST_SPACER ));

                if ( GetColumnIndex ( hColumn ) == 0 ) {
                    // Make sure there is a spacer to skip
                    if ( strncmp ( szRet, CGUIGRIDLIST_SPACER, strlen ( CGUIGRIDLIST_SPACER ) ) == 0 )
                        szRet += ucSpacerSize;
                }
            }

            return szRet;
        }
    }
    catch ( CEGUI::Exception )
    {
        return "";
    }

    return "";
}
示例#4
0
bool OpenSaleUI()
{
	CEGUI::WindowManager& wndmgr = GetWndMgr();
	//获取出售订单ID
	CEGUI::MultiColumnList* mcl = WMCL(wndmgr.getWindow("Auction/Tab/BuySale/BuyMCL"));
	if(!mcl)
		return false;
	CEGUI::ListboxItem* lbi = mcl->getFirstSelectedItem();
	if(!lbi)
	{
		//MessageBox(g_hWnd,AppFrame::GetText("AU_100"),"ERROR",MB_OK);
		GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_100"),NULL,NULL,true);
		return false;
	}

	CEGUI::Window* wnd = wndmgr.getWindow("Auction/SaleWnd");
	wnd->setVisible(true);
	wnd->setAlwaysOnTop(true);
	CEGUI::Editbox* editbox = WEditBox(wnd->getChildRecursive("Auction/SaleWnd/saleNum"));//出售界面编辑框激活
	editbox->activate();

	AHdata& ah = GetInst(AHdata);
	uint ID = lbi->getID();
	ah.SetCanSaleID(ID);
	return true;
}
示例#5
0
_MEMBER_FUNCTION_IMPL(GUIMultiColumnList, getItem)
{
	CEGUI::MultiColumnList * pWindow = sq_getinstance<CEGUI::MultiColumnList *>(pVM);
	if(!pWindow)
	{
		sq_pushbool(pVM, false);
		return 1;
	}

	SQInteger sqiRow;
	SQInteger sqiColumn;

	sq_getinteger(pVM, -2, &sqiRow);
	sq_getinteger(pVM, -1, &sqiColumn);

	try
	{
		CEGUI::MCLGridRef grid_ref(sqiRow, sqiColumn);
		CEGUI::ListboxItem* pItem = pWindow->getItemAtGridReference(grid_ref);
		sq_pushstring(pVM, pItem->getText().c_str(), -1);
	}
	catch(...)
	{
		sq_pushbool(pVM, false);
	}
	return 1;
}
bool
CFileSystemDialogImp::OnItemDblClicked( const CEGUI::EventArgs& e )
{GUCE_TRACE;
            
    // Test if this was a left mouse click
    const CEGUI::MouseEventArgs& eData = static_cast< const CEGUI::MouseEventArgs& >( e );    
    if ( eData.button == CEGUI::LeftButton )
    {
        // Get some easy access to data
        CGridViewImp* fsView = static_cast< CGridViewImp* >( GetFileSystemGridView() );
        CEGUI::MultiColumnList* fsViewWidget = fsView->GetImplementationWidget();        

        UInt32 columnIndex = 0;
        UInt32 rowIndex = 0;
        if ( fsView->TestForItemHit( eData.position.d_x , 
                                     eData.position.d_y ,
                                     columnIndex        ,
                                     rowIndex           ) )
        {        
            CEGUI::ListboxItem* listItem = fsViewWidget->getItemAtGridReference( CEGUI::MCLGridRef( rowIndex, columnIndex ) );
            if ( NULL != listItem )
            {
                if ( listItem->getText() == ".." )
                {
                    // ".." means go up one dir
                    m_currentPath = GUCEF::CORE::StripLastSubDir( m_currentPath );
                    RefreshView();
                }
                else
                if ( IsItemADirectory( listItem->getText().c_str() ) )
                {
                    GUCEF::CORE::AppendToPath( m_currentPath, listItem->getText().c_str() );
                    RefreshView();
                }
                else
                if ( IsItemAnArchive( listItem->getText().c_str() ) )
                {
                    CString itemName( listItem->getText().c_str() );
                    CString realName = itemName.CutChars( 3, true );
                    GUCEF::CORE::AppendToPath( m_currentPath, realName );
                    RefreshView();
                }
            }
        }
    }
    
    return true;
}
示例#7
0
_MEMBER_FUNCTION_IMPL(GUIMultiColumnList, removeRow)
{
	CEGUI::MultiColumnList * pWindow = sq_getinstance<CEGUI::MultiColumnList *>(pVM);
	if(!pWindow)
	{
		sq_pushbool(pVM, false);
		return 1;
	}

	SQInteger sqiRow;
	sq_getinteger(pVM, -1, &sqiRow);

	pWindow->removeRow(sqiRow);
	sq_pushbool(pVM, true);
	return 1;
}
void CServerBrowser::OnMasterListQuery(int iType)
{
	// Reset the server browser list
	CEGUI::MultiColumnList * pMultiColumnList = (CEGUI::MultiColumnList *)m_GUIElements.pServerMultiColumnList;
	pMultiColumnList->resetList();

	// Reset the server and master list queries
	m_pMasterListQuery->Reset();
	m_pServerQuery->Reset();

	// Query the master list
	if(!m_pMasterListQuery->Query(iType))
	{
		String strError("Failed to contact the master list (%s).\nPlease check your internet connection.", m_pMasterListQuery->GetHttpClient()->GetLastErrorString().Get());
		g_pClient->GetGUI()->ShowMessageBox(strError.Get(), "Error");
	}
}
示例#9
0
//撤销委托订单事件
bool OnCancelAgentOrder(const CEGUI::EventArgs& e)
{
	CEGUI::WindowManager& mgr = GetWndMgr();
	CEGUI::MultiColumnList* mcl = WMCL(mgr.getWindow("Auction/Tab/Query/MCL"));
	//获得选中Item对应的订单ID
	CEGUI::ListboxItem* li = mcl->getFirstSelectedItem();
	if(!li)
	{
		/***********************************************************************/
		/* zhaohang fix 2010-9-3
		/* 修改消息框形式,采用封装的MsgEventManager,以及新的字符资源加载方式Appframe
		/***********************************************************************/
		GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_113"),NULL,NULL,true);
		return false;
	}
	uint orderID = li->getID();
	AHdata& ah = GetInst(AHdata);
	ah.Send_AH_REMOVE_AGENT(orderID);
	return true;
}
示例#10
0
_MEMBER_FUNCTION_IMPL(GUIMultiColumnList, addRow)
{
	CEGUI::MultiColumnList * pWindow = sq_getinstance<CEGUI::MultiColumnList *>(pVM);
	if(!pWindow)
	{
		sq_pushbool(pVM, false);
		return 1;
	}

	// Add row or insert at index
	if(sq_gettop(pVM) > 1)
	{
		SQInteger sqiInsert = 0;
		sq_getinteger(pVM, -1, &sqiInsert);
		sq_pushinteger(pVM, pWindow->insertRow(sqiInsert));
	}
	else
		sq_pushinteger(pVM, pWindow->addRow());
	return 1;
}
示例#11
0
bool UpdateCanSaleMCLDate(const CEGUI::EventArgs& e)
{
	AHdata& ah = GetInst(AHdata);
	AHdata::vecOrderRaw listOR = ah.m_CanSaleOrder;//可出售列表
	CEGUI::MultiColumnList* mcl = WMCL(WEArgs(e).window);
	if(!mcl)
		return false;
	mcl->resetList();
	AHdata::vecOrderRaw::iterator it = listOR.begin();
	for (uint i = 0 ; i < listOR.size() ; ++i,++it)
	{
		mcl->addRow();
		CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(ToCEGUIString(AppFrame::GetText("AU_104")),it->id);//第二个参数与订单ID关联
		lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
		mcl->setItem(lti,0,i);

		lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(it->price));
		lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
		mcl->setItem(lti,1,i);

		lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(it->cnt));
		lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
		mcl->setItem(lti,2,i);
	}
	return true;
}
CGUIListItem* CGUIGridList_Impl::GetItem ( int iRow, int hColumn )
{
    try
    {
        CEGUI::MultiColumnList* pMultiColumnList = reinterpret_cast < CEGUI::MultiColumnList* > ( m_pWindow );
        if ( (uint)iRow >= pMultiColumnList->getRowCount() || (uint)GetColumnIndex( hColumn ) >= pMultiColumnList->getColumnCount() )
            return NULL;

        // Grab the item at the chosen row / column
        CEGUI::ListboxItem* pItem = reinterpret_cast < CEGUI::MultiColumnList* > ( m_pWindow ) -> getItemAtGridReference ( CEGUI::MCLGridRef ( iRow, GetColumnIndex ( hColumn ) ) );

        // If it exists, get the CGUIListItem by using the pool
        if ( pItem )
        {
            return GetListItem ( pItem );
        }
    }
    catch ( CEGUI::Exception )
    {}

    return NULL;
}
示例#13
0
bool OpenBuyUI()
{
	CEGUI::WindowManager& wndmgr = GetWndMgr();
	CEGUI::MultiColumnList* mcl = WMCL(wndmgr.getWindow("Auction/Tab/BuySale/SaleMCL"));
	if(!mcl)
		return false;
	CEGUI::ListboxItem* lbi = mcl->getFirstSelectedItem();
	if(!lbi)
	{
		GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_102"),NULL,NULL,true);
		return false;
	}
	CEGUI::Window* wnd = wndmgr.getWindow("Auction/BuyWnd");
	wnd->setVisible(true);
	wnd->setAlwaysOnTop(true);
	CEGUI::Editbox* editbox = WEditBox(wnd->getChildRecursive("Auction/Buy/buyNum"));//购买界面编辑框激活
	editbox->activate();
	AHdata& ah = GetInst(AHdata);
	//界面获取购买订单ID
	uint ID = lbi->getID();
	ah.SetCanBuyID(ID);//保存要购买的订单ID
	return true;
}
示例#14
0
// event rowClick(string guiName)
bool OnRowClick(const CEGUI::EventArgs &eventArgs)
{
	CEvents * pEvents = g_pClient->GetEvents();
	String eventName ("rowClick");

	if(!pEvents->IsEventRegistered(eventName))
		return false;

	const CEGUI::WindowEventArgs eArgs = static_cast<const CEGUI::WindowEventArgs&>(eventArgs);
	CEGUI::Window * pWindow = eArgs.window;
	CSquirrel * pScript = g_pClient->GetClientScriptManager()->GetGUIManager()->GetScript(pWindow);

	CEGUI::MultiColumnList * pMultiColumnList = static_cast<CEGUI::MultiColumnList*>(eArgs.window);
	int iItemID = pMultiColumnList->getItemRowIndex(pMultiColumnList->getFirstSelectedItem());

	CSquirrelArguments pArguments;
	pArguments.push(eArgs.window->getName().c_str()); // Window Name
	pArguments.push(iItemID); // Row

	CLogFile::Printf("Value: %i",iItemID);

	pEvents->Call(eventName, &pArguments, pScript);
	return true;
}
示例#15
0
bool UpdatePerMCLDate(const CEGUI::EventArgs& e)
{
	AHdata& ah = GetInst(AHdata);
	//AHdata::listSubOrderRaw listSubOR = ah.m_AgentOrder;
	AHdata::MapSubOrderRaw mapSubOR = ah.m_AgentOrder;
	CEGUI::MultiColumnList* mcl = WMCL(WEArgs(e).window);
	if(!mcl)
		return false;
	mcl->resetList();

	AHdata::MapSubOrderRaw::iterator it = mapSubOR.begin();
	for (int i = 0 ; it != mapSubOR.end(); ++it,++i)
	{
		mcl->addRow();
		CEGUI::ListboxTextItem* lti = NULL;
		lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(it->first),it->first);//控件ID与订单ID关联
		lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
		mcl->setItem(lti,0,i);
		
		AH::SubOrderRaw& mapOr = it->second;
		if(mapOr.type == AH::OT_BUY)
			lti = new CEGUI::ListboxTextItem(ToCEGUIString(AppFrame::GetText("AU_104")));
		else if(mapOr.type == AH::OT_SELL)
			lti = new CEGUI::ListboxTextItem(ToCEGUIString(AppFrame::GetText("AU_105")));
		lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
		mcl->setItem(lti,1,i);

		lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(mapOr.cnt));
		lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
		mcl->setItem(lti,2,i);

		lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(mapOr.price));
		lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
		mcl->setItem(lti,3,i);

		/////////////////////////////////////////////////
		// zhaohang  2010/5/12 
		// 时间UI未处理
		/////////////////////////////////////////////////
		uint subtime = mapOr.gentime / 60 / 60;
		lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(subtime));
		lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
		mcl->setItem(lti,4,i);
	}
	return false;
}
bool CServerBrowser::OnConnectButtonClick(const CEGUI::EventArgs &eventArgs)
{
	CEGUI::MultiColumnList * pMultiColumnList = (CEGUI::MultiColumnList *)m_GUIElements.pServerMultiColumnList;
	CEGUI::ListboxItem * pHostname = pMultiColumnList->getFirstSelectedItem();
	CEGUI::ListboxItem * pHost = pMultiColumnList->getNextSelected(pHostname);
	CEGUI::ListboxItem * pPlayerCount = pMultiColumnList->getNextSelected(pHost);
	CEGUI::ListboxItem * pMaxPlayers = pMultiColumnList->getNextSelected(pPlayerCount);
	CEGUI::ListboxItem * pPing = pMultiColumnList->getNextSelected(pMaxPlayers);
	CEGUI::ListboxItem * pPassworded = pMultiColumnList->getNextSelected(pPing);


	// Get the host and port
	String strHost;
	unsigned short usPort;

	if(!CMainMenu::GetHostAndPort(pHost->getText().c_str(), strHost, usPort))
	{
		g_pClient->GetGUI()->ShowMessageBox("You must enter a valid host and port!", "Error!");
		return false;
	}

	// Hide the server browser window
	SetVisible(false);

	// Does this server require a password?
	if(pPassworded->getText() == "yes")
	{
		// TODO: Show password entry window
	}
	else
	{
		// Call the connect function
		CMainMenu::GetSingleton()->OnConnect(strHost, usPort, "");
	}

	return true;
}
示例#17
0
void t_chessGui::initServer()
{
   CEGUI::FrameWindow *server = static_cast<CEGUI::FrameWindow *>(wmgr->loadWindowLayout("server.layout"));
   myRoot->addChildWindow(server);
   server->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,CEGUI::Event::Subscriber(boost::bind(closeServer,server,_1)));


   CEGUI::MenuItem *serverItem = static_cast<CEGUI::MenuItem *>(wmgr->getWindow("Root/FrameWindow/Menubar/File/New"));
   serverItem->subscribeEvent(CEGUI::MenuItem::EventClicked,CEGUI::Event::Subscriber(boost::bind(openServer,server,_1)));


   CEGUI::MultiColumnList *testing = static_cast<CEGUI::MultiColumnList *>(wmgr->getWindow("Lols3"));
   testing->addColumn("Names",0,CEGUI::UDim(.25,0));
   testing->addColumn("Action",1,CEGUI::UDim(.25,0));
   testing->addColumn("Wins",2,CEGUI::UDim(.25,0));
   testing->addColumn("Losses",3,CEGUI::UDim(.25,0));

   testing->addRow();
   testing->addRow();

   testing->setItem(new CEGUI::ListboxTextItem("What, wow,"),0u,0u);

   server->hide();
}
示例#18
0
int CGUIGridList_Impl::SetItemText ( int iRow, int hColumn, const char* szText, bool bNumber, bool bSection, bool bFast )
{
    try
    {
        CEGUI::MultiColumnList* win = reinterpret_cast < CEGUI::MultiColumnList* > ( m_pWindow );

        // Get the current item at that offset and set the text
        CGUIListItem_Impl* pItem = reinterpret_cast < CGUIListItem_Impl* > ( GetItem ( iRow, hColumn ) );
        if ( pItem )
        {
            if ( bSection )
            {
                // Set section properties
                pItem->SetFont ( "default-bold-small" );
                pItem->SetDisabled ( true );
                pItem->SetText ( szText );
            }
            else
            {
                pItem->SetFont ( "default-normal" );
                pItem->SetDisabled ( false );

                if ( hColumn == 1 )
                {
                    // Enable some spacing on regular items, if this is the first item
                    
                    char szBuf[CGUIGRIDLIST_MAX_TEXT_LENGTH];
                    if ( m_bIgnoreTextSpacer )
                    {
                        _snprintf ( szBuf, CGUIGRIDLIST_MAX_TEXT_LENGTH - 1, "%s", szText );
                    }
                    else
                    {
                        _snprintf ( szBuf, CGUIGRIDLIST_MAX_TEXT_LENGTH - 1, "%s%s", CGUIGRIDLIST_SPACER, szText );
                    }

                    szBuf[CGUIGRIDLIST_MAX_TEXT_LENGTH-1] = NULL;

                    pItem->SetText ( szBuf );
                }
                else
                {
                    pItem->SetText ( szText );
                }
            }
        }
        else
        {
            

            // If it doesn't, create it and set it in the gridlist
            pItem = new CGUIListItem_Impl ( szText, bNumber );

            CEGUI::ListboxItem* pListboxItem = pItem->GetListItem ();
            win->setItem ( pListboxItem, hColumn, iRow, bFast );

            // Put our new item into the map
            m_Items [ pItem->GetListItem () ] = pItem;

            if ( bSection )
            {
                // Set section properties
                pItem->SetFont ( "default-bold-small" );
                pItem->SetDisabled ( true );
            }
            else if ( hColumn == 1 )
            {
                // Enable some spacing on regular items, if this is the first item
                char szBuf[CGUIGRIDLIST_MAX_TEXT_LENGTH];

                if ( m_bIgnoreTextSpacer )
                {
                    _snprintf ( szBuf, CGUIGRIDLIST_MAX_TEXT_LENGTH-1, "%s", szText );
                }
                else
                {
                    _snprintf ( szBuf, CGUIGRIDLIST_MAX_TEXT_LENGTH-1, "%s%s", CGUIGRIDLIST_SPACER, szText );
                }

                szBuf[CGUIGRIDLIST_MAX_TEXT_LENGTH-1] = NULL;               
                pItem->SetText ( szBuf );
            }
        }

        // If the list is sorted and we just changed an item in the sorting column,
        // re-sort the list.
        if ( win->getSortDirection () != CEGUI::ListHeaderSegment::SortDirection::None &&
             win->getSortColumn () == GetColumnIndex ( hColumn ) )
        {
            win->setSortColumn ( win->getSortColumn () );
            return GetItemRowIndex ( pItem );
        }
        else
        {
            return iRow;
        }
    }
    catch ( CEGUI::Exception ) {}

    return 0;
}
void CServerBrowser::ServerQueryHandler(String strHost, unsigned short usPort, String strQuery, CBitStream * pReply)
{
	// Read the query type
	char cQueryType;

	if(!pReply->Read(cQueryType))
		return;

	// Get the server host and port
	String strHostAndPort("%s:%d", strHost.Get(), usPort);

	if(cQueryType == 'p') // Ping
	{
		// Get the start time from the ping map
		unsigned long ulStartTime = serverPingStartMap[strHostAndPort];

		// Do we have a valid start time?
		if(ulStartTime > 0)
		{
			// Calculate the round trip time
			unsigned long ulPing = (SharedUtility::GetTime() - ulStartTime);

			// Set the server ping in the multi column list
			CEGUI::MultiColumnList * pMultiColumnList = (CEGUI::MultiColumnList *)CServerBrowser::GetSingleton()->m_GUIElements.pServerMultiColumnList;

			for(unsigned int i = 0; i < pMultiColumnList->getRowCount(); i++)
			{
				CEGUI::ListboxItem * pHost = pMultiColumnList->getItemAtGridReference(CEGUI::MCLGridRef(i, 1));

				if(!strHostAndPort.Compare(pHost->getText().c_str()))
				{
					CEGUI::ListboxItem * pPing = pMultiColumnList->getItemAtGridReference(CEGUI::MCLGridRef(i, 3));

					if(pPing)
					{
						char szTempBuf[64];
						pPing->setText(itoa(ulPing, szTempBuf, 10));
						pMultiColumnList->invalidate();
						break;
					}
				}
			}
		}
	}
	else
	{
		// Check if we have a valid stream
		if(!pReply || cQueryType != 'i')
			return;

		// Read the host name
		String strHostName;
		int iPlayerCount;
		int iMaxPlayers;
		bool bPassworded;

		pReply->Read(strHostName);
		pReply->Read(iPlayerCount);
		pReply->Read(iMaxPlayers);
		pReply->Read(bPassworded);

		// Add the server to the multi column list
		CEGUI::MultiColumnList * pMultiColumnList = (CEGUI::MultiColumnList *)CServerBrowser::GetSingleton()->m_GUIElements.pServerMultiColumnList;
		unsigned int iRowIndex = pMultiColumnList->addRow();
		pMultiColumnList->setItem(new ServerBrowserListItem(strHostName.Get()), 0, iRowIndex);
		pMultiColumnList->setItem(new ServerBrowserListItem(strHostAndPort.Get()), 1, iRowIndex);
		char szPlayerCount[9];
		sprintf(szPlayerCount, "%s/%s", iPlayerCount, iMaxPlayers);
		pMultiColumnList->setItem(new ServerBrowserListItem(szPlayerCount), 2, iRowIndex);
		pMultiColumnList->setItem(new ServerBrowserListItem("9999"), 3, iRowIndex);
		pMultiColumnList->setItem(new ServerBrowserListItem(bPassworded ? "Yes" : "No"), 4, iRowIndex);
		pMultiColumnList->invalidate();

		// Save the current time to the ping map
		serverPingStartMap[strHostAndPort] = SharedUtility::GetTime();

		// Send a ping query to the server
		CServerBrowser::GetSingleton()->m_pServerQuery->Query(strHost, usPort, "p");
	}
}
bool CServerBrowser::OnRowClick(const CEGUI::EventArgs &eventArgs)
{
	CEGUI::MultiColumnList * pMultiColumnList = (CEGUI::MultiColumnList *)m_GUIElements.pServerMultiColumnList;
	m_GUIElements.pConnectButton->setEnabled((pMultiColumnList->getSelectedCount() > 0) ? true : false);
	return true;
}
示例#21
0
void
sge::cegui::toolbox::append_row(
    CEGUI::MultiColumnList &_list,
    sge::cegui::toolbox::row const &_mapper
)
{
    FCPPT_ASSERT_PRE(
        static_cast<
        sge::cegui::toolbox::row::size_type
        >(
            _list.getColumnCount()
        )
        ==
        _mapper.size()
    );

    FCPPT_ASSERT_PRE(
        !_mapper.empty()
    );

    CEGUI::uint const index(
        _list.addRow(
            new CEGUI::ListboxTextItem(
                _mapper[
                    0
                ],
                0,
                nullptr
            ),
            0
        )
    );

    for(
        sge::cegui::toolbox::row::size_type const cur
        :
        fcppt::make_int_range(
            fcppt::literal<
            sge::cegui::toolbox::row::size_type
            >(
                1u
            ),
            _mapper.size()
        )
    )
        _list.setItem(
            new CEGUI::ListboxTextItem(
                _mapper[
                    cur
                ],
                0,
                nullptr
            ),
            static_cast<
            CEGUI::uint
            >(
                cur
            ),
            index
        );
}
示例#22
0
void SetInitializedAHUIProperty(CEGUI::Window* pageWnd)
{
	//第一次打开窗口,默认可见
	pageWnd->setVisible(false);

	CEGUI::Window* tab1 = pageWnd->getChildRecursive("Auction/Tab/BuySale");
	tab1->setVisible(true);//默认Tab1可见

	CEGUI::Editbox* editbox = WEditBox(pageWnd->getChildRecursive("Auction/Pickup/EditGold"));//金币提取编辑框只能为数字
	editbox->setText("");
	editbox->setReadOnly(true);
	//editbox->setMaxTextLength(10);
	//只能输入数字
	editbox->setValidationString("[0-9]*");

	editbox = WEditBox(pageWnd->getChildRecursive("Auction/Pickup/EditWeimian"));//位面提取编辑框只能为数字
	editbox->setText("");
	editbox->setReadOnly(true);
	editbox->setValidationString("[0-9]*");
	//editbox->setMaxTextLength(10);
	CEGUI::MultiColumnList* mcl = WMCL(pageWnd->getChildRecursive("Auction/Tab/BuySale/SaleMCL"));
	mcl->setUserColumnDraggingEnabled(false);//列不可拖动
	mcl->setUserSortControlEnabled(false);//列不可排序
	mcl->setUserColumnSizingEnabled(false);//列不可调整宽度

	mcl = WMCL(pageWnd->getChildRecursive("Auction/Tab/BuySale/BuyMCL"));
	mcl->setUserColumnDraggingEnabled(false);//列不可拖动
	mcl->setUserSortControlEnabled(false);//列不可排序
	mcl->setUserColumnSizingEnabled(false);//列不可调整宽度

	CEGUI::Window* wnd = pageWnd->getChildRecursive("Auction/SaleWnd");
	wnd->setVisible(false);//出售界面默认不可见

	editbox = WEditBox(pageWnd->getChildRecursive("Auction/SaleWnd/saleNum"));//出售界面编辑框只能输入数字
	editbox->setText("");
	editbox->setMaxTextLength(10);
	//editbox->setReadOnly(false);
	editbox->setValidationString("[0-9]*");
	editbox = WEditBox(pageWnd->getChildRecursive("Auction/SaleWnd/Text6"));//出售界面交易文本提示
	editbox->setText("");
	editbox = WEditBox(pageWnd->getChildRecursive("Auction/SaleWnd/Text61"));//
	editbox->setText("");
	

	wnd = pageWnd->getChildRecursive("Auction/BuyWnd");
	wnd->setVisible(false);//购买界面默认不可见

	editbox = WEditBox(pageWnd->getChildRecursive("Auction/Buy/buyNum"));//购买界面编辑框只能输入数字
	editbox->setText("");
	//editbox->setReadOnly(false);
	editbox->setValidationString("[0-9]*");
	editbox->setMaxTextLength(4);

	editbox = WEditBox(pageWnd->getChildRecursive("Auction/Buy/Text6"));//购买界面交易文本提示
	editbox->setText("");
	editbox = WEditBox(pageWnd->getChildRecursive("Auction/Buy/Text61"));
	editbox->setText("");

	mcl = WMCL(pageWnd->getChildRecursive("Auction/Tab/Query/MCL"));//个人查询MCL属性
	mcl->setUserColumnDraggingEnabled(false);//列不可拖动
	mcl->setUserSortControlEnabled(false);//列不可排序
	mcl->setUserColumnSizingEnabled(false);//列不可调整宽度

	editbox = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/sale/EditNum"));//编辑框只能输入数字
	editbox->setText("");
	//editbox->setReadOnly(false);
	editbox->setValidationString("[0-9]*");
	editbox->setMaxTextLength(5);

	editbox = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/sale/EditPrice"));//编辑框只能输入数字
	editbox->setText("");
	//editbox->setReadOnly(false);
	editbox->setValidationString("[0-9]*");
	editbox->setMaxTextLength(5);

	editbox = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/EditNum"));//编辑框只能输入数字
	editbox->setText("");
	//editbox->setReadOnly(false);
	editbox->setValidationString("[0-9]*");
	editbox->setMaxTextLength(5);

	editbox = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/EditPrice"));//编辑框只能输入数字
	editbox->setText("");
	//editbox->setReadOnly(false);
	editbox->setValidationString("[0-9]*");
	editbox->setMaxTextLength(5);

	//////////////////////////////////////////////////
	//委托页面支付提示
	wnd = pageWnd->getChildRecursive("Auction/Tab/Agent/sale/subNum");//
	wnd->setText("");
	wnd = pageWnd->getChildRecursive("Auction/Tab/Agent/sale/subGold");//
	wnd->setText("");
	wnd = pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/subNum");
	wnd->setText("");
	wnd = pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/subGold");
	wnd->setText("");
	wnd = pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/Text");
	wnd->setText("");
	////////////////////////////////////////////////////

	/////////////////////////////////////////////////
	// zhaohang  2010/5/14 
	// 刷新按钮屏蔽
	wnd = pageWnd->getChildRecursive("Auction/Tab/BuySale/RefreshSale");
	wnd->setVisible(false);
	wnd = pageWnd->getChildRecursive("Auction/Tab/BuySale/RefreshBuy");
	wnd->setVisible(false);
	wnd = pageWnd->getChildRecursive("Auction/Tab/Query/Refresh");
	wnd->setVisible(false);
	/////////////////////////////////////////////////
}
示例#23
0
void SubscriberAHEvent(CEGUI::Window* pageWnd)
{
	pageWnd->subscribeEvent(EVENT_OPEN,CEGUI::Event::Subscriber(OnOpenedUpdate));//绑定打开界面刷新数据事件

	pageWnd->subscribeEvent("UpdatePickUpUI",CEGUI::Event::Subscriber(UpdatePickUPUIDate));//更新提取界面UI

	CEGUI::PushButton* btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/BuySale/BtnBuyWeimian"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnBuyWeimianBtnClicked));//点击按钮购买位面

	btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/BuySale/BtnSalWeimian"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnSaleWeimianBtnClicked));//点击按钮出售位面

	btn = WPushButton(pageWnd->getChildRecursive("Auction/Pickup/BtnGold"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnPickUpGold));//提取金币

	btn = WPushButton(pageWnd->getChildRecursive("Auction/Pickup/BtnWeimian"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnPickUpWeimian));//提取位面

	CEGUI::MultiColumnList* mcl = WMCL(pageWnd->getChildRecursive("Auction/Tab/BuySale/SaleMCL"));
	mcl->subscribeEvent(CEGUI::MultiColumnList::EventSelectionChanged,CEGUI::Event::Subscriber(OnSaleMCLSelChanged));//位面可购买条目选中事件
	mcl->subscribeEvent("UpdateCanBuyMCL",CEGUI::Event::Subscriber(UpdateCanBuyMCLDate));//更新可购买出售列表
	mcl->subscribeEvent(CEGUI::Window::EventMouseDoubleClick,CEGUI::Event::Subscriber(OnBuyWeimianBtnClicked));//双击可购买Item,事件响应

	mcl = WMCL(pageWnd->getChildRecursive("Auction/Tab/BuySale/BuyMCL"));
	mcl->subscribeEvent(CEGUI::MultiColumnList::EventSelectionChanged,CEGUI::Event::Subscriber(OnBuyMCLSelChanged));//位面可出售条目选中事件
	mcl->subscribeEvent("UpdateBuyMCL",CEGUI::Event::Subscriber(UpdateCanSaleMCLDate));//更新可出售列表
	mcl->subscribeEvent(CEGUI::Window::EventMouseDoubleClick,CEGUI::Event::Subscriber(OnSaleWeimianBtnClicked));//双击可出售Item,事件响应

	mcl = WMCL(pageWnd->getChildRecursive("Auction/Tab/Query/MCL"));
	mcl->subscribeEvent(CEGUI::MultiColumnList::EventSelectionChanged,CEGUI::Event::Subscriber(OnPerMCLSelChanged));//个人挂单条目选中事件
	mcl->subscribeEvent("UpdatePerMCL",CEGUI::Event::Subscriber(UpdatePerMCLDate));//更新个人挂单列表

	CEGUI::Window* wnd = pageWnd->getChildRecursive("Auction/SaleWnd");
	wnd->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,CEGUI::Event::Subscriber(OnSaleUIClosed));//出售界面关闭

	btn = WPushButton(wnd->getChildRecursive("Auction/SaleWnd/Submit"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnSaleSubmit));//提交出售请求

	wnd = pageWnd->getChildRecursive("Auction/BuyWnd");
	wnd->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,CEGUI::Event::Subscriber(OnBuyUIClosed));//购买界面关闭

	btn = WPushButton(wnd->getChildRecursive("Auction/Buy/Submit"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnBuySubmit));//提交购买请求

	CEGUI::Editbox* edb = WEditBox(pageWnd->getChildRecursive("Auction/Buy/buyNum"));//
	edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateBuyUIDate));//购买界面UI更新

	edb = WEditBox(pageWnd->getChildRecursive("Auction/SaleWnd/saleNum"));
	edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateSaleUIDate));//出售界面UI更新

	btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/Agent/sale/Submit"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnAgentSaleSubmit));//委托出售挂单提交

	btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/Submit"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnAgentBuySubmit));//委托求购挂单提交

	edb = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/sale/EditNum"));
	edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateAgentSaleUIDate));//委托出售挂单UI更新
	edb = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/sale/EditPrice"));
	edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateAgentSaleUIDate));//委托出售挂单UI更新


	edb = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/EditNum"));
	edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateAgentBuyUIDate));//委托求购UI更新
	edb = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/EditPrice"));
	edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateAgentBuyUIDate));//委托求购UI更新

	btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/Query/Cancel"));//个人委托撤销挂单
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnCancelAgentOrder));

	//
	btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/Query/Refresh"));//发送请求更新个人挂单列表
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnRefreshPerMCL));

	btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/BuySale/RefreshSale"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnRefreshSaleMCL));//发送请求更新出售委托挂单列表

	btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/BuySale/RefreshBuy"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnRefreshBuyMCL));//发送请求更新求购委托挂单列表


}
    void PropertiesWindow::addPropertyArray(const Property& prop, const CeGuiString& key)
    {
        // Create the new MultiColumnList with two columns
        // Type and Value and set tab text to key
        int tabCount = mTabPane->getTabCount();
        CEGUI::MultiColumnList* newTable = static_cast<CEGUI::MultiColumnList*>
            (CEGUI::WindowManager::getSingleton().createWindow("RastullahLook/MultiColumnList",
            "PropertiesWindow/PropertiesTabControl/" + key));

        // Set table properties
        newTable->setText(key);
        newTable->setPosition(CEGUI::UVector2(
            CEGUI::UDim(0,0),
            CEGUI::UDim(0,0)));
        newTable->setSize(CEGUI::UVector2(
            CEGUI::UDim(1,0),
            CEGUI::UDim(1,0)));
        newTable->setUserSortControlEnabled(false);
        newTable->setFont("Vera Serif-8");

        newTable->addColumn("Type", 0, cegui_reldim(0.3));
        newTable->addColumn("Value", 1, cegui_reldim(0.7));

        // Add the MultiColumnList to the tab pane
        mTabPane->addTab(newTable);

        // Get access to the vector
        PropertyArray vProp = prop.toArray();

        // Iterate through the vector entries and add them
        // to the table
        for(PropertyArray::const_iterator it = vProp.begin(); it != vProp.end(); it++)
        {
            // Check for Int
            if (it->isInt() )
            {
                addPropertyInt(*it, newTable);
            }
            // Check for IntPair
            else if (it->isIntPair() )
            {
                addPropertyIntPair(*it, newTable);
                int rowCount = newTable->getRowCount();
                newTable->addRow(rowCount);
                newTable->setItem(new ListboxTextItem(""), 0, rowCount);
            }
            // Check for IntTriple
            else if (it->isIntTriple() )
            {
                addPropertyIntTriple(*it, newTable);
                int rowCount = newTable->getRowCount();
                newTable->addRow(rowCount);
                newTable->setItem(new ListboxTextItem(""), 0, rowCount);
            }
            // Check for String
            else if (it->isString() )
            {
                addPropertyString(*it, newTable);
            }
            // Check for Bool
            else if (it->isBool() )
            {
                addPropertyBool(*it, newTable);
            }
            // Check for Real
            else if (it->isReal() )
            {
                addPropertyReal(*it, newTable);
            }
            // Check for Vector3
            else if (it->isVector3() )
            {
                addPropertyArray3(*it, newTable);
                int rowCount = newTable->getRowCount();
                newTable->addRow(rowCount);
                newTable->setItem(new ListboxTextItem(""), 0, rowCount);
            }
            // Check for Quaternion
            else if (it->isQuaternion() )
            {
                addPropertyQuaternion(*it, newTable);
                int rowCount = newTable->getRowCount();
                newTable->addRow(rowCount);
                newTable->setItem(new ListboxTextItem(""), 0, rowCount);
            }
        }
        newTable->autoSizeColumnHeader(0);
        newTable->autoSizeColumnHeader(1);
    }
示例#25
0
void GVEvent::OnPageLoad(GamePage *pPage)
{
    pPage->LoadPageWindow();

    //得到Tree控件指针
    m_wnd = pPage->GetPageWindow();
    m_GoodsTree = static_cast<CEGUI::Tree*>(m_wnd->getChildRecursive("GoodsTreeFrame/Tree"));
    if(m_GoodsTree)
        m_GoodsTree->initialise();
    //是否存数据库Combox条目的初始化
    InitIsDBCombobox();
    //物品类型条目的初始化
    InitGoodTypeCombobox();
    //攻击是是否混音Combobox条目的初始化
    InitIsSoundSwitchCombobox();
    //附加属性Combobox条目初始化
    m_GoodsOP.LoadGoodsItemTypeData("data/itemtype1.dat");//先要读取itemtype.dat文件
    InitAddAttrCombobox();
    //初始化附加属性值的Combobox(是否有效,是否隐藏)
    InitAddAttrValueSelCombobox();
    //初始化套装属性Combobox(套装名称)
    InitSuitAttrCombobox();

    //设置模型控制滚动条位置
    ReSetScrollPos();
    //注册事件响应
    //.............
    m_GoodsTree->subscribeEvent(CEGUI::Tree::EventSelectionChanged,CEGUI::Event::Subscriber(&GVEvent::OnBranchSelectChanged,this));//单击TreeItem事件

    CEGUI::MultiColumnList* mclbox = static_cast<CEGUI::MultiColumnList*>(m_wnd->getChildRecursive("GoodsTreeFrame/AddProperty/MultiColumnList"));
    mclbox->subscribeEvent(MultiColumnList::EventSelectionChanged,CEGUI::Event::Subscriber(&GVEvent::OnAddAttrItemSelChanged,this));//附加属性条目选中事件

    mclbox = static_cast<CEGUI::MultiColumnList*>(m_wnd->getChildRecursive("GoodsTreeFrame/GroupBoxSuitAtrr/MultiColumnList"));
    mclbox->subscribeEvent(MultiColumnList::EventSelectionChanged,CEGUI::Event::Subscriber(&GVEvent::OnSuitAttrItemSelChanged,this));//套装属性条目选中事件

    /////////////////////////////////////////////////
    // zhaohang  2010/3/18
    // 新的物品观察控制注册事件响应
    /////////////////////////////////////////////////
    m_wnd->getChild("GoodsTreeFrame/Scal")->subscribeEvent(Scrollbar::EventScrollPositionChanged,CEGUI::Event::Subscriber(&GVEvent::HandScal,this));
    m_wnd->getChild("GoodsTreeFrame/XMove")->subscribeEvent(Scrollbar::EventScrollPositionChanged,Event::Subscriber(&GVEvent::HandXMove,this));
    m_wnd->getChild("GoodsTreeFrame/YMove")->subscribeEvent(Scrollbar::EventScrollPositionChanged,Event::Subscriber(&GVEvent::HandYMove,this));
    m_wnd->getChild("GoodsTreeFrame/XRot")->subscribeEvent(Scrollbar::EventScrollPositionChanged,Event::Subscriber(&GVEvent::HandXRot,this));
    m_wnd->getChild("GoodsTreeFrame/YRot")->subscribeEvent(Scrollbar::EventScrollPositionChanged,Event::Subscriber(&GVEvent::HandYRot,this));
    m_wnd->getChild("GoodsTreeFrame/ZRot")->subscribeEvent(Scrollbar::EventScrollPositionChanged,Event::Subscriber(&GVEvent::HandZRot,this));
    //添加RootItem到Tree
    m_RootItem = AddItemToTree("AllGoods");

    if(m_GoodsOP.LoadGoodsListData("data/goodslist1.dat") == true) //读取Goods数据,并填充到TreeItem
    {
        size_t GoodsTotalNum = m_GoodsOP.GetGoodsTotalNum();
        for(size_t size = 0; size < GoodsTotalNum ; ++size)
        {
            const UIData::tagGoodAttr *GoodAttr = m_GoodsOP.GetGoodAttrByIndex(size);
            if(GoodAttr != NULL)
            {
                CEGUI::TreeItem* Item = AddItemToRootItem(GoodAttr->strOrigName.c_str());
                if(Item != NULL)
                    m_ChildRootItem.push_back(Item);
            }
        }
    }
    m_RootItem->toggleIsOpen();//默认展开Tree
}