summaryrefslogtreecommitdiff
path: root/game/client/tf/vgui/select_player_dialog.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/tf/vgui/select_player_dialog.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/client/tf/vgui/select_player_dialog.h')
-rw-r--r--game/client/tf/vgui/select_player_dialog.h107
1 files changed, 107 insertions, 0 deletions
diff --git a/game/client/tf/vgui/select_player_dialog.h b/game/client/tf/vgui/select_player_dialog.h
new file mode 100644
index 0000000..64ef206
--- /dev/null
+++ b/game/client/tf/vgui/select_player_dialog.h
@@ -0,0 +1,107 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef SELECT_PLAYER_DIALOG_H
+#define SELECT_PLAYER_DIALOG_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "vgui_controls/EditablePanel.h"
+#include "vgui_controls/ScrollableEditablePanel.h"
+#include "tf_controls.h"
+#include "vgui_avatarimage.h"
+
+// Select Player Dialog states
+enum
+{
+ SPDS_SELECTING_PLAYER,
+ SPDS_SELECTING_FROM_FRIENDS,
+ SPDS_SELECTING_FROM_SERVER,
+
+ SPDS_NUM_STATES,
+};
+
+// Button that displays the name & avatar image of a potential target
+class CSelectPlayerTargetPanel : public vgui::EditablePanel
+{
+ DECLARE_CLASS_SIMPLE( CSelectPlayerTargetPanel, vgui::EditablePanel );
+public:
+ CSelectPlayerTargetPanel( vgui::Panel *parent, const char *name ) : vgui::EditablePanel( parent, name )
+ {
+ m_pAvatar = new CAvatarImagePanel( this, "avatar" );
+ m_pButton = new CExButton( this, "button", "", parent );
+ }
+ ~CSelectPlayerTargetPanel( void )
+ {
+ m_pAvatar->MarkForDeletion();
+ m_pButton->MarkForDeletion();
+ }
+
+ void SetInfo( const CSteamID &steamID, const char *pszName );
+
+ CAvatarImagePanel *GetAvatar( void ) { return m_pAvatar; }
+ CExButton *GetButton( void ) { return m_pButton; }
+
+private:
+ // Embedded panels
+ CAvatarImagePanel *m_pAvatar;
+ CExButton *m_pButton;
+};
+
+//-----------------------------------------------------------------------------
+// A dialog that allows users to select who they want to do something with
+//-----------------------------------------------------------------------------
+class CSelectPlayerDialog : public vgui::EditablePanel
+{
+ DECLARE_CLASS_SIMPLE( CSelectPlayerDialog, vgui::EditablePanel );
+public:
+ CSelectPlayerDialog( vgui::Panel *parent );
+ ~CSelectPlayerDialog( void );
+
+ virtual void ApplySettings( KeyValues *inResourceData );
+ virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
+ virtual void PerformLayout( void );
+ virtual void OnCommand( const char *command );
+
+ void UpdateState( void );
+ virtual void UpdatePlayerList( void );
+ virtual void Reset( void );
+ virtual void SetupSelectFriends( void );
+ virtual void SetupSelectServer( bool bFriendsOnly );
+
+ virtual bool AllowOutOfGameFriends() { return false; }
+
+ virtual void OnSelectPlayer( const CSteamID &steamID ) = 0;
+
+protected:
+ virtual const char *GetResFile() { return "resource/ui/SelectPlayerDialog.res"; }
+
+ struct partner_info_t
+ {
+ CSteamID m_steamID;
+ CUtlString m_name;
+ };
+
+ static int SortPartnerInfoFunc( const partner_info_t *pA, const partner_info_t *pB );
+
+ vgui::EditablePanel *m_pStatePanels[SPDS_NUM_STATES];
+ int m_iCurrentState;
+ CExButton *m_pSelectFromServerButton;
+ CExButton *m_pCancelButton;
+
+ vgui::EditablePanel *m_pPlayerList;
+ vgui::ScrollableEditablePanel *m_pPlayerListScroller;
+ CUtlVector<partner_info_t> m_PlayerInfoList;
+ CUtlVector<CSelectPlayerTargetPanel*> m_pPlayerPanels;
+ KeyValues *m_pButtonKV;
+ bool m_bReapplyButtonKVs;
+ bool m_bAllowSameTeam;
+ bool m_bAllowOutsideServer;
+};
+
+#endif // SELECT_PLAYER_DIALOG_H