|
/* EyeCareTaskBarIcon.cpp
*
* Copyright (C) 3 September, 2005 Priyank Bolia
* http://www.priyank.in
*
* This code is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA
*/
#include "eyecaretaskbaricon.h"
#include "eyecareframe.h"
BEGIN_EVENT_TABLE(CEyeCareTaskBarIcon, wxTaskBarIcon)
EVT_MENU(PU_RESTORE, CEyeCareTaskBarIcon::OnMenuRestore)
EVT_MENU(PU_ABOUT, CEyeCareTaskBarIcon::OnMenuAbout)
EVT_MENU(PU_EXIT, CEyeCareTaskBarIcon::OnMenuExit)
EVT_MENU(PU_IGNORE, CEyeCareTaskBarIcon::OnMenuIgnore)
EVT_UPDATE_UI(PU_IGNORE, CEyeCareTaskBarIcon::OnMenuUIIgnore)
EVT_TASKBAR_LEFT_DCLICK(CEyeCareTaskBarIcon::OnLeftButtonDClick)
END_EVENT_TABLE()
CEyeCareTaskBarIcon::CEyeCareTaskBarIcon(wxWindow *parent)
{
m_pParent = parent;
m_bIgnore = false;
}
CEyeCareTaskBarIcon::~CEyeCareTaskBarIcon(void)
{
}
// Overridables
wxMenu *CEyeCareTaskBarIcon::CreatePopupMenu()
{
wxMenu *menu = new wxMenu;
if(((CEyeCareFrame *)m_pParent)->IsShown())
menu->Append(PU_RESTORE, wxT("&Hide Eye Care"));
else
menu->Append(PU_RESTORE, wxT("&Show Eye Care"));
menu->AppendCheckItem(PU_IGNORE, wxT("&Ignore Eyes"), wxT("Ignore Eyes"));
menu->Append(PU_ABOUT, wxT("&About"));
menu->Append(PU_EXIT, wxT("E&xit"));
return menu;
}
void CEyeCareTaskBarIcon::OnMenuExit(wxCommandEvent& WXUNUSED(event))
{
((CEyeCareFrame *)m_pParent)->ExitApp();
}
void CEyeCareTaskBarIcon::OnMenuRestore(wxCommandEvent& WXUNUSED(event))
{
if(((CEyeCareFrame *)m_pParent)->IsShown())
((CEyeCareFrame *)m_pParent)->ShowMainWindow(false);
else
((CEyeCareFrame *)m_pParent)->ShowMainWindow(true);
}
void CEyeCareTaskBarIcon::OnMenuAbout(wxCommandEvent& WXUNUSED(event))
{
((CEyeCareFrame *)m_pParent)->ShowAboutDialog();
}
void CEyeCareTaskBarIcon::OnMenuIgnore(wxCommandEvent& WXUNUSED(event))
{
((CEyeCareFrame *)m_pParent)->RelaxTimerSwitch(m_bIgnore);
m_bIgnore = !m_bIgnore;
}
void CEyeCareTaskBarIcon::OnMenuUIIgnore(wxUpdateUIEvent &event)
{
event.Check(m_bIgnore);
}
void CEyeCareTaskBarIcon::OnLeftButtonDClick(wxTaskBarIconEvent&)
{
((CEyeCareFrame *)m_pParent)->ShowMainWindow(true);
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.