📄 event.h
字号:
bool m_loggingOff;
bool m_veto, m_canVeto;
#if WXWIN_COMPATIBILITY
bool m_force;
#endif
private:
DECLARE_DYNAMIC_CLASS(wxCloseEvent)
};
/*
wxEVT_SHOW
*/
class WXDLLEXPORT wxShowEvent : public wxEvent
{
public:
wxShowEvent(int id = 0, bool show = FALSE)
: wxEvent(id, 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(wxShowEvent)
};
/*
wxEVT_ICONIZE
*/
class WXDLLEXPORT wxIconizeEvent : public wxEvent
{
public:
wxIconizeEvent(int id = 0, bool iconized = TRUE)
: wxEvent(id, 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(wxIconizeEvent)
};
/*
wxEVT_MAXIMIZE
*/
class WXDLLEXPORT wxMaximizeEvent : public wxEvent
{
public:
wxMaximizeEvent(int id = 0)
: wxEvent(id, wxEVT_MAXIMIZE)
{ }
virtual wxEvent *Clone() const { return new wxMaximizeEvent(*this); }
private:
DECLARE_DYNAMIC_CLASS(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 WXDLLEXPORT wxJoystickEvent : public wxEvent
{
public:
wxPoint m_pos;
int m_zPosition;
int m_buttonChange; // Which button changed?
int m_buttonState; // Which buttons are down?
int m_joyStick; // Which joystick?
wxJoystickEvent(wxEventType type = wxEVT_NULL,
int state = 0,
int joystick = wxJOYSTICK1,
int change = 0)
: wxEvent(0, type),
m_pos(0, 0),
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(wxJoystickEvent)
};
#ifdef __BORLANDC__
# pragma option -w-inl
#endif
// Drop files event class
/*
wxEVT_DROP_FILES
*/
class WXDLLEXPORT wxDropFilesEvent : public wxEvent
{
private:
wxDropFilesEvent& operator=(const wxDropFilesEvent& event);
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(wxDropFilesEvent)
};
#ifdef __BORLANDC__
# pragma option -w.inl
#endif
// Update UI event
/*
wxEVT_UPDATE_UI
*/
class WXDLLEXPORT 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; }
virtual wxEvent *Clone() const { return new wxUpdateUIEvent(*this); }
protected:
bool m_checked;
bool m_enabled;
bool m_setEnabled;
bool m_setText;
bool m_setChecked;
wxString m_text;
private:
DECLARE_DYNAMIC_CLASS(wxUpdateUIEvent)
};
/*
wxEVT_SYS_COLOUR_CHANGED
*/
// TODO: shouldn't all events record the window ID?
class WXDLLEXPORT wxSysColourChangedEvent : public wxEvent
{
public:
wxSysColourChangedEvent()
: wxEvent(0, wxEVT_SYS_COLOUR_CHANGED)
{ }
virtual wxEvent *Clone() const { return new wxSysColourChangedEvent(*this); }
private:
DECLARE_DYNAMIC_CLASS(wxSysColourChangedEvent)
};
/*
wxEVT_MOUSE_CAPTURE_CHANGED
The window losing the capture receives this message
(even if it released the capture itself).
*/
class WXDLLEXPORT wxMouseCaptureChangedEvent : public wxEvent
{
private:
wxMouseCaptureChangedEvent operator=(const wxMouseCaptureChangedEvent& event);
public:
wxMouseCaptureChangedEvent(wxWindowID id = 0, wxWindow* gainedCapture = NULL)
: wxEvent(id, wxEVT_MOUSE_CAPTURE_CHANGED),
m_gainedCapture(gainedCapture)
{ }
wxMouseCaptureChangedEvent(const wxMouseCaptureChangedEvent& event)
: wxEvent(event),
m_gainedCapture(event.m_gainedCapture)
{ }
virtual wxEvent *Clone() const { return new wxMouseCaptureChangedEvent(*this); }
wxWindow* GetCapturedWindow() const { return m_gainedCapture; };
private:
wxWindow* m_gainedCapture;
DECLARE_DYNAMIC_CLASS(wxMouseCaptureChangedEvent)
};
/*
wxEVT_DISPLAY_CHANGED
*/
class WXDLLEXPORT wxDisplayChangedEvent : public wxEvent
{
private:
DECLARE_DYNAMIC_CLASS(wxDisplayChangedEvent)
public:
wxDisplayChangedEvent()
: wxEvent(0, wxEVT_DISPLAY_CHANGED)
{ }
virtual wxEvent *Clone() const { return new wxDisplayChangedEvent(*this); }
};
/*
wxEVT_PALETTE_CHANGED
*/
class WXDLLEXPORT wxPaletteChangedEvent : public wxEvent
{
private:
wxPaletteChangedEvent& operator=(const wxPaletteChangedEvent& event);
public:
wxPaletteChangedEvent(wxWindowID id = 0)
: wxEvent(id, wxEVT_PALETTE_CHANGED),
m_changedWindow((wxWindow *) NULL)
{ }
wxPaletteChangedEvent(const wxPaletteChangedEvent& event)
: wxEvent(event),
m_changedWindow(event.m_changedWindow)
{ }
void SetChangedWindow(wxWindow* win) { m_changedWindow = win; }
wxWindow* GetChangedWindow() const { return m_changedWindow; }
virtual wxEvent *Clone() const { return new wxPaletteChangedEvent(*this); }
protected:
wxWindow* m_changedWindow;
private:
DECLARE_DYNAMIC_CLASS(wxPaletteChangedEvent)
};
/*
wxEVT_QUERY_NEW_PALETTE
Indicates the window is getting keyboard focus and should re-do its palette.
*/
class WXDLLEXPORT wxQueryNewPaletteEvent : public wxEvent
{
public:
wxQueryNewPaletteEvent(wxWindowID id = 0)
: wxEvent(id, wxEVT_QUERY_NEW_PALETTE),
m_paletteRealized(FALSE)
{ }
wxQueryNewPaletteEvent(const wxQueryNewPaletteEvent & event)
: wxEvent(event),
m_paletteRealized(event.m_paletteRealized)
{ }
// App sets this if it changes the palette.
void SetPaletteRealized(bool realized) { m_paletteRealized = realized; }
bool GetPaletteRealized() const { return m_paletteRealized; }
virtual wxEvent *Clone() const { return new wxQueryNewPaletteEvent(*this); }
protected:
bool m_paletteRealized;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -