43
43
LRESULT khm_toolbar_notify(LPNMHDR notice) {
44
44
switch(notice->code) {
47
LPNMTBCUSTOMDRAW nmcd = (LPNMTBCUSTOMDRAW) notice;
48
if(nmcd->nmcd.dwDrawStage == CDDS_PREPAINT) {
49
return CDRF_NOTIFYITEMDRAW | CDRF_NOTIFYPOSTERASE;
50
} else if(nmcd->nmcd.dwDrawStage == CDDS_ITEMPREPAINT) {
51
return CDRF_NOTIFYPOSTPAINT;
52
} else if(nmcd->nmcd.dwDrawStage == CDDS_ITEMPOSTPAINT) {
53
/* draw the actual icon */
60
khui_find_action((int) nmcd->nmcd.dwItemSpec);
62
if(!act || !act->ib_normal)
63
return CDRF_DODEFAULT;
65
if((act->state & KHUI_ACTIONSTATE_DISABLED) &&
67
ibmp = act->ib_disabled;
68
} else if(act->ib_hot &&
69
((nmcd->nmcd.uItemState & CDIS_HOT) ||
70
(nmcd->nmcd.uItemState & CDIS_SELECTED))){
73
ibmp = act->ib_normal;
76
iidx = khui_ilist_lookup_id(ilist_toolbar, ibmp);
78
hbmp = LoadImage(khm_hInstance,
79
MAKEINTRESOURCE(ibmp),
81
KHUI_TOOLBAR_IMAGE_WIDTH,
82
KHUI_TOOLBAR_IMAGE_HEIGHT, 0);
84
khui_ilist_add_masked_id(ilist_toolbar,
92
return CDRF_DODEFAULT;
94
CopyRect(&r, &(nmcd->nmcd.rc));
95
r.left += ((r.right - r.left) -
96
KHUI_TOOLBAR_IMAGE_WIDTH) / 2;
97
r.top += ((r.bottom - r.top) -
98
KHUI_TOOLBAR_IMAGE_HEIGHT) / 2;
100
khui_ilist_draw(ilist_toolbar,
107
return CDRF_DODEFAULT;
47
LPNMTBGETINFOTIP git = (LPNMTBGETINFOTIP) notice;
52
a = khui_find_action(cmd);
56
StringCchCopy(git->pszText, git->cchTextMax, a->caption);
57
} else if (a->tooltip) {
58
StringCchCopy(git->pszText, git->cchTextMax, a->tooltip);
59
} else if (a->is_caption) {
60
wchar_t buf[INFOTIPSIZE];
63
LoadString(khm_hInstance, a->is_caption,
64
buf, ARRAYLENGTH(buf));
66
StringCchCopy(git->pszText, git->cchTextMax, buf);
68
StringCchCopy(git->pszText, git->cchTextMax, L"");
71
StringCchCopy(git->pszText,
78
case TBN_HOTITEMCHANGE:
80
LPNMTBHOTITEM hi = (LPNMTBHOTITEM) notice;
82
if (hi->dwFlags & HICF_LEAVING) {
83
khm_statusbar_set_part(KHUI_SBPART_INFO, NULL, L"");
90
a = khui_find_action(cmd);
96
StringCbCopy(buf, sizeof(buf), a->tooltip);
97
else if (a->is_tooltip) {
98
LoadString(khm_hInstance, a->is_tooltip,
99
buf, ARRAYLENGTH(buf));
103
khm_statusbar_set_part(KHUI_SBPART_INFO, NULL, buf);
110
LPNMTBCUSTOMDRAW nmcd = (LPNMTBCUSTOMDRAW) notice;
111
if(nmcd->nmcd.dwDrawStage == CDDS_PREPAINT) {
112
return CDRF_NOTIFYITEMDRAW | CDRF_NOTIFYPOSTERASE;
113
} else if(nmcd->nmcd.dwDrawStage == CDDS_ITEMPREPAINT) {
114
return CDRF_NOTIFYPOSTPAINT;
115
} else if(nmcd->nmcd.dwDrawStage == CDDS_ITEMPOSTPAINT) {
116
/* draw the actual icon */
123
khui_find_action((int) nmcd->nmcd.dwItemSpec);
125
if(!act || !act->ib_normal)
126
return CDRF_DODEFAULT;
128
if((act->state & KHUI_ACTIONSTATE_DISABLED) &&
130
ibmp = act->ib_disabled;
131
} else if(act->ib_hot &&
132
((nmcd->nmcd.uItemState & CDIS_HOT) ||
133
(nmcd->nmcd.uItemState & CDIS_SELECTED))){
136
ibmp = act->ib_normal;
139
iidx = khui_ilist_lookup_id(ilist_toolbar, ibmp);
141
hbmp = LoadImage(khm_hInstance,
142
MAKEINTRESOURCE(ibmp),
144
KHUI_TOOLBAR_IMAGE_WIDTH,
145
KHUI_TOOLBAR_IMAGE_HEIGHT, 0);
147
khui_ilist_add_masked_id(ilist_toolbar,
149
KHUI_TOOLBAR_BGCOLOR,
155
return CDRF_DODEFAULT;
157
CopyRect(&r, &(nmcd->nmcd.rc));
158
r.left += ((r.right - r.left) -
159
KHUI_TOOLBAR_IMAGE_WIDTH) / 2;
160
r.top += ((r.bottom - r.top) -
161
KHUI_TOOLBAR_IMAGE_HEIGHT) / 2;
163
khui_ilist_draw(ilist_toolbar,
170
return CDRF_DODEFAULT;