summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/toolbarstatepool.h
blob: 9989d98e0009208aa295eae6b3bf836d7db6baf9 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/***************************************************************************
 *                                                                         *
 *   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) 2004-2006                                               *
 *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
 ***************************************************************************/

#ifndef TOOLBARSTATEPOOL_H
#define TOOLBARSTATEPOOL_H

#include "toolbarstate.h"

#include "worktoolbar.h"

/**
 * Base class for tools that can use the same state but with different button.
 * This class only adds support to specify the button currently in use for a
 * tool bar state.
 */
class ToolBarStatePool : public ToolBarState {
    Q_OBJECT
  
public:

    /**
     * Destroys this ToolBarStatePool.
     */
    virtual ~ToolBarStatePool();

    /**
     * Sets the current button and inits the tool.
     * If the current button is the same to the button to set, the tool isn't
     * initialized.
     *
     * @param button The button to set.
     */
    void setButton(const WorkToolBar::ToolBar_Buttons &button);

    /**
     * Returns the current button.
     *
     * @return The current button.
     */
    WorkToolBar::ToolBar_Buttons getButton() const {
        return m_ToolBarButton;
    }

protected:

    /**
     * Creates a new ToolBarStatePool.
     * Protected to avoid classes other than derived to create objects of this
     * class.
     *
     * @param umlView The UMLView to use.
     */
    ToolBarStatePool(UMLView *umlView);

private:

    /**
     * The current button of the tool.
     */
    WorkToolBar::ToolBar_Buttons m_ToolBarButton;

};

#endif //TOOLBARSTATEPOOL_H