本文整理汇总了C++中MouseMessage::modifiers方法的典型用法代码示例。如果您正苦于以下问题:C++ MouseMessage::modifiers方法的具体用法?C++ MouseMessage::modifiers怎么用?C++ MouseMessage::modifiers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MouseMessage
的用法示例。
在下文中一共展示了MouseMessage::modifiers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onProcessMessage
bool IntEntry::onProcessMessage(Message* msg)
{
switch (msg->type()) {
// Reset value if it's out of bounds when focus is lost
case kFocusLeaveMessage:
setValue(MID(m_min, getValue(), m_max));
deselectText();
break;
case kMouseDownMessage:
requestFocus();
captureMouse();
openPopup();
selectAllText();
return true;
case kMouseMoveMessage:
if (hasCapture()) {
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
Widget* pick = getManager()->pick(mouseMsg->position());
if (pick == &m_slider) {
releaseMouse();
MouseMessage mouseMsg2(kMouseDownMessage,
mouseMsg->buttons(),
mouseMsg->modifiers(),
mouseMsg->position());
m_slider.sendMessage(&mouseMsg2);
}
}
break;
case kMouseWheelMessage:
if (isEnabled()) {
int oldValue = getValue();
int newValue = oldValue
+ static_cast<MouseMessage*>(msg)->wheelDelta().x
- static_cast<MouseMessage*>(msg)->wheelDelta().y;
newValue = MID(m_min, newValue, m_max);
if (newValue != oldValue) {
setValue(newValue);
selectAllText();
}
return true;
}
break;
case kKeyDownMessage:
if (hasFocus() && !isReadOnly()) {
KeyMessage* keymsg = static_cast<KeyMessage*>(msg);
int chr = keymsg->unicodeChar();
if (chr < '0' || chr > '9') {
// By-pass Entry::onProcessMessage()
return Widget::onProcessMessage(msg);
}
}
break;
}
return Entry::onProcessMessage(msg);
}
示例2: onProcessMessage
bool IntEntry::onProcessMessage(Message* msg)
{
switch (msg->type()) {
// Reset value if it's out of bounds when focus is lost
case kFocusLeaveMessage:
setValue(MID(m_min, getValue(), m_max));
deselectText();
break;
case kMouseDownMessage:
requestFocus();
captureMouse();
openPopup();
selectAllText();
return true;
case kMouseMoveMessage:
if (hasCapture()) {
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
Widget* pick = manager()->pick(mouseMsg->position());
if (pick == &m_slider) {
releaseMouse();
MouseMessage mouseMsg2(kMouseDownMessage,
mouseMsg->pointerType(),
mouseMsg->buttons(),
mouseMsg->modifiers(),
mouseMsg->position());
m_slider.sendMessage(&mouseMsg2);
}
}
break;
case kMouseWheelMessage:
if (isEnabled()) {
int oldValue = getValue();
int newValue = oldValue
+ static_cast<MouseMessage*>(msg)->wheelDelta().x
- static_cast<MouseMessage*>(msg)->wheelDelta().y;
newValue = MID(m_min, newValue, m_max);
if (newValue != oldValue) {
setValue(newValue);
selectAllText();
}
return true;
}
break;
case kKeyDownMessage:
if (hasFocus() && !isReadOnly()) {
KeyMessage* keymsg = static_cast<KeyMessage*>(msg);
int chr = keymsg->unicodeChar();
if (chr >= 32 && (chr < '0' || chr > '9')) {
// "Eat" all keys that aren't number
return true;
}
// Else we use the default Entry processing function which
// will process keys like Left/Right arrows, clipboard
// handling, etc.
}
break;
}
return Entry::onProcessMessage(msg);
}