summaryrefslogtreecommitdiff
path: root/ui/mouse_move_dlg.cpp
blob: efaba5fc7e9488223eb4922eebb516f75a215771 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// **************************************************************************
// * This file is part of the FreeFileSync project. It is distributed under *
// * GNU General Public License: http://www.gnu.org/licenses/gpl.html       *
// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de)                    *
// **************************************************************************
//
#include "mouse_move_dlg.h"
#include <wx/msw/wrapwin.h> //includes "windows.h"

using namespace ffs3;


MouseMoveWindow::MouseMoveWindow(wxWindow& parent,
                                 wxWindow* child1,
                                 wxWindow* child2,
                                 wxWindow* child3,
                                 wxWindow* child4,
                                 wxWindow* child5,
                                 wxWindow* child6) : wxWindow(&parent, wxID_ANY)
{
    if (child1) child1->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(MouseMoveWindow::LeftButtonDown), NULL, this);
    if (child2) child2->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(MouseMoveWindow::LeftButtonDown), NULL, this);
    if (child3) child3->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(MouseMoveWindow::LeftButtonDown), NULL, this);
    if (child4) child4->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(MouseMoveWindow::LeftButtonDown), NULL, this);
    if (child5) child5->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(MouseMoveWindow::LeftButtonDown), NULL, this);
    if (child6) child6->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(MouseMoveWindow::LeftButtonDown), NULL, this);

    Hide(); //this is just a dummy window so that its parent can have ownership
    Disable();
}


void MouseMoveWindow::LeftButtonDown(wxMouseEvent& event)
{
    if (!GetParent())
        return;

    ::ReleaseCapture();
    //::SendMessage(GetHwndOf(dialogToMove_), WM_NCLBUTTONDOWN, HTCAPTION, 0);
    ::SendMessage(static_cast<HWND>(GetParent()->GetHWND()), WM_NCLBUTTONDOWN, HTCAPTION, 0);

    //event.Skip(); -> swallow event, to avoid other windows losing focus
}
bgstack15