summaryrefslogtreecommitdiffstats
path: root/src/libgui/toplevel_ui.cpp
blob: 41f993c7f7e95ecc9203e14a205e7ae1fdbc2dac (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
/***************************************************************************
 *   Copyright (C) 2005-2007 Nicolas Hadacek <hadacek@kde.org>             *
 *                                                                         *
 *   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.                                   *
 ***************************************************************************/
#include "toplevel_ui.h"

#include <tqstyle.h>
#include <kiconloader.h>

#include "progs/list/prog_list.h"
#include "tools/list/tool_list.h"

//----------------------------------------------------------------------------
ProgrammerStatusWidget::ProgrammerStatusWidget(TQWidget *parent)
  : TQObject(parent), KeyPopupButton<TQString>(parent)
{
  connect(widget(), TQT_SIGNAL(activated(int)), TQT_SLOT(activatedSlot(int)));
  widget()->appendAction(i18n("Configure..."), "configure", this, TQT_SIGNAL(configure()));
  widget()->appendSeparator();
  Programmer::Lister::ConstIterator it;
  for (it=Programmer::lister().begin(); it!=Programmer::lister().end(); ++it)
    appendItem(it.key(), it.data()->label());
}

void ProgrammerStatusWidget::activatedSlot(int id)
{
  emit selected(*Programmer::lister().group(key(id)));
}

//----------------------------------------------------------------------------
ToolStatusWidget::ToolStatusWidget(TQWidget *parent)
  : TQObject(parent), KeyPopupButton<TQString>(parent)
{
  connect(widget(), TQT_SIGNAL(activated(int)), TQT_SLOT(activatedSlot(int)));
  widget()->appendAction(i18n("Configure Toolchain..."), "configure", this, TQT_SIGNAL(configureToolchain()));
  widget()->appendAction(i18n("Configure Compilation..."), "configure", this, TQT_SIGNAL(configure()));
  widget()->appendSeparator();
  Tool::Lister::ConstIterator it;
  for (it=Tool::lister().begin(); it!=Tool::lister().end(); ++it)
    appendItem(it.key(), it.data()->label());
}

void ToolStatusWidget::activatedSlot(int id)
{
  emit selected(*Tool::lister().group(key(id)));
}

//----------------------------------------------------------------------------
ViewMenuAction::ViewMenuAction(KDockWidget *widget)
  : TDEToggleAction(widget->tabPageLabel()), _widget(widget)
{}

void ViewMenuAction::slotActivated()
{
  TDEAction::slotActivated();
  emit activated(_widget);
}

//----------------------------------------------------------------------------
MenuBarButton::MenuBarButton(const TQString &icon, TQWidget *parent)
  : TQToolButton(parent, "menu_bar_button")
{
  TQFontMetrics fm(font());
  int h = fm.height() + 2*style().pixelMetric(TQStyle::PM_DefaultFrameWidth, this);
  setFixedHeight(h);
  TDEIconLoader loader;
  setIconSet(loader.loadIconSet(icon, TDEIcon::Small, fm.height()-2));
  setUsesTextLabel(false);
  setAutoRaise(true);
}

TQSize MenuBarButton::sizeHint() const
{
  return TQSize(TQToolButton::sizeHint().width(), height());
}