# Path: flexlay/gui/icon.py
# class Icon:
# 
#     def __init__(self, action):
#         self.action = action
# 
#     def disable(self):
#         self.action.setEnabled(False)
# 
#     def enable(self):
#         self.action.setEnabled(True)
# 
#     def set_up(self):
#         self.action.setCheckable(True)
#         self.action.setChecked(False)
# 
#     def set_down(self):
#         self.action.setCheckable(True)
#         self.action.setChecked(True)


from PyQt5.QtGui import QIcon
from flexlay.gui.icon import Icon
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.





class ButtonPanel:

    def __init__(self, toolbar):
        self.toolbar = toolbar

    def add_icon(self, filename, callback, hover="Hover Text", shortcut=None):
        action = self.toolbar.addAction(QIcon(filename), hover)
        if shortcut:
            action.setShortcut(shortcut)
        if callback:
            action.triggered.connect(callback)
        return Icon(action)

    def add_text(self, name, callback):
        action = self.toolbar.addAction(name)
        if callback:
            action.triggered.connect(callback)

# Path: flexlay/gui/icon.py
# class Icon:
# 
#     def __init__(self, action):
#         self.action = action
# 
#     def disable(self):
#         self.action.setEnabled(False)
# 
#     def enable(self):
#         self.action.setEnabled(True)
# 
#     def set_up(self):
#         self.action.setCheckable(True)
#         self.action.setChecked(False)
# 
#     def set_down(self):
#         self.action.setCheckable(True)
#         self.action.setChecked(True)


# Path: flexlay/gui/button_panel.py
from PyQt5.QtGui import QIcon
from flexlay.gui.icon import Icon

#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.





class ButtonPanel:

    def __init__(self, toolbar):
        self.toolbar = toolbar

    def add_icon(self, filename, callback, hover="Hover Text", shortcut=None):
        action = self.toolbar.addAction(QIcon(filename), hover)
        if shortcut:
            action.setShortcut(shortcut)
        if callback:
            action.triggered.connect(callback)
        return Icon(action)

    def add_text(self, name, callback):
        action = self.toolbar.addAction(name)
        if callback:
            action.triggered.connect(callback)

        return Icon(action)