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

#include <FolderItem.h>

Public Member Functions

 FolderItem (Menu *pSubMenu, char *pszTitleANSI, wchar_t *pszTitleUnicode)
 
virtual ~FolderItem ()
 
void Attached (Menu *pMenu)
 
bool Active (bool bActivate)
 
void Invoke ()
 
void Timer (int nTimer)
 
void ShowSubMenu ()
 
- Public Member Functions inherited from MenuItem
 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 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 ()
 
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 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 ()
 

Public Attributes

UINT m_nTimerId
 
- Public Attributes inherited from MenuItem
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
 

Additional Inherited Members

- Static Public Member Functions inherited from MenuItem
static bool Compare (MenuItem *pM1, MenuItem *pM2)
 

Constructor & Destructor Documentation

◆ FolderItem()

FolderItem::FolderItem ( Menu * pSubMenu,
char * pszTitleANSI,
wchar_t * pszTitleUnicode )
43 : MenuItem(MENUITEM_FOLDER, pszTitleANSI, pszTitleUnicode, NULL, NULL, false)
44{
45 m_pSubMenu = pSubMenu;
46 m_nTimerId = 0;
48}
#define PRIORITY_FOLDER
Definition MenuItem.h:55
#define MENUITEM_FOLDER
Definition MenuItem.h:48
UINT m_nTimerId
Definition FolderItem.h:57
virtual void SetSortPriority(int nSortPriority)
Definition MenuItem.h:131
MenuItem(int type, char *pszTitleANSI, wchar_t *pszTitleUnicode, char *pszCommand, char *pszArgument, bool isSelected)
Definition MenuItem.cpp:42
Menu * m_pSubMenu
Definition MenuItem.h:181

◆ ~FolderItem()

FolderItem::~FolderItem ( )
virtual
51{
52 m_pParent->RemoveChild(m_pSubMenu);
53 if (m_pSubMenu) delete m_pSubMenu;
54 m_pSubMenu = NULL;
55}
Menu * m_pParent
Definition MenuItem.h:180

Member Function Documentation

◆ Attached()

void FolderItem::Attached ( Menu * pMenu)
virtual

Reimplemented from MenuItem.

Reimplemented in GlobalConfig, HotkeysMenu, MenuConfig, PluginBroamList, PluginMenu, SpecialFolder, TaskbarMenu, ToolbarMenu, UnloadPluginMenu, and WorkspacesMenuItem.

60{
62
63 m_pParent->AddChild(m_pSubMenu);
64 m_pSubMenu->SetParent(m_pParent);
65}
Menu * pMenu
Definition Blackbox.cpp:40
virtual void Attached(Menu *pMenu)
Definition MenuItem.cpp:465

◆ Active()

bool FolderItem::Active ( bool bActivate)
virtual

Reimplemented from MenuItem.

Reimplemented in GlobalConfig, HotkeysMenu, MenuConfig, PluginBroamList, PluginMenu, SpecialFolder, TaskbarMenu, ToolbarMenu, UnloadPluginMenu, and WorkspacesMenuItem.

77{
78 bool result = MenuItem::Active(bActivate);
79
80 if (bActivate)
81 {
82 if (!IsWindowVisible(m_pSubMenu->GetWindow()) && m_nTimerId == 0)
83 {
84 m_nTimerId = (UINT)this;
85 SetTimer(GetWindow(), m_nTimerId, pSettings->submenuDelay, NULL);
86 }
87 }
88 else
89 {
90 if (m_nTimerId != 0) KillTimer(GetWindow(), m_nTimerId);
91 m_nTimerId = 0;
92
93 if (m_pSubMenu != NULL)
94 {
95 if (IsWindowVisible(m_pSubMenu->GetWindow())) m_pSubMenu->Hide(HIDE_CHILDREN);
96 }
97 }
98
99 return result;
100}
Settings * pSettings
Definition Blackbox.cpp:46
#define HIDE_CHILDREN
Definition Menu.h:39
virtual bool Active(bool bActive)
Definition MenuItem.cpp:257
virtual HWND GetWindow()
Definition MenuItem.cpp:472
int submenuDelay
Definition Settings.h:183

◆ Invoke()

void FolderItem::Invoke ( )
70{
71 Active(true);
72}
bool Active(bool bActivate)
Definition FolderItem.cpp:76

◆ Timer()

void FolderItem::Timer ( int nTimer)
virtual

Reimplemented from MenuItem.

Reimplemented in WorkspacesMenuItem.

108{
109 if ((UINT)nTimer == m_nTimerId)
110 {
111 ShowSubMenu();
112 KillTimer(GetWindow(), m_nTimerId);
113 m_nTimerId = 0;
114 }
115}
void ShowSubMenu()
Definition FolderItem.cpp:119

◆ ShowSubMenu()

void FolderItem::ShowSubMenu ( )
120{
121 if (m_pSubMenu->IsPinned()) return;
122
123 //====================
124
125 RECT r;
126 RECT s;
127 RECT screen;
128 RECT rParent;
129 Menu* pParent;
130 int subMenuX, subMenuY;
131 int subMenuWidth, subMenuHeight;
132
133 //====================
134
135 // Current menu...
136 GetWindowRect(GetWindow(), &r);
137
138 // Get the dimensions of the monitor where the current menu is located...
139 POINT pt = {r.left, r.top};
140 HMONITOR hMon = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);
141
142 MONITORINFO mi;
143 mi.cbSize = sizeof(mi);
144
145 if (GetMonitorInfo(hMon, &mi))
146 {
147 screen.left = mi.rcMonitor.left;
148 screen.top = mi.rcMonitor.top;
149 screen.right = mi.rcMonitor.right;
150 screen.bottom = mi.rcMonitor.bottom;
151 }
152 else
153 {
154 screen.left = 0;
155 screen.top = 0;
156 screen.right = GetSystemMetrics(SM_CXVIRTUALSCREEN);
157 screen.bottom = GetSystemMetrics(SM_CYVIRTUALSCREEN);
158 }
159
160 //====================
161
162 // Submenu...
163 GetWindowRect(m_pSubMenu->GetWindow(), &s);
164 subMenuWidth = s.right - s.left;
165 subMenuHeight = s.bottom - s.top;
166
167 // Parent menu...
168 pParent = m_pParent->GetParent();
169 if (pParent) GetWindowRect(pParent->GetWindow(), &rParent);
170 else
171 {
172 // Fallbacks if the current menu has no parent...
173 rParent.left = screen.left;
174 rParent.top = screen.top;
175 }
176
177 //====================
178
179 // By default we try opening submenus in the same direction
180 // as the current menu was opened (if it too has a parent)...
181 if (rParent.left < r.left)
182 {
183 // Parent menu to the left of the current menu or no parent menu
184 // -> default submenu position to the right of the current menu
185// subMenuX = r.right - pSettings->MenuFrame->borderWidth - pSettings->MenuFrame->marginWidth;
186 subMenuX = r.right - pSettings->MenuFrame->borderWidth;
188
189 // If the submenu is partly or fully off screen we
190 // move it to the left of the current menu instead...
191 if ((subMenuX + subMenuWidth) > screen.right)
192 {
193// subMenuX = r.left - subMenuWidth + pSettings->menuBorderWidth + pSettings->MenuFrame->marginWidth;
194 subMenuX = r.left - subMenuWidth + pSettings->MenuFrame->borderWidth;
196 }
197 }
198 else
199 {
200 // Parent menu to the right of the current menu
201 // -> default submenu position to the left of the current menu
202// subMenuX = r.left - subMenuWidth + pSettings->menuBorderWidth + pSettings->MenuFrame->marginWidth;
203 subMenuX = r.left - subMenuWidth + pSettings->MenuFrame->borderWidth;
205
206 // If the submenu is partly or fully off screen we
207 // move it to the right of the current menu instead...
208 if (subMenuX < screen.left)
209 {
210 subMenuX = r.right - pSettings->MenuFrame->borderWidth;
212 }
213 }
214
215 // Calculating the y position is slightly easier... :)
216// subMenuY = r.top + m_nTop - pMenuCommon->m_nTitleHeight - pSettings->MenuFrame->marginWidth - pSettings->MenuFrame->borderWidth;
218 // Check if *only* the legacy menu.borderWidth was defined...
220 {
221 // ...and if so do nothing... (I think ;))
222 }
223 // ...otherwise adjust the y position as applicable for modern syntax rendering... (including support for the bbLean menu title/frame borders bug/feature, see Menu.cpp)
225
226 if (subMenuY < screen.top) subMenuY = screen.top;
227 if ((subMenuY + subMenuHeight) > screen.bottom) subMenuY = screen.bottom - subMenuHeight;
228
229 //====================
230
231 // Move focus to the newly shown submenu..
232 SetForegroundWindow(GetWindow());
233
234 m_pSubMenu->Show(subMenuX, subMenuY);
235 SendMessage(GetBBWnd(), BB_SUBMENU, 0, 0);
237}
MenuCommon * pMenuCommon
Definition Blackbox.cpp:41
HWND GetBBWnd()
Definition BBApi.cpp:128
#define BB_SUBMENU
Definition BBApi.h:168
void PlaySoundFX(int sound)
Definition Sounds.cpp:40
@ SFX_MENU_SUBFOLDER
Definition Sounds.h:44
int m_nTitleHeight
Definition MenuCommon.h:102
bool m_nTitleDisabled
Definition MenuCommon.h:103
HWND GetWindow()
Definition Menu.cpp:1183
int m_nTop
Definition MenuItem.h:184
StyleItem * MenuFrame
Definition Settings.h:434
int submenuGap
Definition Settings.h:182
StyleItem * MenuTitle
Definition Settings.h:433
bool menuRoundedCorners
Definition Settings.h:176
StyleItem * MenuFrameBorder
Definition Settings.h:441
int menuBorderWidth
Definition Settings.h:560
int borderWidth
Definition BBApi.h:417
bool parentRelative
Definition BBApi.h:403
int marginWidth
Definition BBApi.h:416

Member Data Documentation

◆ m_nTimerId

UINT FolderItem::m_nTimerId