1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-31 11:15:32 +00:00
openmw-tes3mp/apps/openmw/mwmp/GUI/GUIChat.hpp
David Cernat b6a7377692 Merge pull request #366 from TES3MP/0.6.2 while resolving conflicts, 2nd try
Conflicts:
	apps/openmw-mp/Networking.cpp
	apps/openmw-mp/Script/Functions/Miscellaneous.cpp
	apps/openmw-mp/Script/Functions/Miscellaneous.hpp
	apps/openmw/mwmp/GUI/GUIChat.cpp
2018-01-05 21:24:14 +02:00

121 lines
3.2 KiB
C++

//
// Created by koncord on 04.03.16.
//
#ifndef OPENMW_GUICHAT_HPP
#define OPENMW_GUICHAT_HPP
#include <list>
#include <string>
#include <vector>
#include <unordered_map>
#include <components/widgets/box.hpp>
#include "apps/openmw/mwgui/windowbase.hpp"
namespace mwmp
{
class GUIController;
class GUIChat : public MWGui::WindowBase
{
friend class GUIController;
public:
enum
{
CHAT_DISABLED = 0,
CHAT_ENABLED,
CHAT_HIDDENMODE
} CHAT_WIN_STATE;
MyGUI::EditBox* mCommandLine;
MyGUI::EditBox* mHistory;
MyGUI::Button* mChannelBtns[3];
MyGUI::Button* mChannelNextBtn;
MyGUI::Button* mChannelPrevBtn;
Gui::HBox* mBoxChannels;
typedef std::list<std::string> StringList;
// History of previous entered commands
StringList mCommandHistory;
StringList::iterator mCurrent;
std::string mEditString;
GUIChat(int x, int y, int w, int h);
void pressedChatMode(); //switch chat mode
void pressedSay(); // switch chat focus (if chat mode != CHAT_DISABLED)
void setDelay(float delay);
void update(float dt);
void setCaption(const std::string &str);
virtual void onOpen();
virtual void onClose();
virtual bool exit();
/*virtual void open();
virtual void close();*/
void setFont(const std::string &fntName);
void onResChange(int width, int height);
// Print a message to the console, in specified color.
void print(unsigned channelId, const std::string &msg, const std::string& color = "#FFFFFF");
// Clean chat
void clean(unsigned channelId);
void send(const std::string &str);
void switchNetstat();
void addChannel(unsigned ch, const std::string &name);
void setChannel(const std::string &newName, bool saveHistory = true);
void renameChannel(unsigned ch, const std::string &channel);
void setChannel(unsigned ch, bool saveHistory = true);
void closeChannel(unsigned ch);
void redrawChannels();
unsigned lastPage();
void nextChannel(MyGUI::Widget* _sender);
void prevChannel(MyGUI::Widget* _sender);
void onClickChannel(MyGUI::Widget* _sender);
protected:
private:
void keyPress(MyGUI::Widget* _sender,
MyGUI::KeyCode key,
MyGUI::Char _char);
void acceptCommand(MyGUI::EditBox* _sender);
void setEditState(bool state);
int windowState;
bool editState;
bool netStat;
float delay;
float curTime;
struct ChannelData
{
unsigned channel;
std::string channelName;
MyGUI::UString channelText;
bool newMessages;
};
std::vector<ChannelData> channels;
unsigned currentChannel;
unsigned page;
const int pageM = 3;
typedef std::vector<ChannelData>::iterator ChannelIter;
void setChannel(ChannelIter iter, bool saveHistory);
ChannelIter getChannel(unsigned ch);
MyGUI::Colour defaultColor;
};
}
#endif //OPENMW_GUICHAT_HPP