event.h
来自「A*算法 A*算法 A*算法 A*算法A*算法A*算法」· C头文件 代码 · 共 2,127 行 · 第 1/5 页
H
2,127 行
};
// wxChildFocusEvent notifies the parent that a child has got the focus: unlike
// wxFocusEvent it is propagated upwards the window chain
class WXDLLIMPEXP_CORE wxChildFocusEvent : public wxCommandEvent
{
public:
wxChildFocusEvent(wxWindow *win = NULL);
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
virtual wxEvent *Clone() const { return new wxChildFocusEvent(*this); }
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChildFocusEvent)
};
// Activate event class
/*
wxEVT_ACTIVATE
wxEVT_ACTIVATE_APP
wxEVT_HIBERNATE
*/
class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent
{
public:
wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true, int Id = 0)
: wxEvent(Id, type)
{ m_active = active; }
wxActivateEvent(const wxActivateEvent& event)
: wxEvent(event)
{ m_active = event.m_active; }
bool GetActive() const { return m_active; }
virtual wxEvent *Clone() const { return new wxActivateEvent(*this); }
private:
bool m_active;
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxActivateEvent)
};
// InitDialog event class
/*
wxEVT_INIT_DIALOG
*/
class WXDLLIMPEXP_CORE wxInitDialogEvent : public wxEvent
{
public:
wxInitDialogEvent(int Id = 0)
: wxEvent(Id, wxEVT_INIT_DIALOG)
{ }
virtual wxEvent *Clone() const { return new wxInitDialogEvent(*this); }
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxInitDialogEvent)
};
// Miscellaneous menu event class
/*
wxEVT_MENU_OPEN,
wxEVT_MENU_CLOSE,
wxEVT_MENU_HIGHLIGHT,
*/
class WXDLLIMPEXP_CORE wxMenuEvent : public wxEvent
{
public:
wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL)
: wxEvent(winid, type)
{ m_menuId = winid; m_menu = menu; }
wxMenuEvent(const wxMenuEvent & event)
: wxEvent(event)
{ m_menuId = event.m_menuId; m_menu = event.m_menu; }
// only for wxEVT_MENU_HIGHLIGHT
int GetMenuId() const { return m_menuId; }
// only for wxEVT_MENU_OPEN/CLOSE
bool IsPopup() const { return m_menuId == wxID_ANY; }
// only for wxEVT_MENU_OPEN/CLOSE
wxMenu* GetMenu() const { return m_menu; }
virtual wxEvent *Clone() const { return new wxMenuEvent(*this); }
private:
int m_menuId;
wxMenu* m_menu;
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMenuEvent)
};
// Window close or session close event class
/*
wxEVT_CLOSE_WINDOW,
wxEVT_END_SESSION,
wxEVT_QUERY_END_SESSION
*/
class WXDLLIMPEXP_CORE wxCloseEvent : public wxEvent
{
public:
wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0)
: wxEvent(winid, type),
m_loggingOff(true),
m_veto(false), // should be false by default
m_canVeto(true) {}
wxCloseEvent(const wxCloseEvent & event)
: wxEvent(event),
m_loggingOff(event.m_loggingOff),
m_veto(event.m_veto),
m_canVeto(event.m_canVeto) {}
void SetLoggingOff(bool logOff) { m_loggingOff = logOff; }
bool GetLoggingOff() const
{
// m_loggingOff flag is only used by wxEVT_[QUERY_]END_SESSION, it
// doesn't make sense for wxEVT_CLOSE_WINDOW
wxASSERT_MSG( m_eventType != wxEVT_CLOSE_WINDOW,
_T("this flag is for end session events only") );
return m_loggingOff;
}
void Veto(bool veto = true)
{
// GetVeto() will return false anyhow...
wxCHECK_RET( m_canVeto,
wxT("call to Veto() ignored (can't veto this event)") );
m_veto = veto;
}
void SetCanVeto(bool canVeto) { m_canVeto = canVeto; }
bool CanVeto() const { return m_canVeto; }
bool GetVeto() const { return m_canVeto && m_veto; }
virtual wxEvent *Clone() const { return new wxCloseEvent(*this); }
protected:
bool m_loggingOff,
m_veto,
m_canVeto;
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCloseEvent)
};
/*
wxEVT_SHOW
*/
class WXDLLIMPEXP_CORE wxShowEvent : public wxEvent
{
public:
wxShowEvent(int winid = 0, bool show = false)
: wxEvent(winid, wxEVT_SHOW)
{ m_show = show; }
wxShowEvent(const wxShowEvent & event)
: wxEvent(event)
{ m_show = event.m_show; }
void SetShow(bool show) { m_show = show; }
bool GetShow() const { return m_show; }
virtual wxEvent *Clone() const { return new wxShowEvent(*this); }
protected:
bool m_show;
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxShowEvent)
};
/*
wxEVT_ICONIZE
*/
class WXDLLIMPEXP_CORE wxIconizeEvent : public wxEvent
{
public:
wxIconizeEvent(int winid = 0, bool iconized = true)
: wxEvent(winid, wxEVT_ICONIZE)
{ m_iconized = iconized; }
wxIconizeEvent(const wxIconizeEvent & event)
: wxEvent(event)
{ m_iconized = event.m_iconized; }
// return true if the frame was iconized, false if restored
bool Iconized() const { return m_iconized; }
virtual wxEvent *Clone() const { return new wxIconizeEvent(*this); }
protected:
bool m_iconized;
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIconizeEvent)
};
/*
wxEVT_MAXIMIZE
*/
class WXDLLIMPEXP_CORE wxMaximizeEvent : public wxEvent
{
public:
wxMaximizeEvent(int winid = 0)
: wxEvent(winid, wxEVT_MAXIMIZE)
{ }
virtual wxEvent *Clone() const { return new wxMaximizeEvent(*this); }
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMaximizeEvent)
};
// Joystick event class
/*
wxEVT_JOY_BUTTON_DOWN,
wxEVT_JOY_BUTTON_UP,
wxEVT_JOY_MOVE,
wxEVT_JOY_ZMOVE
*/
// Which joystick? Same as Windows ids so no conversion necessary.
enum
{
wxJOYSTICK1,
wxJOYSTICK2
};
// Which button is down?
enum
{
wxJOY_BUTTON_ANY = -1,
wxJOY_BUTTON1 = 1,
wxJOY_BUTTON2 = 2,
wxJOY_BUTTON3 = 4,
wxJOY_BUTTON4 = 8
};
class WXDLLIMPEXP_CORE wxJoystickEvent : public wxEvent
{
#if WXWIN_COMPATIBILITY_2_4
public:
#else
protected:
#endif
wxPoint m_pos;
int m_zPosition;
int m_buttonChange; // Which button changed?
int m_buttonState; // Which buttons are down?
int m_joyStick; // Which joystick?
public:
wxJoystickEvent(wxEventType type = wxEVT_NULL,
int state = 0,
int joystick = wxJOYSTICK1,
int change = 0)
: wxEvent(0, type),
m_pos(),
m_zPosition(0),
m_buttonChange(change),
m_buttonState(state),
m_joyStick(joystick)
{
}
wxJoystickEvent(const wxJoystickEvent & event)
: wxEvent(event),
m_pos(event.m_pos),
m_zPosition(event.m_zPosition),
m_buttonChange(event.m_buttonChange),
m_buttonState(event.m_buttonState),
m_joyStick(event.m_joyStick)
{ }
wxPoint GetPosition() const { return m_pos; }
int GetZPosition() const { return m_zPosition; }
int GetButtonState() const { return m_buttonState; }
int GetButtonChange() const { return m_buttonChange; }
int GetJoystick() const { return m_joyStick; }
void SetJoystick(int stick) { m_joyStick = stick; }
void SetButtonState(int state) { m_buttonState = state; }
void SetButtonChange(int change) { m_buttonChange = change; }
void SetPosition(const wxPoint& pos) { m_pos = pos; }
void SetZPosition(int zPos) { m_zPosition = zPos; }
// Was it a button event? (*doesn't* mean: is any button *down*?)
bool IsButton() const { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) ||
(GetEventType() == wxEVT_JOY_BUTTON_UP)); }
// Was it a move event?
bool IsMove() const { return (GetEventType() == wxEVT_JOY_MOVE); }
// Was it a zmove event?
bool IsZMove() const { return (GetEventType() == wxEVT_JOY_ZMOVE); }
// Was it a down event from button 1, 2, 3, 4 or any?
bool ButtonDown(int but = wxJOY_BUTTON_ANY) const
{ return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) &&
((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
// Was it a up event from button 1, 2, 3 or any?
bool ButtonUp(int but = wxJOY_BUTTON_ANY) const
{ return ((GetEventType() == wxEVT_JOY_BUTTON_UP) &&
((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
// Was the given button 1,2,3,4 or any in Down state?
bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const
{ return (((but == wxJOY_BUTTON_ANY) && (m_buttonState != 0)) ||
((m_buttonState & but) == but)); }
virtual wxEvent *Clone() const { return new wxJoystickEvent(*this); }
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxJoystickEvent)
};
// Drop files event class
/*
wxEVT_DROP_FILES
*/
class WXDLLIMPEXP_CORE wxDropFilesEvent : public wxEvent
{
public:
int m_noFiles;
wxPoint m_pos;
wxString* m_files;
wxDropFilesEvent(wxEventType type = wxEVT_NULL,
int noFiles = 0,
wxString *files = (wxString *) NULL)
: wxEvent(0, type),
m_noFiles(noFiles),
m_pos(),
m_files(files)
{ }
// we need a copy ctor to avoid deleting m_files pointer twice
wxDropFilesEvent(const wxDropFilesEvent& other)
: wxEvent(other),
m_noFiles(other.m_noFiles),
m_pos(other.m_pos),
m_files(NULL)
{
m_files = new wxString[m_noFiles];
for ( int n = 0; n < m_noFiles; n++ )
{
m_files[n] = other.m_files[n];
}
}
virtual ~wxDropFilesEvent()
{
delete [] m_files;
}
wxPoint GetPosition() const { return m_pos; }
int GetNumberOfFiles() const { return m_noFiles; }
wxString *GetFiles() const { return m_files; }
virtual wxEvent *Clone() const { return new wxDropFilesEvent(*this); }
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDropFilesEvent)
};
// Update UI event
/*
wxEVT_UPDATE_UI
*/
// Whether to always send update events to windows, or
// to only send update events to those with the
// wxWS_EX_PROCESS_UI_UPDATES style.
enum wxUpdateUIMode
{
// Send UI update events to all windows
wxUPDATE_UI_PROCESS_ALL,
// Send UI update events to windows that have
// the wxWS_EX_PROCESS_UI_UPDATES flag specified
wxUPDATE_UI_PROCESS_SPECIFIED
};
class WXDLLIMPEXP_CORE wxUpdateUIEvent : public wxCommandEvent
{
public:
wxUpdateUIEvent(wxWindowID commandId = 0)
: wxCommandEvent(wxEVT_UPDATE_UI, commandId)
{
m_checked =
m_enabled =
m_setEnabled =
m_setText =
m_setChecked = false;
}
wxUpdateUIEvent(const wxUpdateUIEvent & event)
: wxCommandEvent(event),
m_checked(event.m_checked),
m_enabled(event.m_enabled),
m_setEnabled(event.m_setEnabled),
m_setText(event.m_setText),
m_setChecked(event.m_setChecked),
m_text(event.m_text)
{ }
bool GetChecked() const { return m_checked; }
bool GetEnabled() const { return m_enabled; }
wxString GetText() const { return m_text; }
bool GetSetText() const { return m_setText; }
bool GetSetChecked() const { return m_setChecked; }
bool GetSetEnabled() const { return m_setEnabled; }
void Check(bool check) { m_checked = check; m_setChecked = true; }
void Enable(bool enable) { m_enabled = enable; m_setEnabled = true; }
void SetText(const wxString& text) { m_text = text; m_setText = true; }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?