mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
handle WM_NOTIFYFORMAT
svn path=/trunk/; revision=8738
This commit is contained in:
parent
c53a01dce1
commit
b95e68a45d
3 changed files with 45 additions and 16 deletions
|
@ -95,24 +95,20 @@ NotifyInfo& NotifyInfo::operator=(NOTIFYICONDATA* pnid)
|
|||
|
||||
// store tool tip text
|
||||
if (pnid->uFlags & NIF_TIP)
|
||||
if (pnid->cbSize==NID_SIZE_W6 || pnid->cbSize==NID_SIZE_W5 || pnid->cbSize==NID_SIZE_W3)
|
||||
{ // UNICODE version of NOTIFYICONDATA structure
|
||||
if (pnid->cbSize==NID_SIZE_W6 || pnid->cbSize==NID_SIZE_W5 || pnid->cbSize==NID_SIZE_W3) {
|
||||
// UNICODE version of NOTIFYICONDATA structure
|
||||
LPCWSTR txt = (LPCWSTR)pnid->szTip;
|
||||
|
||||
// get string length
|
||||
int max_len = pnid->cbSize==NID_SIZE_W3? 64: 128;
|
||||
|
||||
// get tooltip string length
|
||||
int l = 0;
|
||||
for(; l<max_len; ++l)
|
||||
if (!txt[l])
|
||||
break;
|
||||
|
||||
_tipText.assign(txt, l);
|
||||
} else if (pnid->cbSize==NID_SIZE_A6 || pnid->cbSize==NID_SIZE_A5 || pnid->cbSize==NID_SIZE_A3)
|
||||
{ // ANSI version of NOTIFYICONDATA structure
|
||||
} else if (pnid->cbSize==NID_SIZE_A6 || pnid->cbSize==NID_SIZE_A5 || pnid->cbSize==NID_SIZE_A3) {
|
||||
LPCSTR txt = (LPCSTR)pnid->szTip;
|
||||
|
||||
// get string length
|
||||
int max_len = pnid->cbSize==NID_SIZE_A3? 64: 128;
|
||||
|
||||
int l = 0;
|
||||
|
@ -378,9 +374,10 @@ void NotifyArea::Refresh()
|
|||
// sync tooltip areas to current icon number
|
||||
if (_sorted_icons.size() != _last_icon_count) {
|
||||
RECT rect = {2, 3, 2+16, 3+16};
|
||||
size_t tt_idx = 0;
|
||||
size_t icon_cnt = _sorted_icons.size();
|
||||
|
||||
for(NotifyIconSet::const_iterator it=_sorted_icons.begin(); it!=_sorted_icons.end(); ++it) {
|
||||
size_t tt_idx = 0;
|
||||
while(tt_idx < icon_cnt) {
|
||||
_tooltip.add(_hwnd, tt_idx++, rect);
|
||||
|
||||
rect.left += NOTIFYICON_DIST;
|
||||
|
|
|
@ -259,6 +259,9 @@ LRESULT CALLBACK Window::WindowWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPAR
|
|||
case WM_NOTIFY:
|
||||
return pThis->Notify(wparam, (NMHDR*)lparam);
|
||||
|
||||
case WM_NOTIFYFORMAT:
|
||||
return NFR_CURRENT;
|
||||
|
||||
case WM_CREATE:
|
||||
return pThis->Init((LPCREATESTRUCT)lparam);
|
||||
|
||||
|
@ -331,6 +334,9 @@ LRESULT CALLBACK SubclassedWindow::SubclassedWndProc(HWND hwnd, UINT nmsg, WPARA
|
|||
case WM_NOTIFY:
|
||||
return pThis->Notify(wparam, (NMHDR*)lparam);
|
||||
|
||||
case WM_NOTIFYFORMAT:
|
||||
return NFR_CURRENT;
|
||||
|
||||
case WM_CREATE:
|
||||
return pThis->Init((LPCREATESTRUCT)lparam);
|
||||
|
||||
|
@ -677,6 +683,9 @@ INT_PTR CALLBACK Window::DialogProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
|
|||
pThis->Notify(wparam, (NMHDR*)lparam);
|
||||
return TRUE; // message has been processed
|
||||
|
||||
case WM_NOTIFYFORMAT:
|
||||
return NFR_CURRENT;
|
||||
|
||||
case WM_NCDESTROY:
|
||||
delete pThis;
|
||||
return TRUE; // message has been processed
|
||||
|
@ -1355,6 +1364,9 @@ INT_PTR CALLBACK PropSheetPageDlg::DialogProc(HWND hwnd, UINT nmsg, WPARAM wpara
|
|||
pThis->Notify(wparam, (NMHDR*)lparam);
|
||||
return TRUE; // message has been processed
|
||||
|
||||
case WM_NOTIFYFORMAT:
|
||||
return NFR_CURRENT;
|
||||
|
||||
case WM_NCDESTROY:
|
||||
delete pThis;
|
||||
return TRUE; // message has been processed
|
||||
|
|
|
@ -138,6 +138,12 @@ protected:
|
|||
static WindowSet s_dialogs;
|
||||
};
|
||||
|
||||
#ifdef UNICODE
|
||||
#define NFR_CURRENT NFR_UNICODE
|
||||
#else
|
||||
#define NFR_CURRENT NFR_ANSI
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
template<typename CLASS> struct GetWindowHelper
|
||||
|
@ -845,27 +851,40 @@ struct ToolTip : public WindowHandle
|
|||
void add(HWND hparent, HWND htool, LPCTSTR txt=LPSTR_TEXTCALLBACK, LPARAM lparam=0)
|
||||
{
|
||||
TOOLINFO ti = {
|
||||
sizeof(TOOLINFO), TTF_SUBCLASS|TTF_IDISHWND/*|TTF_TRANSPARENT*/, hparent, (UINT)htool,
|
||||
sizeof(TOOLINFO), TTF_SUBCLASS|TTF_IDISHWND|TTF_TRANSPARENT, hparent, (UINT)htool,
|
||||
{0,0,0,0}, 0, (LPTSTR)txt, lparam
|
||||
};
|
||||
|
||||
SendMessage(_hwnd, TTM_ADDTOOL, 0, (LPARAM)&ti);
|
||||
#ifdef UNICODE ///@todo Why is it neccesary to try both TTM_ADDTOOLW and TTM_ADDTOOLW ?!
|
||||
if (!SendMessage(_hwnd, TTM_ADDTOOLW, 0, (LPARAM)&ti))
|
||||
SendMessage(_hwnd, TTM_ADDTOOLA, 0, (LPARAM)&ti);
|
||||
#else
|
||||
if (!SendMessage(_hwnd, TTM_ADDTOOLA, 0, (LPARAM)&ti))
|
||||
SendMessage(_hwnd, TTM_ADDTOOLW, 0, (LPARAM)&ti);
|
||||
#endif
|
||||
}
|
||||
|
||||
void add(HWND hparent, UINT id, const RECT& rect, LPCTSTR txt=LPSTR_TEXTCALLBACK, LPARAM lparam=0)
|
||||
{
|
||||
TOOLINFO ti = {
|
||||
sizeof(TOOLINFO), TTF_SUBCLASS/*|TTF_TRANSPARENT*/, hparent, id,
|
||||
sizeof(TOOLINFO), TTF_SUBCLASS|TTF_TRANSPARENT, hparent, id,
|
||||
{rect.left,rect.top,rect.right,rect.bottom}, 0, (LPTSTR)txt, lparam
|
||||
};
|
||||
|
||||
SendMessage(_hwnd, TTM_ADDTOOL, 0, (LPARAM)&ti);
|
||||
#ifdef UNICODE
|
||||
if (!SendMessage(_hwnd, TTM_ADDTOOLW, 0, (LPARAM)&ti))
|
||||
SendMessage(_hwnd, TTM_ADDTOOLA, 0, (LPARAM)&ti);
|
||||
#else
|
||||
if (!SendMessage(_hwnd, TTM_ADDTOOLA, 0, (LPARAM)&ti))
|
||||
SendMessage(_hwnd, TTM_ADDTOOLW, 0, (LPARAM)&ti);
|
||||
#endif
|
||||
}
|
||||
|
||||
void remove(HWND hparent, HWND htool)
|
||||
{
|
||||
TOOLINFO ti = {
|
||||
sizeof(TOOLINFO), TTF_IDISHWND, hparent, (UINT)htool, {0,0,0,0}, 0, 0, 0
|
||||
sizeof(TOOLINFO), TTF_IDISHWND, hparent, (UINT)htool,
|
||||
{0,0,0,0}, 0, 0, 0
|
||||
};
|
||||
|
||||
SendMessage(_hwnd, TTM_DELTOOL, 0, (LPARAM)&ti);
|
||||
|
@ -874,7 +893,8 @@ struct ToolTip : public WindowHandle
|
|||
void remove(HWND hparent, UINT id)
|
||||
{
|
||||
TOOLINFO ti = {
|
||||
sizeof(TOOLINFO), 0, hparent, id, {0,0,0,0}, 0, 0, 0
|
||||
sizeof(TOOLINFO), 0, hparent, id,
|
||||
{0,0,0,0}, 0, 0, 0
|
||||
};
|
||||
|
||||
SendMessage(_hwnd, TTM_DELTOOL, 0, (LPARAM)&ti);
|
||||
|
|
Loading…
Reference in a new issue