| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- /*
- ** Command & Conquer Renegade(tm)
- ** Copyright 2025 Electronic Arts Inc.
- **
- ** This program is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- /***********************************************************************************************
- *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
- ***********************************************************************************************
- * *
- * Project Name : Combat *
- * *
- * $Archive:: /Commando/Code/Commando/dlgmpwolbuddylistpopup.cpp $*
- * *
- * Author:: Patrick Smith *
- * *
- * $Modtime:: 12/01/01 7:35p $*
- * *
- * $Revision:: 7 $*
- * *
- *---------------------------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
- #include "dlgmpwolbuddylistpopup.h"
- #include "dlgmpwolpagebuddy.h"
- #include "WOLBuddyMgr.h"
- #include "listctrl.h"
- ////////////////////////////////////////////////////////////////
- //
- // MPWolBuddyListPopupClass
- //
- ////////////////////////////////////////////////////////////////
- MPWolBuddyListPopupClass::MPWolBuddyListPopupClass (void) :
- Observer (NULL),
- PopupDialogClass (IDD_MP_WOL_BUDDY_LIST_POPUP)
- {
- return ;
- }
- ////////////////////////////////////////////////////////////////
- //
- // On_Init_Dialog
- //
- ////////////////////////////////////////////////////////////////
- void
- MPWolBuddyListPopupClass::On_Init_Dialog (void)
- {
- //
- // Configure the list ctrl
- //
- ListCtrlClass *list_ctrl = (ListCtrlClass *)Get_Dlg_Item (IDC_BUDDY_LIST_CTRL);
- if (list_ctrl != NULL) {
- list_ctrl->Add_Column (L"", 1.0F, Vector3 (1, 1, 1));
- //
- // Loop over all the buddies
- //
- WOLBuddyMgr* buddyMgr = WOLBuddyMgr::GetInstance(false);
- if (buddyMgr) {
- const WWOnline::UserList& list = buddyMgr->GetBuddyList();
- const unsigned int count = list.size();
-
- for (unsigned int index = 0; index < count; ++index) {
- const RefPtr<WWOnline::UserData>& user = list[index];
- if (user->GetLocation() != WWOnline::USERLOCATION_OFFLINE) {
- list_ctrl->Insert_Entry(index, user->GetName());
- }
- }
- buddyMgr->Release_Ref();
- }
- }
- PopupDialogClass::On_Init_Dialog ();
- return ;
- }
- ////////////////////////////////////////////////////////////////
- //
- // On_Command
- //
- ////////////////////////////////////////////////////////////////
- void
- MPWolBuddyListPopupClass::On_Command (int ctrl_id, int message_id, DWORD param)
- {
- switch (ctrl_id)
- {
- case IDC_SELECT_BUTTON:
- On_Select ();
- break;
- }
- PopupDialogClass::On_Command (ctrl_id, message_id, param);
- return ;
- }
- ////////////////////////////////////////////////////////////////
- //
- // On_ListCtrl_DblClk
- //
- ////////////////////////////////////////////////////////////////
- void
- MPWolBuddyListPopupClass::On_ListCtrl_DblClk
- (
- ListCtrlClass *list_ctrl,
- int ctrl_id,
- int item_index
- )
- {
- On_Select ();
- return ;
- }
- ////////////////////////////////////////////////////////////////
- //
- // On_Select
- //
- ////////////////////////////////////////////////////////////////
- void
- MPWolBuddyListPopupClass::On_Select (void)
- {
- ListCtrlClass *list_ctrl = (ListCtrlClass *)Get_Dlg_Item (IDC_BUDDY_LIST_CTRL);
- if (list_ctrl == NULL) {
- return ;
- }
- //
- // Get the currently selected entry from the list control
- //
- int curr_sel = list_ctrl->Get_Curr_Sel ();
- if (curr_sel != -1) {
- //
- // Record the name of the entry
- //
- SelectedUserName = list_ctrl->Get_Entry_Text (curr_sel, 0);
-
- //
- // Notify the observer (if necessary)
- //
- if (Observer != NULL) {
- Observer->Set_Buddy_Name(SelectedUserName);
- }
-
- End_Dialog ();
- }
-
- return ;
- }
|