tray notification area aka "tray" More...
#include <traynotify.h>
Public Types | |
typedef Window | super |
Public Member Functions | |
NotifyArea (HWND hwnd) | |
~NotifyArea () | |
LRESULT | ProcessTrayNotification (int notify_code, NOTIFYICONDATA *pnid) |
Static Public Member Functions | |
static HWND | Create (HWND hwndParent) |
Protected Member Functions | |
LRESULT | Init (LPCREATESTRUCT pcs) |
LRESULT | WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam) |
int | Command (int id, int code) |
int | Notify (int id, NMHDR *pnmh) |
void | UpdateIcons () |
void | Paint () |
void | Refresh (bool do_refresh=false) |
void | CancelModes () |
NotifyIconSet::iterator | IconHitTest (const POINT &pos) |
search for a icon at a given client coordinate position | |
bool | DetermineHideState (NotifyInfo &entry) |
void | read_config () |
void | write_config () |
void | show_clock (bool flag) |
Protected Attributes | |
WindowHandle | _hwndClock |
int | _clock_width |
ToolTip | _tooltip |
NotifyHook | _hook |
bool | _show_hidden |
bool | _hide_inactive |
bool | _show_button |
NotifyIconCfgList | _cfg |
map< HWND, String > | _window_modules |
NotifyIconMap | _icon_map |
NotifyIconSet | _sorted_icons |
int | _next_idx |
size_t | _last_icon_count |
Friends | |
struct | TrayNotifyDlg |
tray notification area aka "tray"
Definition at line 130 of file traynotify.h.
typedef Window NotifyArea::super |
Definition at line 132 of file traynotify.h.
NotifyArea::NotifyArea | ( | HWND | hwnd ) |
Definition at line 209 of file traynotify.cpp.
References _clock_width, _hide_inactive, _last_icon_count, _next_idx, _show_button, and _show_hidden.
: super(hwnd), _tooltip(hwnd) { _next_idx = 0; _clock_width = 0; _last_icon_count = 0; _show_hidden = false; _hide_inactive = true; _show_button = true; }
NotifyArea::~NotifyArea | ( | ) |
Definition at line 221 of file traynotify.cpp.
References WindowHandle::_hwnd, and write_config().
{ KillTimer(_hwnd, 0); write_config(); }
void NotifyArea::CancelModes | ( | ) | [protected] |
Reimplemented from Window.
Definition at line 579 of file traynotify.cpp.
References _sorted_icons.
Referenced by WndProc().
{ PostMessage(HWND_BROADCAST, WM_CANCELMODE, 0, 0); for(NotifyIconSet::const_iterator it=_sorted_icons.begin(); it!=_sorted_icons.end(); ++it) PostMessage(it->_hWnd, WM_CANCELMODE, 0, 0); }
int NotifyArea::Command | ( | int | id, |
int | code | ||
) | [protected, virtual] |
Reimplemented from Window.
Definition at line 518 of file traynotify.cpp.
References WindowHandle::_hwnd, _show_button, _show_hidden, Dialog::DoModal(), ID_CONFIG_NOTIFYAREA, ID_CONFIG_TIME, ID_SHOW_HIDDEN_ICONS, ID_SHOW_ICON_BUTTON, IDD_NOTIFYAREA, launch_cpanel(), Window::SendParent(), TEXT, UpdateIcons(), and WINDOW_CREATOR.
{ switch(id) { case ID_SHOW_HIDDEN_ICONS: _show_hidden = !_show_hidden; UpdateIcons(); break; case ID_SHOW_ICON_BUTTON: _show_button = !_show_button; UpdateIcons(); break; case ID_CONFIG_NOTIFYAREA: Dialog::DoModal(IDD_NOTIFYAREA, WINDOW_CREATOR(TrayNotifyDlg), GetParent(_hwnd)); break; case ID_CONFIG_TIME: launch_cpanel(_hwnd, TEXT("timedate.cpl")); break; default: SendParent(WM_COMMAND, MAKELONG(id,code), 0); } return 0; }
Definition at line 374 of file traynotify.cpp.
References CLASSNAME_TRAYNOTIFY, NOTIFYAREA_WIDTH_DEF, TITLE_TRAYNOTIFY, and WINDOW_CREATOR.
Referenced by show_clock().
{ static BtnWindowClass wcTrayNotify(CLASSNAME_TRAYNOTIFY, CS_DBLCLKS); ClientRect clnt(hwndParent); return Window::Create(WINDOW_CREATOR(NotifyArea), WS_EX_STATICEDGE, wcTrayNotify, TITLE_TRAYNOTIFY, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN, clnt.right-(NOTIFYAREA_WIDTH_DEF+1), 1, NOTIFYAREA_WIDTH_DEF, clnt.bottom-2, hwndParent); }
bool NotifyArea::DetermineHideState | ( | NotifyInfo & | entry ) | [protected] |
NotifyIconSet::iterator NotifyArea::IconHitTest | ( | const POINT & | pos ) | [protected] |
search for a icon at a given client coordinate position
Definition at line 802 of file traynotify.cpp.
References _show_button, _sorted_icons, NOTIFYICON_DIST, NOTIFYICON_SIZE, NOTIFYICON_X, and NOTIFYICON_Y.
Referenced by Notify(), and WndProc().
{ if (pos.y<NOTIFYICON_Y || pos.y>=NOTIFYICON_Y+NOTIFYICON_SIZE) return _sorted_icons.end(); NotifyIconSet::iterator it = _sorted_icons.begin(); int x = NOTIFYICON_X; if (_show_button) x += NOTIFYICON_DIST; for(; it!=_sorted_icons.end(); ++it) { //NotifyInfo& entry = const_cast<NotifyInfo&>(*it); // Why does GCC 3.3 need this additional const_cast ?! if (pos.x>=x && pos.x<x+NOTIFYICON_SIZE) break; x += NOTIFYICON_DIST; } return it; }
LRESULT NotifyArea::Init | ( | LPCREATESTRUCT | pcs ) | [protected, virtual] |
Reimplemented from Window.
Definition at line 362 of file traynotify.cpp.
References WindowHandle::_hwnd, Window::Init(), and read_config().
{ if (super::Init(pcs)) return 1; read_config(); SetTimer(_hwnd, 0, 1000, NULL); return 0; }
int NotifyArea::Notify | ( | int | id, |
NMHDR * | pnmh | ||
) | [protected, virtual] |
Reimplemented from Window.
Definition at line 546 of file traynotify.cpp.
References WindowHandle::_hwnd, _show_button, _show_hidden, _sorted_icons, NotifyIconConfig::_tipText, IconHitTest(), IDS_HIDE_ICONS, IDS_SHOW_HIDDEN_ICONS, NOTIFYICON_SIZE, NOTIFYICON_X, NOTIFYICON_Y, ScreenToClient(), and String::str().
{ if (pnmh->code == TTN_GETDISPINFO) { LPNMTTDISPINFO pdi = (LPNMTTDISPINFO)pnmh; Point pt(GetMessagePos()); ScreenToClient(_hwnd, &pt); if (_show_button && pt.x>=NOTIFYICON_X && pt.x<NOTIFYICON_X+NOTIFYICON_SIZE && pt.y>=NOTIFYICON_Y && pt.y<NOTIFYICON_Y+NOTIFYICON_SIZE) { static ResString sShowIcons(IDS_SHOW_HIDDEN_ICONS); static ResString sHideIcons(IDS_HIDE_ICONS); pdi->lpszText = (_show_hidden? sHideIcons: sShowIcons).str(); } else { NotifyIconSet::iterator found = IconHitTest(pt); if (found != _sorted_icons.end()) { NotifyInfo& entry = const_cast<NotifyInfo&>(*found); // Why does GCC 3.3 need this additional const_cast ?! // enable multiline tooltips (break at CR/LF and for very long one-line strings) SendMessage(pnmh->hwndFrom, TTM_SETMAXTIPWIDTH, 0, 400); pdi->lpszText = entry._tipText.str(); } } } return 0; }
void NotifyArea::Paint | ( | ) | [protected] |
Definition at line 710 of file traynotify.cpp.
References WindowHandle::_hwnd, _show_button, _show_hidden, _sorted_icons, IDI_NOTIFY_L, IDI_NOTIFY_R, NOTIFYICON_DIST, NOTIFYICON_SIZE, NOTIFYICON_X, and NOTIFYICON_Y.
Referenced by WndProc().
{ BufferedPaintCanvas canvas(_hwnd); // first fill with the background color FillRect(canvas, &canvas.rcPaint, GetSysColorBrush(COLOR_BTNFACE)); // draw icons int x = NOTIFYICON_X; int y = NOTIFYICON_Y; if (_show_button) { static SmallIcon leftArrowIcon(IDI_NOTIFY_L); static SmallIcon rightArrowIcon(IDI_NOTIFY_R); DrawIconEx(canvas, x, y, _show_hidden?rightArrowIcon:leftArrowIcon, NOTIFYICON_SIZE, NOTIFYICON_SIZE, 0, 0, DI_NORMAL); x += NOTIFYICON_DIST; } #ifndef _NO_ALPHABLEND MemCanvas mem_dc; SelectedBitmap bmp(mem_dc, CreateCompatibleBitmap(canvas, NOTIFYICON_SIZE, NOTIFYICON_SIZE)); RECT rect = {0, 0, NOTIFYICON_SIZE, NOTIFYICON_SIZE}; BLENDFUNCTION blend = {AC_SRC_OVER, 0, 128, 0}; // 50 % visible #endif for(NotifyIconSet::const_iterator it=_sorted_icons.begin(); it!=_sorted_icons.end(); ++it) { #ifndef _NO_ALPHABLEND if (it->_dwState & NIS_HIDDEN) { FillRect(mem_dc, &rect, GetSysColorBrush(COLOR_BTNFACE)); DrawIconEx(mem_dc, 0, 0, it->_hIcon, NOTIFYICON_SIZE, NOTIFYICON_SIZE, 0, 0, DI_NORMAL); AlphaBlend(canvas, x, y, NOTIFYICON_SIZE, NOTIFYICON_SIZE, mem_dc, 0, 0, NOTIFYICON_SIZE, NOTIFYICON_SIZE, blend); } else #endif DrawIconEx(canvas, x, y, it->_hIcon, NOTIFYICON_SIZE, NOTIFYICON_SIZE, 0, 0, DI_NORMAL); x += NOTIFYICON_DIST; } }
LRESULT NotifyArea::ProcessTrayNotification | ( | int | notify_code, |
NOTIFYICONDATA * | pnid | ||
) |
Definition at line 587 of file traynotify.cpp.
References NotifyInfo::_dwState, WindowHandle::_hwnd, _icon_map, NotifyInfo::_idx, NotifyIconConfig::_mode, _next_idx, DetermineHideState(), NotifyInfo::modify(), NIM_HIDE, and UpdateIcons().
{ switch(notify_code) { case NIM_ADD: case NIM_MODIFY: if ((int)pnid->uID >= 0) { ///@todo This is a fix for Windows Task Manager. NotifyInfo& entry = _icon_map[pnid]; // a new entry? if (entry._idx == -1) entry._idx = ++_next_idx; /* equivalent code using iterator::find(); NotifyIconMap::iterator found = _icon_map.find(pnid); NotifyInfo* pentry; // a new entry? if (found == _icon_map.end()) { pentry = &_icon_map[pnid]; pentry->_idx = ++_next_idx; } else { pentry = &found->second; } NotifyInfo& entry = *pentry; */ bool changes = entry.modify(pnid); #if NOTIFYICON_VERSION>=3 // as of 21.08.2003 missing in MinGW headers if (DetermineHideState(entry) && entry._mode==NIM_HIDE) { entry._dwState |= NIS_HIDDEN; changes = true; } #endif if (changes) UpdateIcons(); ///@todo call only if really changes occurred return TRUE; } break; case NIM_DELETE: { NotifyIconMap::iterator found = _icon_map.find(pnid); if (found != _icon_map.end()) { if (found->second._hIcon) DestroyIcon(found->second._hIcon); _icon_map.erase(found); UpdateIcons(); return TRUE; } break;} #if NOTIFYICON_VERSION>=3 // as of 21.08.2003 missing in MinGW headers case NIM_SETFOCUS: SetForegroundWindow(_hwnd); return TRUE; case NIM_SETVERSION: NotifyIconMap::iterator found = _icon_map.find(pnid); if (found != _icon_map.end()) { found->second._version = pnid->UNION_MEMBER(uVersion); return TRUE; } else return FALSE; #endif } return FALSE; }
void NotifyArea::read_config | ( | ) | [protected] |
Definition at line 248 of file traynotify.cpp.
References _cfg, _hide_inactive, NotifyIconConfig::_mode, NotifyIconConfig::_modulePath, NotifyIconConfig::_name, _show_button, _show_hidden, NotifyIconConfig::_tipText, NotifyIconConfig::_windowTitle, XMLStorage::XMLPos::back(), XMLStorage::XMLChildrenFilter::begin(), XMLStorage::XMLChildrenFilter::end(), g_Globals, XMLStorage::XMLNode::get(), ExplorerGlobals::get_cfg(), XMLStorage::XMLPos::go_down(), NIM_HIDE, NIM_SHOW, and show_clock().
Referenced by Init(), and WndProc().
{ bool clock_visible = true; // read notification icon settings from XML configuration XMLPos cfg_pos = g_Globals.get_cfg(); #ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003) if (!g_Globals._SHRestricted || !SHRestricted(REST_HIDECLOCK)) #endif { if (cfg_pos.go_down("desktopbar")) { clock_visible = XMLBoolRef(XMLPos(cfg_pos,"options"), "show-clock", !get_hide_clock_from_registry()); cfg_pos.back(); } } if (cfg_pos.go_down("notify-icons")) { XMLPos options(cfg_pos, "options"); _hide_inactive = XMLBool(options, "hide-inactive", true); ///@todo read default setting from registry _show_hidden = XMLBool(options, "show-hidden", false); ///@todo read default setting from registry _show_button = XMLBool(options, "show-button", true); XMLChildrenFilter icons(cfg_pos, "icon"); for(XMLChildrenFilter::iterator it=icons.begin(); it!=icons.end(); ++it) { const XMLNode& node = **it; NotifyIconConfig cfg; cfg._name = node.get("name").c_str(); cfg._tipText = node.get("text").c_str(); cfg._windowTitle = node.get("window").c_str(); cfg._modulePath = node.get("module").c_str(); const string& mode = node.get("show"); if (mode == "show") cfg._mode = NIM_SHOW; else if (mode == "hide") cfg._mode = NIM_HIDE; else //if (mode == "auto") cfg._mode = NIM_HIDE; _cfg.push_back(cfg); } cfg_pos.back(); } show_clock(clock_visible); }
void NotifyArea::Refresh | ( | bool | do_refresh = false ) |
[protected] |
Definition at line 750 of file traynotify.cpp.
References NotifyInfo::_dwState, _hide_inactive, NotifyIconIndex::_hWnd, _icon_map, NotifyInfo::_lastChange, NotifyIconConfig::_mode, _sorted_icons, DetermineHideState(), ICON_AUTOHIDE_SECONDS, NIM_AUTO, NIM_HIDE, NIM_SHOW, and UpdateIcons().
Referenced by WndProc().
{ // Look for task icons without valid owner window. // This is an extended feature missing in MS Windows. for(NotifyIconSet::const_iterator it=_sorted_icons.begin(); it!=_sorted_icons.end(); ++it) { const NotifyInfo& entry = *it; if (!IsWindow(entry._hWnd)) if (_icon_map.erase(entry)) // delete icons without valid owner window ++update; } DWORD now = GetTickCount(); // handle icon hiding for(NotifyIconMap::iterator it=_icon_map.begin(); it!=_icon_map.end(); ++it) { NotifyInfo& entry = it->second; DetermineHideState(entry); switch(entry._mode) { case NIM_HIDE: if (!(entry._dwState & NIS_HIDDEN)) { entry._dwState |= NIS_HIDDEN; ++update; } break; case NIM_SHOW: if (entry._dwState&NIS_HIDDEN) { entry._dwState &= ~NIS_HIDDEN; ++update; } break; case NIM_AUTO: // automatically hide icons after long periods of inactivity if (_hide_inactive) if (!(entry._dwState & NIS_HIDDEN)) if (now-entry._lastChange > ICON_AUTOHIDE_SECONDS*1000) { entry._dwState |= NIS_HIDDEN; ++update; } break; } } if (update) UpdateIcons(); }
void NotifyArea::show_clock | ( | bool | flag ) | [protected] |
Definition at line 339 of file traynotify.cpp.
References _clock_width, WindowHandle::_hwnd, _hwndClock, Create(), and PM_RESIZE_CHILDREN.
Referenced by read_config().
{ bool vis = _hwndClock!=0; if (vis != flag) { if (flag) { // create clock window _hwndClock = ClockWindow::Create(_hwnd); if (_hwndClock) { ClientRect clock_size(_hwndClock); _clock_width = clock_size.right; } } else { DestroyWindow(_hwndClock); _hwndClock = 0; _clock_width = 0; } SendMessage(GetParent(_hwnd), PM_RESIZE_CHILDREN, 0, 0); } }
void NotifyArea::UpdateIcons | ( | ) | [protected] |
Definition at line 657 of file traynotify.cpp.
References NotifyInfo::_dwState, WindowHandle::_hwnd, _icon_map, _last_icon_count, _show_button, _show_hidden, _sorted_icons, _tooltip, ToolTip::add(), NOTIFYICON_DIST, NOTIFYICON_SIZE, NOTIFYICON_X, NOTIFYICON_Y, PM_RESIZE_CHILDREN, and ToolTip::remove().
Referenced by Command(), ProcessTrayNotification(), Refresh(), and WndProc().
{ _sorted_icons.clear(); // sort icon infos by display index for(NotifyIconMap::const_iterator it=_icon_map.begin(); it!=_icon_map.end(); ++it) { const NotifyInfo& entry = it->second; #ifdef NIF_STATE // as of 21.08.2003 missing in MinGW headers if (_show_hidden || !(entry._dwState & NIS_HIDDEN)) #endif _sorted_icons.insert(entry); } // sync tooltip areas to current icon number if (_sorted_icons.size() != _last_icon_count) { RECT rect = {NOTIFYICON_X, NOTIFYICON_Y, NOTIFYICON_X+NOTIFYICON_SIZE, NOTIFYICON_Y+NOTIFYICON_SIZE}; size_t tt_idx = 0; if (_show_button) { _tooltip.add(_hwnd, tt_idx++, rect); rect.left += NOTIFYICON_DIST; rect.right += NOTIFYICON_DIST; } size_t icon_cnt = _sorted_icons.size(); while(tt_idx < icon_cnt) { _tooltip.add(_hwnd, tt_idx++, rect); rect.left += NOTIFYICON_DIST; rect.right += NOTIFYICON_DIST; } while(tt_idx < _last_icon_count) _tooltip.remove(_hwnd, tt_idx++); _last_icon_count = _sorted_icons.size(); } SendMessage(GetParent(_hwnd), PM_RESIZE_CHILDREN, 0, 0); InvalidateRect(_hwnd, NULL, FALSE); // refresh icon display UpdateWindow(_hwnd); }
LRESULT NotifyArea::WndProc | ( | UINT | nmsg, |
WPARAM | wparam, | ||
LPARAM | lparam | ||
) | [protected, virtual] |
Reimplemented from Window.
Definition at line 385 of file traynotify.cpp.
References _clock_width, _hook, NotifyIconIndex::_hWnd, WindowHandle::_hwnd, _hwndClock, _icon_map, _show_button, _show_hidden, _sorted_icons, NotifyInfo::_uCallbackMessage, NotifyIconIndex::_uID, _window_modules, CancelModes(), GET_WINDOW, HWND, IconHitTest(), ID_SHOW_HIDDEN_ICONS, ID_SHOW_ICON_BUTTON, IDM_NOTIFYAREA, NotifyHook::ModulePathCopyData(), NOTIFYAREA_SPACE, NOTIFYICON_DIST, NOTIFYICON_SIZE, NOTIFYICON_X, NOTIFYICON_Y, Paint(), PM_GET_WIDTH, PM_REFRESH, PM_REFRESH_CONFIG, read_config(), Refresh(), ScreenToClient(), TEXT, ClockWindow::TimerTick(), PopupMenu::TrackPopupMenu(), UpdateIcons(), and Window::WndProc().
{ switch(nmsg) { case WM_PAINT: Paint(); break; case WM_TIMER: { Refresh(); ClockWindow* clock_window = GET_WINDOW(ClockWindow, _hwndClock); if (clock_window) clock_window->TimerTick(); break;} case PM_REFRESH: Refresh(true); break; case WM_SIZE: { int cx = LOWORD(lparam); SetWindowPos(_hwndClock, 0, cx-_clock_width, 0, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE); break;} case PM_GET_WIDTH: { int w = _sorted_icons.size()*NOTIFYICON_DIST + NOTIFYAREA_SPACE + _clock_width; if (_show_button) w += NOTIFYICON_DIST; return w;} case PM_REFRESH_CONFIG: read_config(); break; case WM_CONTEXTMENU: { Point pt(lparam); POINTS p; p.x = (SHORT) pt.x; p.y = (SHORT) pt.y; ScreenToClient(_hwnd, &pt); if (IconHitTest(pt) == _sorted_icons.end()) { // display menu only when no icon clicked PopupMenu menu(IDM_NOTIFYAREA); SetMenuDefaultItem(menu, 0, MF_BYPOSITION); CheckMenuItem(menu, ID_SHOW_HIDDEN_ICONS, MF_BYCOMMAND|(_show_hidden?MF_CHECKED:MF_UNCHECKED)); CheckMenuItem(menu, ID_SHOW_ICON_BUTTON, MF_BYCOMMAND|(_show_button?MF_CHECKED:MF_UNCHECKED)); menu.TrackPopupMenu(_hwnd, p); } break;} case WM_COPYDATA: { // receive NotifyHook answers String path; HWND hwnd; if (_hook.ModulePathCopyData(lparam, &hwnd, path)) _window_modules[hwnd] = path; break;} default: if (nmsg>=WM_MOUSEFIRST && nmsg<=WM_MOUSELAST) { // close startup menu and other popup menus // This functionality is missing in MS Windows. if (nmsg==WM_LBUTTONDOWN || nmsg==WM_MBUTTONDOWN || nmsg==WM_RBUTTONDOWN #ifdef WM_XBUTTONDOWN || nmsg==WM_XBUTTONDOWN #endif ) CancelModes(); Point pt(lparam); NotifyIconSet::const_iterator found = IconHitTest(pt); if (found != _sorted_icons.end()) { const NotifyInfo& entry = const_cast<NotifyInfo&>(*found); // Why does GCC 3.3 need this additional const_cast ?! // set activation time stamp if (nmsg == WM_LBUTTONDOWN || // Some programs need PostMessage() instead of SendMessage(). nmsg == WM_MBUTTONDOWN || // So call SendMessage() only for BUTTONUP and BLCLK messages #ifdef WM_XBUTTONDOWN nmsg == WM_XBUTTONDOWN || #endif nmsg == WM_RBUTTONDOWN) { _icon_map[entry]._lastChange = GetTickCount(); } // Notify the message if the owner is still alive if (IsWindow(entry._hWnd)) { if (nmsg == WM_MOUSEMOVE || // avoid to call blocking SendMessage() for merely moving the mouse over icons nmsg == WM_LBUTTONDOWN || // Some programs need PostMessage() instead of SendMessage(). nmsg == WM_MBUTTONDOWN || // So call SendMessage() only for BUTTONUP and BLCLK messages #ifdef WM_XBUTTONDOWN nmsg == WM_XBUTTONDOWN || #endif nmsg == WM_RBUTTONDOWN) PostMessage(entry._hWnd, entry._uCallbackMessage, entry._uID, nmsg); else { // allow SetForegroundWindow() in client process DWORD pid; if (GetWindowThreadProcessId(entry._hWnd, &pid)) { // bind dynamically to AllowSetForegroundWindow() to be compatible to WIN98 static DynamicFct<BOOL(WINAPI*)(DWORD)> AllowSetForegroundWindow(TEXT("USER32"), "AllowSetForegroundWindow"); if (AllowSetForegroundWindow) (*AllowSetForegroundWindow)(pid); } // use PostMessage() for notifcation icons of Shell Service Objects in the own process if (pid == GetCurrentProcessId()) PostMessage(entry._hWnd, entry._uCallbackMessage, entry._uID, nmsg); else SendMessage(entry._hWnd, entry._uCallbackMessage, entry._uID, nmsg); } } else if (_icon_map.erase(entry)) // delete icons without valid owner window UpdateIcons(); } else // handle clicks on notification area button "show hidden icons" if (_show_button) if (nmsg == WM_LBUTTONDOWN) if (pt.x>=NOTIFYICON_X && pt.x<NOTIFYICON_X+NOTIFYICON_SIZE && pt.y>=NOTIFYICON_Y && pt.y<NOTIFYICON_Y+NOTIFYICON_SIZE) PostMessage(_hwnd, WM_COMMAND, MAKEWPARAM(ID_SHOW_HIDDEN_ICONS,0), 0); } return super::WndProc(nmsg, wparam, lparam); } return 0; }
void NotifyArea::write_config | ( | ) | [protected] |
Definition at line 301 of file traynotify.cpp.
References _cfg, _hide_inactive, _hwndClock, NotifyIconConfig::_mode, NotifyIconConfig::_modulePath, NotifyIconConfig::_name, _show_button, _show_hidden, NotifyIconConfig::_tipText, NotifyIconConfig::_windowTitle, XMLStorage::XMLPos::back(), NotifyIconConfig::create_name(), g_Globals, ExplorerGlobals::get_cfg(), XMLStorage::XMLPos::smart_create(), and string_from_mode().
Referenced by ~NotifyArea().
{ // write notification icon settings to XML configuration file XMLPos cfg_pos = g_Globals.get_cfg(); cfg_pos.smart_create("desktopbar"); XMLBoolRef boolRef(XMLPos(cfg_pos,"options"), "show-clock"); boolRef = _hwndClock!=0; cfg_pos.back(); cfg_pos.smart_create("notify-icons"); XMLPos options(cfg_pos, "options"); XMLBoolRef(options, "hide-inactive") = _hide_inactive; XMLBoolRef(options, "show-hidden") = _show_hidden; XMLBoolRef(options, "show-button") = _show_button; for(NotifyIconCfgList::iterator it=_cfg.begin(); it!=_cfg.end(); ++it) { NotifyIconConfig& cfg = *it; // search for the corresponding node using the original name cfg_pos.smart_create("icon", "name", cfg._name); // refresh unique name cfg.create_name(); cfg_pos["name"] = cfg._name.c_str(); cfg_pos["text"] = cfg._tipText.c_str(); cfg_pos["window"] = cfg._windowTitle.c_str(); cfg_pos["module"] = cfg._modulePath.c_str(); cfg_pos["show"] = string_from_mode(cfg._mode).c_str(); cfg_pos.back(); } cfg_pos.back(); // smart_create }
friend struct TrayNotifyDlg [friend] |
Definition at line 168 of file traynotify.h.
NotifyIconCfgList NotifyArea::_cfg [protected] |
Definition at line 170 of file traynotify.h.
Referenced by TrayNotifyDlg::Command(), read_config(), TrayNotifyDlg::Refresh(), TrayNotifyDlg::SetIconMode(), TrayNotifyDlg::TrayNotifyDlg(), and write_config().
int NotifyArea::_clock_width [protected] |
Definition at line 143 of file traynotify.h.
Referenced by NotifyArea(), show_clock(), and WndProc().
bool NotifyArea::_hide_inactive [protected] |
Definition at line 149 of file traynotify.h.
Referenced by NotifyArea(), read_config(), Refresh(), and write_config().
NotifyHook NotifyArea::_hook [protected] |
Definition at line 146 of file traynotify.h.
Referenced by WndProc().
WindowHandle NotifyArea::_hwndClock [protected] |
Definition at line 142 of file traynotify.h.
Referenced by show_clock(), WndProc(), and write_config().
NotifyIconMap NotifyArea::_icon_map [protected] |
Definition at line 174 of file traynotify.h.
Referenced by TrayNotifyDlg::Command(), ProcessTrayNotification(), TrayNotifyDlg::Refresh(), Refresh(), TrayNotifyDlg::TrayNotifyDlg(), UpdateIcons(), and WndProc().
size_t NotifyArea::_last_icon_count [protected] |
Definition at line 177 of file traynotify.h.
Referenced by NotifyArea(), and UpdateIcons().
int NotifyArea::_next_idx [protected] |
Definition at line 176 of file traynotify.h.
Referenced by NotifyArea(), and ProcessTrayNotification().
bool NotifyArea::_show_button [protected] |
Definition at line 150 of file traynotify.h.
Referenced by Command(), IconHitTest(), Notify(), NotifyArea(), Paint(), read_config(), UpdateIcons(), WndProc(), and write_config().
bool NotifyArea::_show_hidden [protected] |
Definition at line 148 of file traynotify.h.
Referenced by TrayNotifyDlg::Command(), Command(), Notify(), NotifyArea(), Paint(), read_config(), TrayNotifyDlg::Refresh(), TrayNotifyDlg::TrayNotifyDlg(), UpdateIcons(), WndProc(), and write_config().
NotifyIconSet NotifyArea::_sorted_icons [protected] |
Definition at line 175 of file traynotify.h.
Referenced by CancelModes(), IconHitTest(), Notify(), Paint(), Refresh(), UpdateIcons(), and WndProc().
ToolTip NotifyArea::_tooltip [protected] |
Definition at line 145 of file traynotify.h.
Referenced by UpdateIcons().
map<HWND, String> NotifyArea::_window_modules [protected] |
Definition at line 172 of file traynotify.h.
Referenced by WndProc().
ROS Explorer Source Code Documentation
generated on 02.01.2013 by ![]() |