xoblite™ / Blackbox for Windows bb5 | RC6 preview | 0.25.2.14
http://xoblite.net/
MenuItem Class Reference

#include <MenuItem.h>

Public Member Functions

 MenuItem (int type, char *pszTitleANSI, wchar_t *pszTitleUnicode, char *pszCommand, char *pszArgument, bool isSelected)
 
virtual ~MenuItem ()
 
virtual LRESULT NcHitTest (int x, int y)
 
int IsOver (int x, int y)
 
virtual void Mouse (UINT nMsg, POINT pt)
 
virtual void Invoke (int button)
 
virtual bool Active (bool bActive)
 
virtual bool IsActive ()
 
virtual char * GetSortString ()
 
virtual void GetItemRect (RECT *r)
 
virtual void GetTitleRect (RECT *r)
 
virtual UINT GetDrawTextFormat ()
 
virtual void SetTitleANSI (char *pszTitleANSI)
 
virtual void SetTitleUnicode (wchar_t *pszTitleUnicode)
 
void AddToSelectionGroup (int group)
 
void ItemSetTimer ()
 
virtual void Timer (int nTimer)
 
void ItemKillTimer ()
 
virtual void SetWidth (int nWidth)
 
virtual int GetWidth ()
 
virtual void SetHeight (int nHeight)
 
virtual int GetHeight ()
 
virtual void SetPosition (int nLeft, int nTop)
 
virtual void SetSortPriority (int nSortPriority)
 
virtual int GetSortPriority ()
 
virtual void Attached (Menu *pMenu)
 
virtual LRESULT Command (WPARAM wParam, LPARAM lParam)
 
virtual bool OnUser (int nMessage, WPARAM wParam, LPARAM lParam, LRESULT &lResult)
 
virtual void Moving ()
 
virtual HWND GetWindow ()
 
void ToggleSelected ()
 

Static Public Member Functions

static bool Compare (MenuItem *pM1, MenuItem *pM2)
 

Public Attributes

char * m_pszTitleANSI
 
wchar_t * m_pszTitleUnicode
 
int itemType
 
char * m_pszCommand
 
char * m_pszArgument
 
char * m_pszOriginalTitleANSI
 
wchar_t * m_pszOriginalTitleUnicode
 
bool m_isSelected
 
int m_selectionGroup
 
int m_currentValue
 
int m_minValue
 
int m_maxValue
 
POINT m_mousePos
 
int m_nSortPriority
 
Menum_pParent
 
Menum_pSubMenu
 
int m_nLeft
 
int m_nTop
 
int m_nWidth
 
int m_nHeight
 
bool m_bActive
 
UINT m_nTimerId
 
int m_nLastMouseButton
 

Constructor & Destructor Documentation

◆ MenuItem()

MenuItem::MenuItem ( int type,
char * pszTitleANSI,
wchar_t * pszTitleUnicode,
char * pszCommand,
char * pszArgument,
bool isSelected )
43{
44 itemType = type;
45
46 if (pszTitleANSI == NULL) m_pszTitleANSI = _strdup("");
47 else m_pszTitleANSI = _strdup(pszTitleANSI);
48
49 if (pszTitleUnicode == NULL)
50 {
52 {
53 wchar_t itemTitleUnicode[MAX_LINE_LENGTH];
54 MultiByteToWideChar(CP_UTF8, 0, pszTitleANSI, strlen(pszTitleANSI)+1, itemTitleUnicode, MAX_LINE_LENGTH);
55 m_pszTitleUnicode = _wcsdup(itemTitleUnicode);
56 }
57 else m_pszTitleUnicode = _wcsdup(L"");
58 }
59 else m_pszTitleUnicode = _wcsdup(pszTitleUnicode);
60
61 //====================
62
63 m_pParent = NULL;
64 m_nWidth = 0;
65 m_nHeight = 0;
66
67 m_bActive = false;
68 m_nTimerId = 0;
69
70 m_selectionGroup = 0; // Default -> Not part of any selection group (i.e. a group of mutually exclusive boolean items)
71
72 SetSortPriority(PRIORITY_NORMAL); // Default sort priority unless defined
73
74 //====================
75
76 if (type == MENUITEM_COMMAND || type == MENUITEM_BOOLEAN || type == MENUITEM_EDITINT)
77 {
78 // Creates a command-type menu item object (being either a regular, a boolean or an integer editing item)
79 // pszCommand -> The command associated with this menu item
80 // pszArgument -> Optional argument to pszCommand
81 // pszTitle -> The text to be drawn on the menu item
82
83 m_pszCommand = pszCommand ? _strdup(pszCommand) : _strdup("");
84 m_pszArgument = pszArgument ? _strdup(pszArgument) : _strdup("");
85 m_pszOriginalTitleANSI = pszTitleANSI ? _strdup(pszTitleANSI) : _strdup("");
86 m_pszOriginalTitleUnicode = pszTitleUnicode ? _wcsdup(pszTitleUnicode) : _wcsdup(L"");
87 m_isSelected = isSelected;
88
89 if (type == MENUITEM_EDITINT) // Used by MakeMenuItemInt...
90 {
91 char command[MAX_LINE_LENGTH], value[10], min[10], max[10];
92 LPSTR tokens[3];
93 tokens[0] = command;
94 tokens[1] = value;
95 tokens[2] = min;
96 command[0] = value[0] = min[0] = max[0] = '\0';
97 BBTokenize (m_pszCommand, tokens, 3, max);
98
99 m_pszCommand = command ? _strdup(command) : _strdup("");
100
101 m_currentValue = atoi(value);
102 m_minValue = atoi(min);
103 m_maxValue = atoi(max);
104
105 char itemstringANSI[MAX_LINE_LENGTH];
106 sprintf(itemstringANSI, "%s <%d>", m_pszOriginalTitleANSI, m_currentValue);
107 SetTitleANSI(itemstringANSI);
108
109 wchar_t itemStringUnicode[MAX_LINE_LENGTH];
110 swprintf(itemStringUnicode, sizeof(itemStringUnicode), L"%s <%d>", m_pszOriginalTitleUnicode, m_currentValue);
111 SetTitleUnicode(itemStringUnicode);
112 }
113 }
114
115 //====================
116
117 else
118 {
119 m_pszCommand = NULL;
120 m_pszArgument = NULL;
123// m_isSelected = false;
124 m_isSelected = isSelected;
125
127 }
128
129 //====================
130
131 // Set a higher sort priority for [separator] items to make
132 // sort before any regular menu items (i.e. between folders
133 // regular menu items)
134// if (itemType == MENUITEM_SEPARATOR) SetSortPriority(PRIORITY_SEPARATOR);
135// else if (itemType == MENUITEM_HEADER) SetSortPriority(PRIORITY_HEADER);
136}
int BBTokenize(LPCSTR szString, char *lpszBuffers[], DWORD dwNumBuffers, LPSTR szExtraParameters)
Definition BBApi.cpp:316
Settings * pSettings
Definition Blackbox.cpp:46
#define MAX_LINE_LENGTH
Definition BBApi.h:64
#define MENUITEM_EDITINT
Definition MenuItem.h:44
#define MENUITEM_COMMAND
Definition MenuItem.h:42
#define PRIORITY_NORMAL
Definition MenuItem.h:57
#define MENUITEM_BOOLEAN
Definition MenuItem.h:45
virtual void SetSortPriority(int nSortPriority)
Definition MenuItem.h:131
char * m_pszArgument
Definition MenuItem.h:98
int m_currentValue
Definition MenuItem.h:104
bool m_bActive
Definition MenuItem.h:188
int m_minValue
Definition MenuItem.h:105
char * m_pszCommand
Definition MenuItem.h:97
wchar_t * m_pszTitleUnicode
Definition MenuItem.h:94
int m_nWidth
Definition MenuItem.h:185
UINT m_nTimerId
Definition MenuItem.h:190
Menu * m_pParent
Definition MenuItem.h:180
bool m_isSelected
Definition MenuItem.h:101
wchar_t * m_pszOriginalTitleUnicode
Definition MenuItem.h:100
int m_maxValue
Definition MenuItem.h:106
int m_selectionGroup
Definition MenuItem.h:102
int m_nHeight
Definition MenuItem.h:186
char * m_pszTitleANSI
Definition MenuItem.h:93
virtual void SetTitleANSI(char *pszTitleANSI)
Definition MenuItem.cpp:449
virtual void SetTitleUnicode(wchar_t *pszTitleUnicode)
Definition MenuItem.cpp:456
char * m_pszOriginalTitleANSI
Definition MenuItem.h:99
int itemType
Definition MenuItem.h:95
bool disableUnicodeParsing
Definition Settings.h:335

◆ ~MenuItem()

MenuItem::~MenuItem ( )
virtual
141{
143
145 m_pszTitleANSI = NULL;
147 m_pszTitleUnicode = NULL;
148
153
154 if (m_pszCommand) free(m_pszCommand);
155 m_pszCommand = NULL;
156 if (m_pszArgument) free(m_pszArgument);
157 m_pszArgument = NULL;
158}
void ItemKillTimer()
Definition MenuItem.cpp:359

Member Function Documentation

◆ NcHitTest()

LRESULT MenuItem::NcHitTest ( int x,
int y )
virtual
163{
165 {
166 if (IsOver(x, y) && (!m_pParent->GetParent() || m_pParent->IsPinned())) return HTCAPTION;
167 }
168
169 return HTCLIENT;
170}
#define MENUITEM_HEADER
Definition MenuItem.h:38
#define MENUITEM_FOOTER
Definition MenuItem.h:40
int IsOver(int x, int y)
Definition MenuItem.cpp:174

◆ IsOver()

int MenuItem::IsOver ( int x,
int y )
175{
176 if ((x >= 0) && (x <= GetWidth()) && (y >= m_nTop) && (y <= m_nTop + GetHeight()))
177 return true;
178 else
179 return false;
180}
virtual int GetWidth()
Definition MenuItem.h:120
virtual int GetHeight()
Definition MenuItem.h:122
int m_nTop
Definition MenuItem.h:184

◆ Mouse()

void MenuItem::Mouse ( UINT nMsg,
POINT pt )
virtual
185{
186 // Save the mouse position...
187 // (this may be used by MenuCommon to detect where on the
188 // item you clicked, e.g. for integer editing items)
189 m_mousePos.x = pt.x;
190 m_mousePos.y = pt.y;
191
192 //====================
193
194 RECT r;
195 GetItemRect(&r);
196
197 if (PtInRect(&r, pt))
198 {
199 m_nLastMouseButton = nMsg;
200
201 switch (nMsg)
202 {
203 case WM_LBUTTONDOWN:
204 case WM_RBUTTONDOWN:
205 {
207 break;
208 }
209
210 case WM_LBUTTONUP:
211 case WM_NCLBUTTONUP:
212 {
214 Invoke(1);
215 break;
216 }
217
218 case WM_RBUTTONUP:
219 case WM_NCRBUTTONUP:
220 {
222// if ((itemType == MENUITEM_HEADER) && (GetAsyncKeyState(VK_MENU) & 0x8000)) m_pParent->TogglePinned();
223 if ((itemType == MENUITEM_HEADER || itemType == MENUITEM_FOOTER) && (GetAsyncKeyState(VK_MENU) & 0x8000)) m_pParent->TogglePinned();
224 else Invoke(2);
225 break;
226 }
227
228 case WM_MBUTTONUP:
229 case WM_NCMBUTTONUP:
230 case WM_LBUTTONDBLCLK:
231 case WM_NCLBUTTONDBLCLK:
232 {
233 // Mid click or left doubleclick on menu title or grip
234 // -> Toggle pinned state for the menu...
235// if (itemType == MENUITEM_HEADER) m_pParent->TogglePinned();
236 if (itemType == MENUITEM_HEADER || itemType == MENUITEM_FOOTER) m_pParent->TogglePinned();
237 else Invoke(3);
238 break;
239 }
240
241 case WM_MOUSEMOVE:
242 case WM_NCMOUSEMOVE:
243 {
244 Active(true);
245 break;
246 }
247
248 default:
249 break;
250 }
251 }
252 else Active(false);
253}
virtual bool Active(bool bActive)
Definition MenuItem.cpp:257
int m_nLastMouseButton
Definition MenuItem.h:192
POINT m_mousePos
Definition MenuItem.h:176
virtual void GetItemRect(RECT *r)
Definition MenuItem.cpp:404
void ItemSetTimer()
Definition MenuItem.cpp:330
virtual void Invoke(int button)
Definition MenuItem.cpp:371

◆ Invoke()

void MenuItem::Invoke ( int button)
virtual

Reimplemented in SpecialFolder, and StringItem.

372{
373 if ((itemType == MENUITEM_HEADER) && (button == 2))
374 {
375// if (!m_pParent->IsPinned()) pMenuCommon->Hide();
376// else if (m_pParent->m_pszFolderPath != NULL)
377 if (m_pParent->m_pszFolderPath != NULL)
378 {
379 // ##### TODO: Move to MenuCommon along with similar code in SpecialFolder.cpp #####
380 char folder[MAX_LINE_LENGTH], arg[MAX_LINE_LENGTH];
381 strcpy(folder, m_pParent->m_pszFolderPath);
382
383 if (strchr(folder, '|'))
384 {
385 // If this is a merged [path] item we use
386 // the first path when right clicking on it...
387 Tokenize(folder, arg, "|");
388 strcpy(folder, arg); // Note: Just using arg as a temp variable here...
389 }
390
391 if (folder[0] == '\"') StrRemoveEncap(folder);
392 strcpy(arg, "/e,");
393 strcat(arg, folder);
394
395 BBExecute(GetDesktopWindow(), NULL, "explorer.exe", arg, folder, SW_SHOWNORMAL, false);
397 }
398 }
400}
LPSTR Tokenize(LPCSTR string, LPSTR buf, LPSTR delims)
Definition BBApi.cpp:273
MenuCommon * pMenuCommon
Definition Blackbox.cpp:41
LPSTR StrRemoveEncap(LPSTR string)
Definition BBApi.cpp:406
HINSTANCE BBExecute(HWND Owner, LPCSTR szOperation, LPCSTR szCommand, LPCSTR szArgs, LPCSTR szDirectory, int nShowCmd, bool noErrorMsgs)
Definition BBApi.cpp:1648
void PlaySoundFX(int sound)
Definition Sounds.cpp:40
@ SFX_MENU_CLICK
Definition Sounds.h:45
void Invoke(MenuItem *item, int button)
Definition MenuCommon.cpp:1150

◆ Active()

bool MenuItem::Active ( bool bActive)
virtual

Reimplemented in BroamMenu, ConsoleMenu, DesktopMenu, DockMenu, FolderItem, GlobalConfig, HotkeysMenu, MenuConfig, PluginBroamList, PluginMenu, SpecialFolder, StringItem, TaskbarMenu, ToolbarMenu, UnloadPluginMenu, and WorkspacesMenuItem.

258{
259 if (itemType != MENUITEM_COMMAND && bActive) pPreviewItem->Hide();
260
263 {
264 return false;
265 }
266
267 //====================
268
269 // Has the menu item active state changed?
270 if (m_bActive != bActive)
271 {
272 if (bActive)
273 {
274 // We only redraw the window when a new item becomes *active*...
275 // (i.e. to avoid double redraws as active state moves from one item to another)
277 m_bActive = true;
278 m_pParent->UpdateMenuWindow();
279
280 // Should we also display an image preview for the new active item?
281 if (bActive && (itemType == MENUITEM_COMMAND) && !_stricmp(m_pszCommand, "[exec]"))
282 {
283 char path[MAX_PATH];
284 strcpy(path, m_pszArgument);
285 if (strchr(path, '\"')) StrRemoveEncap(path);
286 if (strchr(path, '$')) ReplaceShellFolders(path);
287 if (strchr(path, '%')) ReplaceEnvVars(path);
288 int pointer = strlen(path) - 4;
289
290 if ((path[1] == ':') && (pointer > 0))
291 {
292 if (!_stricmp(&path[pointer], ".jpg") || !_stricmp(&path[pointer], ".png") || !_stricmp(&path[pointer], ".bmp") || !_stricmp(&path[pointer], "jpeg"))
293 {
294 int screenWidth = GetSystemMetrics(SM_CXSCREEN);
295 int previewItemWidth = pPreviewItem->GetWidth();
296
297 RECT parentRect;
298 GetWindowRect(m_pParent->GetWindow(), &parentRect);
299
300 int gap = 2 * pSettings->scalingFactorHiDPI;
301
302 int x = parentRect.right + gap;
303 int y = parentRect.top + m_nTop + (m_nHeight / 2);
304
305 // If there isn't enough space for the preview item on the right hand
306 // side of the parent menu, we move it to the left hand side instead...
307 if ((x + previewItemWidth) > screenWidth) x = parentRect.left - gap - previewItemWidth;
308
309 pPreviewItem->Show(x, y, path);
310 }
311 else pPreviewItem->Hide();
312 }
313 else pPreviewItem->Hide();
314 }
315 }
316 else m_bActive = false;
317 }
318
319 //====================
320
321 if (!m_bActive) ItemKillTimer();
322
323 //====================
324
325 return m_bActive;
326}
void ReplaceEnvVars(LPSTR string)
Definition BBApi.cpp:2594
void ReplaceShellFolders(LPSTR string)
Definition BBApi.cpp:2633
PreviewItem * pPreviewItem
Definition Blackbox.cpp:45
#define MENUITEM_MARGINPAD
Definition MenuItem.h:39
#define MENUITEM_NOP
Definition MenuItem.h:46
#define MENUITEM_SEPARATOR
Definition MenuItem.h:47
bool FindActiveAndDeactivate(Menu *m, bool repaint)
Definition MenuCommon.cpp:2459
void Show(int x, int y, char *path)
Definition PreviewItem.cpp:299
void Hide()
Definition PreviewItem.cpp:316
int GetWidth()
Definition PreviewItem.cpp:326
int scalingFactorHiDPI
Definition Settings.h:327

◆ IsActive()

virtual bool MenuItem::IsActive ( )
virtual
77{ return m_bActive; };

◆ GetSortString()

virtual char * MenuItem::GetSortString ( )
virtual
79{ return m_pszTitleANSI; };

◆ GetItemRect()

void MenuItem::GetItemRect ( RECT * r)
virtual
405{
406 r->left = m_nLeft;
407 r->top = m_nTop;
408 r->right = m_nLeft + m_nWidth;
409 r->bottom = m_nTop + m_nHeight;
410}
int m_nLeft
Definition MenuItem.h:183

◆ GetTitleRect()

void MenuItem::GetTitleRect ( RECT * r)
virtual
415{
416 if (itemType == MENUITEM_HEADER || itemType == MENUITEM_FOOTER) // Header and grip items
417 {
418// r->left = m_nLeft + pSettings->MenuTitle->borderWidth + pSettings->bevelWidth + 2;
419 r->left = m_nLeft + pSettings->MenuTitle->borderWidth + 3;
420 r->top = m_nTop;
421// r->right = m_nLeft + m_nWidth - pSettings->MenuTitle->borderWidth - pSettings->bevelWidth - 2;
422 r->right = m_nLeft + m_nWidth - pSettings->MenuTitle->borderWidth - 3;
423 r->bottom = m_nTop + m_nHeight;
424 if (!_stricmp(pSettings->MenuTitle->Font, "nu")) r->bottom--;
425 }
426 else // Normal items
427 {
428 r->left = m_nLeft + pMenuCommon->m_nLeftIndent;
429 r->top = m_nTop;
431 r->bottom = m_nTop + m_nHeight;
432 }
433}
int m_nRightIndent
Definition MenuCommon.h:111
int m_nLeftIndent
Definition MenuCommon.h:110
StyleItem * MenuTitle
Definition Settings.h:433
int borderWidth
Definition BBApi.h:417
char Font[128]
Definition BBApi.h:413

◆ GetDrawTextFormat()

UINT MenuItem::GetDrawTextFormat ( )
virtual
438{
439 if (itemType == MENUITEM_HEADER) // Header items
440 return pSettings->MenuTitle->Justify | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS | DT_NOCLIP;
441 if (itemType == MENUITEM_FOOTER) // Grip items
442 return pSettings->MenuGrip->Justify | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS | DT_NOCLIP;
443 else // Normal items
444 return pSettings->MenuFrame->Justify | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS | DT_NOCLIP;
445}
StyleItem * MenuFrame
Definition Settings.h:434
StyleItem * MenuGrip
Definition Settings.h:436
int Justify
Definition BBApi.h:411

◆ SetTitleANSI()

void MenuItem::SetTitleANSI ( char * pszTitleANSI)
virtual
450{
452 m_pszTitleANSI = NULL;
453 m_pszTitleANSI = pszTitleANSI ? _strdup(pszTitleANSI) : _strdup("");;
454}

◆ SetTitleUnicode()

void MenuItem::SetTitleUnicode ( wchar_t * pszTitleUnicode)
virtual
457{
459 m_pszTitleUnicode = NULL;
460 m_pszTitleUnicode = pszTitleUnicode ? _wcsdup(pszTitleUnicode) : _wcsdup(L"");;
461}

◆ AddToSelectionGroup()

void MenuItem::AddToSelectionGroup ( int group)
535{
536 m_selectionGroup = group;
537}

◆ ItemSetTimer()

void MenuItem::ItemSetTimer ( )
331{
332 if (m_nTimerId == 0)
333 {
334 // Wait 500 milliseconds until we start changing the value...
335// SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_WARNING_MESSAGE, (LPARAM)"Setting timer...");
336 m_nTimerId = (UINT)this;
337 SetTimer(GetWindow(), m_nTimerId, 500, NULL);
338 }
339}
virtual HWND GetWindow()
Definition MenuItem.cpp:472

◆ Timer()

void MenuItem::Timer ( int nTimer)
virtual

Reimplemented in FolderItem, and WorkspacesMenuItem.

344{
345 // Execute timer messages...
346 if ((UINT)nTimer == m_nTimerId)
347 {
348 // Update value and reset timer to 100 milliseconds...
349// SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_WARNING_MESSAGE, (LPARAM)this->m_pszTitle);
350 KillTimer(GetWindow(), m_nTimerId);
351 if (m_nLastMouseButton == WM_RBUTTONDOWN) pMenuCommon->Invoke(this, 2);
352 else pMenuCommon->Invoke(this, 1);
353 SetTimer(GetWindow(), m_nTimerId, 100, NULL);
354 }
355}

◆ ItemKillTimer()

void MenuItem::ItemKillTimer ( )
360{
361 if (m_nTimerId != 0)
362 {
363// SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_WARNING_MESSAGE, (LPARAM)"Killing timer...");
364 KillTimer(GetWindow(), m_nTimerId);
365 m_nTimerId = 0;
366 }
367}

◆ SetWidth()

virtual void MenuItem::SetWidth ( int nWidth)
virtual
119{ m_nWidth = nWidth; };

◆ GetWidth()

virtual int MenuItem::GetWidth ( )
virtual
120{ return m_nWidth; };

◆ SetHeight()

virtual void MenuItem::SetHeight ( int nHeight)
virtual
121{ m_nHeight = nHeight; };

◆ GetHeight()

virtual int MenuItem::GetHeight ( )
virtual
122{ return m_nHeight; };

◆ SetPosition()

virtual void MenuItem::SetPosition ( int nLeft,
int nTop )
virtual
125{ m_nLeft = nLeft; m_nTop = nTop; };

◆ SetSortPriority()

virtual void MenuItem::SetSortPriority ( int nSortPriority)
virtual
131{ m_nSortPriority = nSortPriority; };
int m_nSortPriority
Definition MenuItem.h:178

◆ GetSortPriority()

virtual int MenuItem::GetSortPriority ( )
virtual
135{ return m_nSortPriority; };

◆ Compare()

bool MenuItem::Compare ( MenuItem * pM1,
MenuItem * pM2 )
static
492{
493 // Menu item priorities:
494 // MENUITEM_HEADER -> 255
495 // MENUITEM_MARGINPAD (top) -> 254
496 // MENUITEM_FOLDER -> 4
497 // MENUITEM_SEPARATOR -> 3
498 // === Regular items === -> 2
499 // MENUITEM_MARGINPAD (bottom) -> 1
500 // MENUITEM_FOOTER -> 0
501
502 int m1_sort = m1->GetSortPriority();
503 int m2_sort = m2->GetSortPriority();
504
505 if (m1_sort == m2_sort)
506 {
507 if (m1->m_pszTitleUnicode != NULL)
508 {
509 if (m2->m_pszTitleUnicode != NULL) return _wcsicmp(m1->m_pszTitleUnicode, m2->m_pszTitleUnicode) < 0; // -> Both m1 and m2 are Unicode items, do a regular string compare...
510 else return true; // -> m1 being a Unicode item is sorted before m2 being an ANSI item...
511 }
512 else if (m2->m_pszTitleUnicode != NULL) return false;
513 else return _stricmp(m1->GetSortString(), m2->GetSortString()) < 0; // -> Both m1 and m2 are ANSI items, do a regular string compare...
514 }
515 else return m1_sort > m2_sort;
516}

◆ Attached()

void MenuItem::Attached ( Menu * pMenu)
virtual

◆ Command()

LRESULT MenuItem::Command ( WPARAM wParam,
LPARAM lParam )
virtual
481{
482 return 0;
483}

◆ OnUser()

virtual bool MenuItem::OnUser ( int nMessage,
WPARAM wParam,
LPARAM lParam,
LRESULT & lResult )
virtual
151{ return false; }

◆ Moving()

virtual void MenuItem::Moving ( )
virtual
164{;};

◆ GetWindow()

HWND MenuItem::GetWindow ( )
virtual
473{
474 if (m_pParent) return m_pParent->GetWindow();
475 else return NULL;
476}

◆ ToggleSelected()

void MenuItem::ToggleSelected ( )
524{
525 if (m_isSelected) m_isSelected = false;
526 else m_isSelected = true;
527}

Member Data Documentation

◆ m_pszTitleANSI

char* MenuItem::m_pszTitleANSI

◆ m_pszTitleUnicode

wchar_t* MenuItem::m_pszTitleUnicode

◆ itemType

int MenuItem::itemType

◆ m_pszCommand

char* MenuItem::m_pszCommand

◆ m_pszArgument

char* MenuItem::m_pszArgument

◆ m_pszOriginalTitleANSI

char* MenuItem::m_pszOriginalTitleANSI

◆ m_pszOriginalTitleUnicode

wchar_t* MenuItem::m_pszOriginalTitleUnicode

◆ m_isSelected

bool MenuItem::m_isSelected

◆ m_selectionGroup

int MenuItem::m_selectionGroup

◆ m_currentValue

int MenuItem::m_currentValue

◆ m_minValue

int MenuItem::m_minValue

◆ m_maxValue

int MenuItem::m_maxValue

◆ m_mousePos

POINT MenuItem::m_mousePos

◆ m_nSortPriority

int MenuItem::m_nSortPriority

◆ m_pParent

Menu* MenuItem::m_pParent

◆ m_pSubMenu

Menu* MenuItem::m_pSubMenu

◆ m_nLeft

int MenuItem::m_nLeft

◆ m_nTop

int MenuItem::m_nTop

◆ m_nWidth

int MenuItem::m_nWidth

◆ m_nHeight

int MenuItem::m_nHeight

◆ m_bActive

bool MenuItem::m_bActive

◆ m_nTimerId

UINT MenuItem::m_nTimerId

◆ m_nLastMouseButton

int MenuItem::m_nLastMouseButton