120{
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
137
138
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
164 subMenuWidth = s.right - s.left;
165 subMenuHeight = s.bottom - s.top;
166
167
169 if (pParent) GetWindowRect(pParent->
GetWindow(), &rParent);
170 else
171 {
172
173 rParent.left = screen.left;
174 rParent.top = screen.top;
175 }
176
177
178
179
180
181 if (rParent.left < r.left)
182 {
183
184
185
188
189
190
191 if ((subMenuX + subMenuWidth) > screen.right)
192 {
193
196 }
197 }
198 else
199 {
200
201
202
205
206
207
208 if (subMenuX < screen.left)
209 {
212 }
213 }
214
215
216
218
220 {
221
222 }
223
225
226 if (subMenuY < screen.top) subMenuY = screen.top;
227 if ((subMenuY + subMenuHeight) > screen.bottom) subMenuY = screen.bottom - subMenuHeight;
228
229
230
231
233
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
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