ENH:allows the user to enter a printed IP address

Change-Id: I9d2617d0dd42f53e93d61e98bcf3cc97979a93f6
(cherry picked from commit 24ab56f8568e9637634e97a0632309cfd2762749)
This commit is contained in:
tao wang 2022-12-28 19:01:16 +08:00 committed by Lane.Wei
parent c8df45c11f
commit 47a46010bd
9 changed files with 253 additions and 10 deletions

View file

@ -3,7 +3,6 @@
#include <string>
#include <unordered_map>
#include "GUI_Utils.hpp"
#include <wx/dialog.h>
#include <wx/font.h>
@ -14,6 +13,7 @@
#include <wx/statline.h>
#include "Widgets/Button.hpp"
#include "Widgets/CheckBox.hpp"
#include "Widgets/TextInput.hpp"
#include "BBLStatusBar.hpp"
#include "BBLStatusBarSend.hpp"
@ -92,7 +92,7 @@ protected:
MsgButtonsHash m_buttons;
CheckBox* m_checkbox_dsa{nullptr};
};
wxDECLARE_EVENT(EVT_CHECKBOX_CHANGE, wxCommandEvent);
// Generic error dialog, used for displaying exceptions
class ErrorDialog : public MsgDialog
@ -371,6 +371,28 @@ private:
wxString msg;
};
class InputIpAddressDialog: public DPIDialog
{
public:
wxString comfirm_before_enter_text;
wxString comfirm_after_enter_text;
std::string m_ip;
Label* tip{nullptr};
InputIpAddressDialog(wxWindow* parent = nullptr, wxString name = wxEmptyString);
~InputIpAddressDialog();
Button* m_button_ok{nullptr};
TextInput* m_input_ip{nullptr};
bool isIp(std::string ipstr);
void on_ok(wxMouseEvent& evt);
void on_text(wxCommandEvent& evt);
void on_dpi_changed(const wxRect& suggested_rect) override;
};
wxDECLARE_EVENT(EVT_CHECKBOX_CHANGE, wxCommandEvent);
wxDECLARE_EVENT(EVT_ENTER_IP_ADDRESS, wxCommandEvent);
}
}