void NativeTextfieldWin::OnLButtonDblClk(UINT keys, const gfx::Point& point)
    {
        // Save the double click info for later triple-click detection.
        tracking_double_click_ = true;
        double_click_point_ = point;
        double_click_time_ = GetCurrentMessage()->time;

        ScopedFreeze freeze(this, GetTextObjectModel());
        OnBeforePossibleChange();
        DefWindowProc(WM_LBUTTONDBLCLK, keys,
            MAKELPARAM(ClipXCoordToVisibleText(point.x(), false), point.y()));
        OnAfterPossibleChange(true);
    }
void GanttViewMenuController::ShowContextMenuForView(
    view::View* source,
    const gfx::Point& p,
    bool is_mouse_gesture)
{
    scoped_ptr<view::Menu> menu(view::Menu::Create(this,
        view::Menu::TOPLEFT, source->GetWidget()->GetNativeView()));
    menu->AppendMenuItem(GANTTVIEWCONTEXTMENUCOMMAND_EDIT, L"指针模式",
        view::Menu::RADIO);
    menu->AppendMenuItem(GANTTVIEWCONTEXTMENUCOMMAND_CREATE_BAR,
        L"创建节点模式", view::Menu::RADIO);
    menu->AppendMenuItem(GANTTVIEWCONTEXTMENUCOMMAND_CREATE_LINK,
        L"创建链接模式", view::Menu::RADIO);
    menu->RunMenuAt(p.x(), p.y());
}
    void NativeTextfieldWin::OnLButtonDown(UINT keys, const gfx::Point& point)
    {
        // Check for triple click, then reset tracker.  Should be safe to subtract
        // double_click_time_ from the current message's time even if the timer has
        // wrapped in between.
        const bool is_triple_click = tracking_double_click_ &&
            IsDoubleClick(double_click_point_.ToPOINT(), point.ToPOINT(),
            GetCurrentMessage()->time-double_click_time_);
        tracking_double_click_ = false;

        ScopedFreeze freeze(this, GetTextObjectModel());
        OnBeforePossibleChange();
        DefWindowProc(WM_LBUTTONDOWN, keys,
            MAKELPARAM(ClipXCoordToVisibleText(point.x(), is_triple_click),
            point.y()));
        OnAfterPossibleChange(true);
    }
Exemplo n.º 4
0
void DraggedTabView::MoveTo(const gfx::Point& screen_point)
{
    int x;
    if(base::i18n::IsRTL())
    {
        // On RTL locales, a dragged tab (when it is not attached to a tab strip)
        // is rendered using a right-to-left orientation so we should calculate the
        // window position differently.
        gfx::Size ps = GetPreferredSize();
        x = screen_point.x() + ScaleValue(mouse_tab_offset_.x() - ps.width());
    }
    else
    {
        x = screen_point.x() - ScaleValue(mouse_tab_offset_.x());
    }
    int y = screen_point.y() - ScaleValue(mouse_tab_offset_.y());

    // TODO(beng): make this cross-platform
    int show_flags = container_->IsVisible() ? SWP_NOZORDER : SWP_SHOWWINDOW;
    SetWindowPos(container_->GetNativeView(), HWND_TOP, x, y, 0, 0,
                 SWP_NOSIZE | SWP_NOACTIVATE | show_flags);
}