summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/notewidgetcontroller.cpp
blob: 2ef8758d632327c7794d1e0cf01cea97eda19f20 (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
44
45
46
47
48
49
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   copyright (C) 2006                                                    *
 *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
 ***************************************************************************/

// app includes
#include "notewidgetcontroller.h"
#include "notewidget.h"
#include "uml.h"
#include "umldoc.h"
#include "listpopupmenu.h"

NoteWidgetController::NoteWidgetController(NoteWidget *noteWidget):
            UMLWidgetController(noteWidget) {
    m_noteWidget = noteWidget;
}

NoteWidgetController::~NoteWidgetController() {
}

void NoteWidgetController::mouseMoveEvent(TQMouseEvent *me) {
    UMLWidgetController::mouseMoveEvent(me);
    m_noteWidget->setEditorGeometry();
}

void NoteWidgetController::mouseReleaseEvent(TQMouseEvent *me) {
    UMLWidgetController::mouseReleaseEvent(me);
    //TODO why is it needed? drawText is already called in draw,
    //and draw is (well, I think that is) called when the canvas rectangle is resized
    if (m_resized) {
        m_noteWidget->drawText();
    }
}

void NoteWidgetController::doMouseDoubleClick(TQMouseEvent *me) {
    //TODO Copied from old code. What it does?
    if (m_noteWidget->m_DiagramLink == Uml::id_None) {
        m_noteWidget->slotMenuSelection(ListPopupMenu::mt_Rename);
    } else {
        UMLDoc *umldoc = UMLApp::app()->getDocument();
        umldoc->changeCurrentView(m_noteWidget->m_DiagramLink);
    }
}