blob: 92b2818bd3e0d5c8ceb3d8f895d22bc3faba8395 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//===========================================================================//
#ifndef OPTIONS_SUB_KEYBOARD_H
#define OPTIONS_SUB_KEYBOARD_H
#ifdef _WIN32
#pragma once
#endif
#include "utlvector.h"
#include "utlsymbol.h"
#include <vgui_controls/PropertyPage.h>
class VControlsListPanel;
//-----------------------------------------------------------------------------
// Purpose: Keyboard Details, Part of OptionsDialog
//-----------------------------------------------------------------------------
class COptionsSubKeyboard : public vgui::PropertyPage
{
DECLARE_CLASS_SIMPLE( COptionsSubKeyboard, vgui::PropertyPage );
public:
COptionsSubKeyboard(vgui::Panel *parent);
~COptionsSubKeyboard();
virtual void OnResetData();
virtual void OnApplyChanges();
virtual void OnKeyCodePressed( vgui::KeyCode code );
virtual void OnThink();
// Trap row selection message
MESSAGE_FUNC_INT( ItemSelected, "ItemSelected", itemID );
private:
void Finish( ButtonCode_t code );
//-----------------------------------------------------------------------------
// Purpose: Used for saving engine keybindings in case user hits cancel button
//-----------------------------------------------------------------------------
struct KeyBinding
{
char *binding;
};
// Create the key binding list control
void CreateKeyBindingList( void );
virtual void OnCommand( const char *command );
// Tell engine to bind/unbind a key
void BindKey( const char *key, const char *binding );
void UnbindKey( const char *key );
// Save/restore/cleanup engine's current bindings ( for handling cancel button )
void SaveCurrentBindings( void );
void DeleteSavedBindings( void );
// Get column 0 action descriptions for all keys
void ParseActionDescriptions( void );
// Populate list of actions with current engine keybindings
void FillInCurrentBindings( void );
// Remove all current bindings from list of bindings
void ClearBindItems( void );
// Fill in bindings with mod-specified defaults
void FillInDefaultBindings( void );
// Copy bindings out of list and set them in the engine
void ApplyAllBindings( void );
// Bind a key to the item
void AddBinding( KeyValues *item, const char *keyname );
// Remove all instances of a key from all bindings
void RemoveKeyFromBindItems( KeyValues *org_item, const char *key );
// Find item by binding name
KeyValues *GetItemForBinding( const char *binding );
private:
void OpenKeyboardAdvancedDialog();
vgui::DHANDLE<class COptionsSubKeyboardAdvancedDlg> m_OptionsSubKeyboardAdvancedDlg;
virtual void OnKeyCodeTyped(vgui::KeyCode code);
VControlsListPanel *m_pKeyBindList;
vgui::Button *m_pSetBindingButton;
vgui::Button *m_pClearBindingButton;
// List of saved bindings for the keys
KeyBinding m_Bindings[ BUTTON_CODE_LAST ];
// List of all the keys that need to have their binding removed
CUtlVector<CUtlSymbol> m_KeysToUnbind;
};
#endif // OPTIONS_SUB_KEYBOARD_H
|