Debian Codegraph @

plugins/dm.conversation/CommandEditor.h

raw
1 #pragma once
2
3 #include "wxutil/dataview/TreeModel.h"
4 #include "wxutil/dialog/DialogBase.h"
5 #include "wxutil/XmlResourceBasedWidget.h"
6
7 #include "Conversation.h"
8 #include "ConversationCommand.h"
9 #include "ConversationCommandLibrary.h"
10 #include "CommandArgumentItem.h"
11
12 namespace ui
13 {
14
15 class CommandEditor :
16 public wxutil::DialogBase,
17 private wxutil::XmlResourceBasedWidget
18 {
19 private:
20 // The conversation (read-only)
21 const conversation::Conversation& _conversation;
22
23 // The command we're editing (working copy)
24 conversation::ConversationCommand _command;
25
26 // The actual command we're saving to on "OK"
27 conversation::ConversationCommand& _targetCommand;
28
29 typedef std::vector<CommandArgumentItemPtr> ArgumentItemList;
30 ArgumentItemList _argumentItems;
31
32 public:
33 // Pass the parent window, the command and the conversation to edit
34 CommandEditor(wxWindow* parent, conversation::ConversationCommand& command, const conversation::Conversation& conv);
35
36 // The Command we're working on (working copy)
37 conversation::ConversationCommand& getCommand();
38
39 // Return the conversation we're defined on
40 const conversation::Conversation& getConversation();
41
42 private:
43 void populateWindow();
44 void updateWidgets();
45
46 void save();
47
48 void commandTypeChanged();
49
50 void createArgumentWidgets(int commandTypeID);
51
52 void updateWaitUntilFinished(int commandTypeID);
53
54 void onSave(wxCommandEvent& ev);
55 void onCancel(wxCommandEvent& ev);
56
57 void onCommandTypeChange(wxCommandEvent& ev);
58
59 CommandArgumentItemPtr createCommandArgumentItem(const conversation::ArgumentInfo& argInfo, wxWindow* parent);
60 };
61
62 } // namespace ui