本文整理汇总了C++中MouseMessage::right方法的典型用法代码示例。如果您正苦于以下问题:C++ MouseMessage::right方法的具体用法?C++ MouseMessage::right怎么用?C++ MouseMessage::right使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MouseMessage
的用法示例。
在下文中一共展示了MouseMessage::right方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onProcessMessage
bool onProcessMessage(Message* msg) override {
switch (msg->type()) {
case kSetCursorMessage:
ui::set_mouse_cursor(kArrowCursor);
return true;
case kMouseUpMessage: {
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
if (mouseMsg->right()) {
if (hasCapture()) {
releaseMouse();
Popup();
setSelected(false);
return true;
}
}
break;
}
}
return SkinButton<Button>::onProcessMessage(msg);
}
示例2: onProcessMessage
//.........这里部分代码省略.........
int textlen = base::utf8_length(getText());
int c, x;
bool move = true;
bool is_dirty = false;
// Backward scroll
if (mousePos.x < getBounds().x) {
if (m_scroll > 0) {
m_caret = --m_scroll;
move = false;
is_dirty = true;
invalidate();
}
}
// Forward scroll
else if (mousePos.x >= getBounds().x2()) {
if (m_scroll < textlen - getAvailableTextLength()) {
m_scroll++;
x = getBounds().x + this->border_width.l;
for (c=m_scroll; utf8_begin != utf8_end; ++c) {
int ch = (c < textlen ? *(utf8_begin+c) : ' ');
x += getFont()->charWidth(ch);
if (x > getBounds().x2()-this->border_width.r) {
c--;
break;
}
}
m_caret = c;
move = false;
is_dirty = true;
invalidate();
}
}
c = getCaretFromMouse(static_cast<MouseMessage*>(msg));
if (static_cast<MouseMessage*>(msg)->left() ||
(move && !isPosInSelection(c))) {
// Move caret
if (move) {
if (m_caret != c) {
m_caret = c;
is_dirty = true;
invalidate();
}
}
// Move selection
if (m_recent_focused) {
m_recent_focused = false;
m_select = m_caret;
}
else if (msg->type() == kMouseDownMessage)
m_select = m_caret;
}
// Show the caret
if (is_dirty) {
m_timer.start();
m_state = true;
}
return true;
}
break;
case kMouseUpMessage:
if (hasCapture()) {
releaseMouse();
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
if (mouseMsg->right()) {
// This flag is disabled in kFocusEnterMessage message handler.
m_lock_selection = true;
showEditPopupMenu(mouseMsg->position());
requestFocus();
}
}
return true;
case kDoubleClickMessage:
forwardWord();
m_select = m_caret;
backwardWord();
invalidate();
return true;
case kMouseEnterMessage:
case kMouseLeaveMessage:
// TODO theme stuff
if (isEnabled())
invalidate();
break;
}
return Widget::onProcessMessage(msg);
}
示例3: onProcessMessage
//.........这里部分代码省略.........
break;
}
if (cmd == EntryCmd::NoOp) {
if (keymsg->unicodeChar() >= 32) {
executeCmd(EntryCmd::InsertChar, keymsg->unicodeChar(),
(msg->shiftPressed()) ? true: false);
// Select dead-key
if (keymsg->isDeadKey()) {
if (lastCaretPos() < m_maxsize)
selectText(m_caret-1, m_caret);
}
return true;
}
// Consume all key down of modifiers only, e.g. so the user
// can press first "Ctrl" key, and then "Ctrl+C"
// combination.
else if (keymsg->scancode() >= kKeyFirstModifierScancode) {
return true;
}
else {
break; // Propagate to manager
}
}
executeCmd(cmd, keymsg->unicodeChar(),
(msg->shiftPressed()) ? true: false);
return true;
}
break;
case kMouseDownMessage:
captureMouse();
case kMouseMoveMessage:
if (hasCapture()) {
bool is_dirty = false;
int c = getCaretFromMouse(static_cast<MouseMessage*>(msg));
if (static_cast<MouseMessage*>(msg)->left() || !isPosInSelection(c)) {
// Move caret
if (m_caret != c) {
setCaretPos(c);
is_dirty = true;
invalidate();
}
// Move selection
if (m_recent_focused) {
m_recent_focused = false;
m_select = m_caret;
}
else if (msg->type() == kMouseDownMessage)
m_select = m_caret;
}
// Show the caret
if (is_dirty) {
if (shouldStartTimer(true))
m_timer.start();
m_state = true;
}
return true;
}
break;
case kMouseUpMessage:
if (hasCapture()) {
releaseMouse();
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
if (mouseMsg->right()) {
// This flag is disabled in kFocusEnterMessage message handler.
m_lock_selection = true;
showEditPopupMenu(mouseMsg->position());
requestFocus();
}
}
return true;
case kDoubleClickMessage:
forwardWord();
m_select = m_caret;
backwardWord();
invalidate();
return true;
case kMouseEnterMessage:
case kMouseLeaveMessage:
// TODO theme stuff
if (isEnabled())
invalidate();
break;
}
return Widget::onProcessMessage(msg);
}