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 102
|
#pragma once
#include <map>
#include "ientity.h"
#include "icommandsystem.h"
#include "iradiant.h"
#include "wxutil/dialog/DialogBase.h"
#include "wxutil/XmlResourceBasedWidget.h"
#include "wxutil/dataview/TreeView.h"
#include "ConversationEntity.h"
namespace ui
{
class ConversationDialog;
typedef std::shared_ptr<ConversationDialog> ConversationDialogPtr;
/**
* greebo: The conversation dialog is a modal top-level window providing
* views and controls to facilitate the setup of inter-AI conversations.
*/
class ConversationDialog :
public wxutil::DialogBase,
private wxutil::XmlResourceBasedWidget
{
private:
// List of conversation_info entities
conversation::ConvEntityColumns _convEntityColumns;
wxutil::TreeModel::Ptr _entityList;
wxutil::TreeView* _entityView;
// List of conversations on the selected entity
conversation::ConversationColumns _convColumns;
wxutil::TreeModel::Ptr _convList;
wxutil::TreeView* _convView;
// Map of ConversationEntity objects, indexed by the name of the world entity
conversation::ConversationEntityMap _entities;
// Iterators for current entity and current objective
conversation::ConversationEntityMap::iterator _curEntity;
wxDataViewItem _currentConversation;
wxButton* _addConvButton;
wxButton* _editConvButton;
wxButton* _deleteConvButton;
wxButton* _moveUpConvButton;
wxButton* _moveDownConvButton;
wxButton* _clearConvButton;
wxButton* _addEntityButton;
wxButton* _deleteEntityButton;
public:
ConversationDialog();
// Command target to toggle the dialog
static void ShowDialog(const cmd::ArgumentList& args);
// Override DialogBase
virtual int ShowModal();
private:
// greebo: Saves the current working set to the entity
void save();
// Clears out all stored data
void clear();
void populateWidgets();
// Re-loads the conversation from the selected entity
void refreshConversationList();
void updateConversationPanelSensitivity();
void handleConversationSelectionChange();
// WIDGET POPULATION
void populateWindow();
// Button callbacks
void onOK(wxCommandEvent& ev);
void onCancel(wxCommandEvent& ev);
void onEntitySelectionChanged(wxDataViewEvent& ev);
void onAddEntity(wxCommandEvent& ev);
void onDeleteEntity(wxCommandEvent& ev);
void onConversationSelectionChanged(wxDataViewEvent& ev);
void onAddConversation(wxCommandEvent& ev);
void onEditConversation(wxCommandEvent& ev);
void onDeleteConversation(wxCommandEvent& ev);
void onMoveConversationUpOrDown(wxCommandEvent& ev);
void onClearConversations(wxCommandEvent& ev);
void editSelectedConversation();
int getSelectedConvIndex();
void selectConvByIndex(int index);
};
} // namespace ui
|