本文整理汇总了C++中Monitor::X方法的典型用法代码示例。如果您正苦于以下问题:C++ Monitor::X方法的具体用法?C++ Monitor::X怎么用?C++ Monitor::X使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monitor
的用法示例。
在下文中一共展示了Monitor::X方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PositionWindow
void OSD::PositionWindow(Monitor monitor, LayeredWnd &lWnd) {
Settings::OSDPos pos = _settings->OSDPosition();
if (pos == Settings::OSDPos::Custom) {
int customX = _settings->OSDX();
int customY = _settings->OSDY();
lWnd.X(customX);
lWnd.Y(customY);
return;
}
int offset = _settings->OSDEdgeOffset();
/* Edge cases ;-) */
switch (pos) {
case Settings::TopLeft:
lWnd.X(monitor.X() + offset);
lWnd.Y(monitor.Y() + offset);
return;
case Settings::TopRight:
lWnd.X(monitor.X() + monitor.Width() - lWnd.Width() - offset);
lWnd.Y(monitor.Y() + offset);
return;
case Settings::BottomLeft:
lWnd.X(monitor.X() + offset);
lWnd.Y(monitor.Y() + monitor.Height() - lWnd.Height() - offset);
return;
case Settings::BottomRight:
lWnd.X(monitor.X() + monitor.Width() - lWnd.Width() - offset);
lWnd.Y(monitor.Y() + monitor.Height() - lWnd.Height() - offset);
return;
}
/* Center */
CenterWindowX(monitor, lWnd);
CenterWindowY(monitor, lWnd);
if (pos == Settings::OSDPos::Center) {
return;
}
/* We're centered. Now adjust based on top, bottom, left, or right: */
switch (pos) {
case Settings::Top:
lWnd.Y(monitor.Y() + offset);
return;
case Settings::Bottom:
lWnd.Y(monitor.Y() + monitor.Height() - lWnd.Height() - offset);
return;
case Settings::Left:
lWnd.X(monitor.X() + offset);
return;
case Settings::Right:
lWnd.X(monitor.X() + monitor.Width() - lWnd.Width() - offset);
return;
}
}
示例2: CenterWindowX
void OSD::CenterWindowX(Monitor monitor, LayeredWnd &lWnd) {
lWnd.X(monitor.X() + monitor.Width() / 2 - lWnd.Width() / 2);
}