parent
a27f7f470d
commit
23ba447283
@ -66,7 +66,7 @@
|
|||||||
<event name="OnEnterWindow"></event>
|
<event name="OnEnterWindow"></event>
|
||||||
<event name="OnEraseBackground"></event>
|
<event name="OnEraseBackground"></event>
|
||||||
<event name="OnHibernate"></event>
|
<event name="OnHibernate"></event>
|
||||||
<event name="OnIconize"></event>
|
<event name="OnIconize">OnIconize</event>
|
||||||
<event name="OnIdle">OnIdle</event>
|
<event name="OnIdle">OnIdle</event>
|
||||||
<event name="OnKeyDown"></event>
|
<event name="OnKeyDown"></event>
|
||||||
<event name="OnKeyUp"></event>
|
<event name="OnKeyUp"></event>
|
||||||
|
@ -75,14 +75,25 @@ wxZRColaFrame::wxZRColaFrame() :
|
|||||||
|
|
||||||
// Load main window icons.
|
// Load main window icons.
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
|
wxIcon icon_small(wxT("00_zrcola.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON));
|
||||||
wxIconBundle icons;
|
wxIconBundle icons;
|
||||||
icons.AddIcon(wxIcon(wxT("00_zrcola.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)));
|
icons.AddIcon(icon_small);
|
||||||
icons.AddIcon(wxIcon(wxT("00_zrcola.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXICON ), ::GetSystemMetrics(SM_CYICON )));
|
icons.AddIcon(wxIcon(wxT("00_zrcola.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXICON ), ::GetSystemMetrics(SM_CYICON )));
|
||||||
SetIcons(icons);
|
SetIcons(icons);
|
||||||
#else
|
#else
|
||||||
SetIcon(wxICON(00_zrcola.ico));
|
wxIcon icon_small(wxICON(00_zrcola.ico));
|
||||||
|
SetIcon(icon_small);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
m_taskBarIcon = new wxTaskBarIcon();
|
||||||
|
if (m_taskBarIcon->IsOk()) {
|
||||||
|
m_taskBarIcon->SetIcon(icon_small, _("ZRCola"));
|
||||||
|
m_taskBarIcon->Connect(wxEVT_TASKBAR_LEFT_DOWN, wxTaskBarIconEventHandler(wxZRColaFrame::OnTaskbarIconClick), NULL, this);
|
||||||
|
} else {
|
||||||
|
// Taskbar icon creation failed. Not the end of the world. No taskbar icon then.
|
||||||
|
delete m_taskBarIcon;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Populate language lists.
|
// Populate language lists.
|
||||||
memcpy(m_lang, ZRCOLA_LANG_VOID, sizeof(m_lang));
|
memcpy(m_lang, ZRCOLA_LANG_VOID, sizeof(m_lang));
|
||||||
@ -153,6 +164,11 @@ wxZRColaFrame::~wxZRColaFrame()
|
|||||||
UnregisterHotKey(wxZRColaHKID_INVOKE_DECOMPOSE);
|
UnregisterHotKey(wxZRColaHKID_INVOKE_DECOMPOSE);
|
||||||
UnregisterHotKey(wxZRColaHKID_INVOKE_COMPOSE);
|
UnregisterHotKey(wxZRColaHKID_INVOKE_COMPOSE);
|
||||||
|
|
||||||
|
if (m_taskBarIcon) {
|
||||||
|
m_taskBarIcon->Disconnect(wxEVT_TASKBAR_LEFT_DOWN, wxTaskBarIconEventHandler(wxZRColaFrame::OnTaskbarIconClick), NULL, this);
|
||||||
|
delete m_taskBarIcon;
|
||||||
|
}
|
||||||
|
|
||||||
// Save wxAuiManager's state before return to parent's destructor.
|
// Save wxAuiManager's state before return to parent's destructor.
|
||||||
// Since the later calls m_mgr.UnInit() the regular persistence mechanism is useless to save wxAuiManager's state.
|
// Since the later calls m_mgr.UnInit() the regular persistence mechanism is useless to save wxAuiManager's state.
|
||||||
wxPersistentAuiManager((wxAuiManager*)&m_mgr).Save();
|
wxPersistentAuiManager((wxAuiManager*)&m_mgr).Save();
|
||||||
@ -350,6 +366,25 @@ void wxZRColaFrame::OnIdle(wxIdleEvent& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxZRColaFrame::OnTaskbarIconClick(wxTaskBarIconEvent& event)
|
||||||
|
{
|
||||||
|
Iconize(false);
|
||||||
|
Show(true);
|
||||||
|
Raise();
|
||||||
|
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxZRColaFrame::OnIconize(wxIconizeEvent& event)
|
||||||
|
{
|
||||||
|
if (m_taskBarIcon)
|
||||||
|
Show(!event.IsIconized());
|
||||||
|
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxZRColaFrame::OnToolbarEditUpdate(wxUpdateUIEvent& event)
|
void wxZRColaFrame::OnToolbarEditUpdate(wxUpdateUIEvent& event)
|
||||||
{
|
{
|
||||||
event.Check(m_mgr.GetPane(m_toolbarEdit).IsShown());
|
event.Check(m_mgr.GetPane(m_toolbarEdit).IsShown());
|
||||||
|
@ -27,6 +27,7 @@ class wxZRColaFrame;
|
|||||||
|
|
||||||
#include "zrcolagui.h"
|
#include "zrcolagui.h"
|
||||||
#include <zrcola/language.h>
|
#include <zrcola/language.h>
|
||||||
|
#include <wx/taskbar.h>
|
||||||
#include <wx/persist/toplevel.h>
|
#include <wx/persist/toplevel.h>
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
#include <msctf.h>
|
#include <msctf.h>
|
||||||
@ -79,6 +80,8 @@ protected:
|
|||||||
void OnDecomposedLanguage(wxCommandEvent& event);
|
void OnDecomposedLanguage(wxCommandEvent& event);
|
||||||
virtual void OnDecompLanguageChoice(wxCommandEvent& event);
|
virtual void OnDecompLanguageChoice(wxCommandEvent& event);
|
||||||
virtual void OnIdle(wxIdleEvent& event);
|
virtual void OnIdle(wxIdleEvent& event);
|
||||||
|
void OnTaskbarIconClick(wxTaskBarIconEvent& event);
|
||||||
|
virtual void OnIconize(wxIconizeEvent& event);
|
||||||
void OnToolbarEditUpdate(wxUpdateUIEvent& event);
|
void OnToolbarEditUpdate(wxUpdateUIEvent& event);
|
||||||
void OnToolbarEdit(wxCommandEvent& event);
|
void OnToolbarEdit(wxCommandEvent& event);
|
||||||
void OnToolbarComposeUpdate(wxUpdateUIEvent& event);
|
void OnToolbarComposeUpdate(wxUpdateUIEvent& event);
|
||||||
@ -118,6 +121,7 @@ protected:
|
|||||||
bool m_lang_auto; ///< Automatic language selection according to keyboard layout
|
bool m_lang_auto; ///< Automatic language selection according to keyboard layout
|
||||||
ZRCola::langid_t m_lang; ///< Language for decomposing
|
ZRCola::langid_t m_lang; ///< Language for decomposing
|
||||||
WXHWND m_hWndSource; ///< handle of the active window, when the ZRCola hotkey was pressed
|
WXHWND m_hWndSource; ///< handle of the active window, when the ZRCola hotkey was pressed
|
||||||
|
wxTaskBarIcon *m_taskBarIcon; ///< Taskbar icon
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -183,6 +183,7 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
|
|||||||
this->Centre( wxBOTH );
|
this->Centre( wxBOTH );
|
||||||
|
|
||||||
// Connect Events
|
// Connect Events
|
||||||
|
this->Connect( wxEVT_ICONIZE, wxIconizeEventHandler( wxZRColaFrameBase::OnIconize ) );
|
||||||
this->Connect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaFrameBase::OnIdle ) );
|
this->Connect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaFrameBase::OnIdle ) );
|
||||||
m_toolDecompLanguage->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( wxZRColaFrameBase::OnDecompLanguageChoice ), NULL, this );
|
m_toolDecompLanguage->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( wxZRColaFrameBase::OnDecompLanguageChoice ), NULL, this );
|
||||||
}
|
}
|
||||||
@ -190,6 +191,7 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
|
|||||||
wxZRColaFrameBase::~wxZRColaFrameBase()
|
wxZRColaFrameBase::~wxZRColaFrameBase()
|
||||||
{
|
{
|
||||||
// Disconnect Events
|
// Disconnect Events
|
||||||
|
this->Disconnect( wxEVT_ICONIZE, wxIconizeEventHandler( wxZRColaFrameBase::OnIconize ) );
|
||||||
this->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaFrameBase::OnIdle ) );
|
this->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaFrameBase::OnIdle ) );
|
||||||
m_toolDecompLanguage->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( wxZRColaFrameBase::OnDecompLanguageChoice ), NULL, this );
|
m_toolDecompLanguage->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( wxZRColaFrameBase::OnDecompLanguageChoice ), NULL, this );
|
||||||
|
|
||||||
|
@ -77,6 +77,7 @@ class wxZRColaFrameBase : public wxFrame
|
|||||||
wxStatusBar* m_statusBar;
|
wxStatusBar* m_statusBar;
|
||||||
|
|
||||||
// Virtual event handlers, overide them in your derived class
|
// Virtual event handlers, overide them in your derived class
|
||||||
|
virtual void OnIconize( wxIconizeEvent& event ) { event.Skip(); }
|
||||||
virtual void OnIdle( wxIdleEvent& event ) { event.Skip(); }
|
virtual void OnIdle( wxIdleEvent& event ) { event.Skip(); }
|
||||||
virtual void OnDecompLanguageChoice( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnDecompLanguageChoice( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user