summaryrefslogtreecommitdiffstats
path: root/gui/polkit-tqt-gui-actionbuttons.h
blob: 43b80bb93b54bcae2ab54c3eb323f78532ccccae (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
 * This file is part of the Polkit-tqt project
 * Copyright (C) 2009 Dario Freddi <drf@kde.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB. If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef POLKIT_TQT_GUI_ACTIONBUTTONS_H
#define POLKIT_TQT_GUI_ACTIONBUTTONS_H

#include "polkit-tqt-gui-actionbutton.h"


namespace PolkitTQt
{

namespace Gui
{

class ActionButtonsPrivate;

/**
 * \class ActionButtons polkit-tqt-gui-actionbuttons.h ActionButtons
 * \author Dario Freddi <drf@kde.org>
 *
 * \brief Class used to hold and update a list of TQButtons
 *
 * This class is a convenience wrapper around ActionButton that lets
 * you associate an undefined number of TQButtons with a single action.
 * Every button will be updated accordingly upon action's properties changes.
 *
 * \see ActionButton
 */
class ActionButtons : public ActionButton
{
  Q_OBJECT

  public:
    /**
     * Constructs a new ActionButtons. You need to pass this
     * constructor an existing list of TQButtons, whose properties
     * will be modified according to the underlying Action
     * object. As ActionButtons inherits from Action, you can
     * define your buttons' behavior right through this wrapper.
     *
     * \see Action
     *
     * \param buttons the TQButton to associate to this ActionButtons
     * \param actionId the action Id to create the underlying Action
     * \param parent the parent object
     */
    explicit ActionButtons(TQValueList<TQButton*> &buttons,
            const TQString &actionId = TQString::null, TQObject *parent = nullptr);
    virtual ~ActionButtons();

    /**
     * Sets a list of buttons associated to the underlying action.
     *
     * \note If you are calling this function, you're probably
     *       changing the buttons list the action is referring to. If this
     *       is the case, please note that Polkit-TQt does not handle
     *       the previous buttons' memory, so you should take care of
     *       deleting them yourself (if needed). You can retrieve it by
     *       using buttons()
     *
     * \see buttons
     *
     * \param buttons the new buttons associated with the underlying action
     */
    void setButtons(TQValueList<TQButton*> &buttons);

    /**
     * Returns the current buttons list
     *
     * \return the buttons currently associated with the underlying action
     */
    TQValueList<TQButton*> buttons() const;

    /**
     * Adds a button to the current button list. The button's properties
     * will be updated according to the action upon adding.
     *
     * \param button the button to add
     */
    void addButton(TQButton *button);

    /**
     * Removes a button from the current list. Please note that Polkit-TQt
     * does not handle the removed button's memory, so you should take care of
     * deleting it yourself (if needed).
     *
     * \param button the button to remove
     */
    void removeButton(TQButton *button);

  private:
    // Disable copy
    ActionButtons(const ActionButtons&);
    ActionButtons& operator=(const ActionButtons&);
};

}

}

#endif