File: updateui.cpp

package info (click to toggle)
kdbg 1.2.4-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,504 kB
  • ctags: 1,945
  • sloc: cpp: 15,961; sh: 8,183; makefile: 481; perl: 71; ansic: 16
file content (91 lines) | stat: -rw-r--r-- 1,726 bytes parent folder | download
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
// $Id: updateui.cpp,v 1.3 1999/12/11 18:17:46 jsixt Exp $

// Copyright by Johannes Sixt
// This file is under GPL, the GNU General Public Licence

#include "updateui.h"
#include "updateui.moc"
#include <qpopupmenu.h>
#include <ktoolbar.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "mydebug.h"

UpdateUI::~UpdateUI()
{
    disconnect(this);
}


UpdateMenuUI::UpdateMenuUI(QPopupMenu* m, QObject* receiver, const char* slotUpdateItem) :
	menu(m)
{
    ASSERT(menu != 0);
    connect(this, SIGNAL(updateUIItem(UpdateUI*)), receiver, slotUpdateItem);
}

UpdateMenuUI::~UpdateMenuUI()
{
}

void UpdateMenuUI::iterateMenu()
{
    ASSERT(menu != 0);

    for (int i = menu->count()-1; i >= 0; i--) {
	index = i;
	id = menu->idAt(i);
	emit updateUIItem(this);
    }
}

void UpdateMenuUI::setCheck(bool check)
{
    menu->setItemChecked(id, check);
}

void UpdateMenuUI::enable(bool enable)
{
    menu->setItemEnabled(id, enable);
}

void UpdateMenuUI::setText(const QString& text)
{
    menu->changeItem(text, id);
}

UpdateToolbarUI::UpdateToolbarUI(KToolBar* t, QObject* receiver, const char* slotUpdateItem,
				 const int* idl, int c) :
	toolbar(t),
	count(c),
	idlist(idl)
{
    ASSERT(toolbar != 0);
    connect(this, SIGNAL(updateUIItem(UpdateUI*)), receiver, slotUpdateItem);
}

void UpdateToolbarUI::iterateToolbar()
{
    ASSERT(toolbar != 0);

    for (int i = count-1; i >= 0; i--) {
	index = i;
	id = idlist[i];
	emit updateUIItem(this);
    }
}

void UpdateToolbarUI::setCheck(bool /*check*/)
{
    // checking a toolbar button is not done via UpdateUI
}

void UpdateToolbarUI::enable(bool enable)
{
    toolbar->setItemEnabled(id, enable);
}

void UpdateToolbarUI::setText(const QString& /*text*/)
{
}