nim_duilib/examples/proto_debuger/tcp_server_form.h

58 lines
1.3 KiB
C
Raw Normal View History

2021-12-30 17:27:33 +08:00
#pragma once
// base header
#include "base/base.h"
#include "serial_port.h"
// duilib
#include "duilib/UIlib.h"
#include "tcp_server_libevent.h"
2022-01-11 01:07:59 +08:00
#include <map>
#include "lua_wraper.h"
2022-01-25 23:45:07 +08:00
#include "global.h"
2022-01-27 00:42:33 +08:00
#include <fstream>
2021-12-30 17:27:33 +08:00
class TcpServerFrom :
2022-01-25 23:45:07 +08:00
public ui::ChildBox,
LuaBindInterface
2021-12-30 17:27:33 +08:00
{
public:
TcpServerFrom(ui::Window* hwnd, string url, uint32_t port, TcpServerLibevent* p);
2022-02-03 00:22:01 +08:00
~TcpServerFrom();
2021-12-30 17:27:33 +08:00
TcpServerLibevent* ServerP();
virtual void Init() override;
2022-01-08 00:23:09 +08:00
void OnNewConnAccept(ConnectionLibevent*);
2022-01-06 00:31:24 +08:00
void OnDisConnected(ConnectionLibevent*);
2022-01-25 23:45:07 +08:00
LuaDelegate* LuaVM();
2022-01-31 01:00:02 +08:00
std::map<uint32_t, ConnectionLibevent*> mClients;
2022-01-27 00:42:33 +08:00
2022-01-06 00:31:24 +08:00
protected:
2022-01-25 23:45:07 +08:00
void ShowDataInEdit(const char*) override;
2021-12-30 17:27:33 +08:00
private:
2022-01-08 00:23:09 +08:00
void updateStatus();
2021-12-30 17:27:33 +08:00
TcpServerLibevent* m_server;
2021-12-31 01:12:11 +08:00
std::string m_url;
uint32_t m_port;
2021-12-30 17:27:33 +08:00
ui::Label* m_label_1;
ui::RichEdit* m_rich_edit_1;
2022-01-27 00:42:33 +08:00
ui::RichEdit* mEditLua;
2021-12-30 17:27:33 +08:00
ui::RichEdit* m_rich_edit_3;
ui::Button* m_button_1;
ui::CheckBox* m_check_box_1;
ui::CheckBox* m_check_box_2;
ui::RichEdit* m_rich_edit_4;
ui::CheckBox* m_check_box_3;
ui::CheckBox* m_check_box_4;
ui::Button* m_button_2;
2022-01-31 01:00:02 +08:00
ui::Button* m_btn_save_lua;
2021-12-30 17:27:33 +08:00
ui::Label* m_label_2;
ui::Combo* m_combo_1;
ui::Button* m_button_3;
2022-02-03 00:22:01 +08:00
std::ifstream mLuaFileRead;
std::ofstream mLuaFileEdit;
2022-01-11 01:07:59 +08:00
bool mFlagSelectClient;
LuaDelegate *mLua;
2022-01-27 00:42:33 +08:00
std::string mLuaScript;
2021-12-30 17:27:33 +08:00
};