Debian Codegraph @

plugins/dm.conversation/ConversationDialog.h

raw
1 #pragma once
2
3 #include <map>
4
5 #include "ientity.h"
6 #include "icommandsystem.h"
7 #include "iradiant.h"
8 #include "wxutil/dialog/DialogBase.h"
9 #include "wxutil/XmlResourceBasedWidget.h"
10 #include "wxutil/dataview/TreeView.h"
11
12 #include "ConversationEntity.h"
13
14 namespace ui
15 {
16
17 class ConversationDialog;
18 typedef std::shared_ptr<ConversationDialog> ConversationDialogPtr;
19
20 /**
21 * greebo: The conversation dialog is a modal top-level window providing
22 * views and controls to facilitate the setup of inter-AI conversations.
23 */
24 class ConversationDialog :
25 public wxutil::DialogBase,
26 private wxutil::XmlResourceBasedWidget
27 {
28 private:
29 // List of conversation_info entities
30 conversation::ConvEntityColumns _convEntityColumns;
31 wxutil::TreeModel::Ptr _entityList;
32 wxutil::TreeView* _entityView;
33
34 // List of conversations on the selected entity
35 conversation::ConversationColumns _convColumns;
36 wxutil::TreeModel::Ptr _convList;
37 wxutil::TreeView* _convView;
38
39 // Map of ConversationEntity objects, indexed by the name of the world entity
40 conversation::ConversationEntityMap _entities;
41
42 // Iterators for current entity and current objective
43 conversation::ConversationEntityMap::iterator _curEntity;
44 wxDataViewItem _currentConversation;
45
46 wxButton* _addConvButton;
47 wxButton* _editConvButton;
48 wxButton* _deleteConvButton;
49 wxButton* _moveUpConvButton;
50 wxButton* _moveDownConvButton;
51 wxButton* _clearConvButton;
52
53 wxButton* _addEntityButton;
54 wxButton* _deleteEntityButton;
55
56 public:
57 ConversationDialog();
58
59 // Command target to toggle the dialog
60 static void ShowDialog(const cmd::ArgumentList& args);
61
62 // Override DialogBase
63 virtual int ShowModal();
64
65 private:
66 // greebo: Saves the current working set to the entity
67 void save();
68
69 // Clears out all stored data
70 void clear();
71
72 void populateWidgets();
73
74 // Re-loads the conversation from the selected entity
75 void refreshConversationList();
76 void updateConversationPanelSensitivity();
77 void handleConversationSelectionChange();
78
79 // WIDGET POPULATION
80 void populateWindow();
81
82 // Button callbacks
83 void onOK(wxCommandEvent& ev);
84 void onCancel(wxCommandEvent& ev);
85
86 void onEntitySelectionChanged(wxDataViewEvent& ev);
87 void onAddEntity(wxCommandEvent& ev);
88 void onDeleteEntity(wxCommandEvent& ev);
89
90 void onConversationSelectionChanged(wxDataViewEvent& ev);
91 void onAddConversation(wxCommandEvent& ev);
92 void onEditConversation(wxCommandEvent& ev);
93 void onDeleteConversation(wxCommandEvent& ev);
94 void onMoveConversationUpOrDown(wxCommandEvent& ev);
95 void onClearConversations(wxCommandEvent& ev);
96
97 void editSelectedConversation();
98 int getSelectedConvIndex();
99 void selectConvByIndex(int index);
100 };
101
102 } // namespace ui