~ubuntu-branches/ubuntu/hoary/kvirc/hoary

« back to all changes in this revision

Viewing changes to src/kvirc/kvi_utoolbar.h

  • Committer: Bazaar Package Importer
  • Author(s): Robin Verduijn
  • Date: 2004-12-14 15:32:19 UTC
  • mfrom: (0.2.1 upstream) (1.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20041214153219-fdink3gyp2s20b6g
Tags: 2:2.1.3.1-2
* Change Recommends on xmms to a Suggests.
* Rebuild against KDE 3.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef _KVI_UTOOLBAR_H_INCLUDED_
2
 
#define _KVI_UTOOLBAR_H_INCLUDED_
3
 
 
4
 
//
5
 
//   File : kvi_popupmenu.h (/usr/build/NEW_kvirc/kvirc/src/kvirc/kvi_popupmenu.h)
6
 
//   Last major modification : Wed Apr 21 1999 21:36:10 by Szymon Stefanek
7
 
//
8
 
//   This file is part of the KVirc irc client distribution
9
 
//   Copyright (C) 1999-2000 Szymon Stefanek (stefanek@tin.it)
10
 
//   Copyright (C) 1999-2000 Till Busch (buti@geocities.com)
11
 
//
12
 
//   This program is FREE software. You can redistribute it and/or
13
 
//   modify it under the terms of the GNU General Public License
14
 
//   as published by the Free Software Foundation; either version 2
15
 
//   of the License, or (at your opinion) any later version.
16
 
//
17
 
//   This program is distributed in the HOPE that it will be USEFUL,
18
 
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20
 
//   See the GNU General Public License for more details.
21
 
//
22
 
//   You should have received a copy of the GNU General Public License
23
 
//   along with this program. If not, write to the Free Software Foundation,
24
 
//   Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
 
//
26
 
 
27
 
#include <qtoolbar.h>
28
 
#include <qtoolbutton.h>
29
 
#include <qlist.h>
30
 
#include <qwidget.h>
31
 
#include <qfile.h>
32
 
#include <qpalette.h>
33
 
#include <qpopupmenu.h>
34
 
 
35
 
#include "kvi_string.h"
36
 
#include "kvi_popupmenu.h"
37
 
#include "kvi_style.h"
38
 
 
39
 
//class KviUserToolBar;
40
 
class KviToolButton;
41
 
class KviUserToolBarTemplate;
42
 
 
43
 
typedef struct KviUserToolBarData
44
 
{
45
 
        KviStr                  buffer;
46
 
        KviStr                  image;
47
 
        KviStr                  text;
48
 
        KviStr                  sbar;
49
 
        KviToolButton   *button;
50
 
        KviPopupMenu    *menu;
51
 
        int                             id;
52
 
        int                             type;
53
 
};
54
 
 
55
 
//
56
 
// An item with id=0 , menu=0 and buffer = " " is a separator.
57
 
// Normal menu item buffers have the initial spaces stripped at
58
 
// insertion time
59
 
//
60
 
 
61
 
class KviFrame;
62
 
class KviCommand;
63
 
//class KviTransparentWidget;
64
 
 
65
 
class KviUserToolBar : public QToolBar
66
 
{
67
 
        friend class KviDlgScript;
68
 
        Q_OBJECT
69
 
public:
70
 
        KviUserToolBar(KviFrame *frame,QMainWindow::ToolBarDock dock);
71
 
        KviUserToolBar(KviFrame *frame, QWidget *parent);
72
 
        ~KviUserToolBar();
73
 
private:
74
 
//      KviTransparentWidget * m_pFiller;
75
 
        KviFrame *m_pFrame;
76
 
        QWidget  *m_pParent;
77
 
        int m_id;
78
 
//      QPopupMenu *m_pEditPopup; // Qt KILLS THIS
79
 
public:
80
 
        enum ToolButtonType { Separator, Button, Menu };
81
 
        QList<KviUserToolBarData> * m_pDataList;
82
 
        bool m_bLocked; //Protects against self-modification
83
 
        void clearAll();
84
 
        int insertNormalItem(const char *name, const char *sbar,const char *img,const char *buffer, KviPopupMenu *menu=0);
85
 
        void insertSeparatorItem();
86
 
        void copyFromTemplate(KviUserToolBarTemplate *toolbar, bool bEditPopup = true);
87
 
        void clearToolBar();
88
 
        bool isEmpty();
89
 
public slots:
90
 
        void buttonClicked(int id);
91
 
 
92
 
protected slots:
93
 
//      virtual bool eventFilter(QObject * o,QEvent *e);
94
 
//      void slot_editToolBar();
95
 
        void popupClicked(const KviStr &dataBuffer);
96
 
};
97
 
 
98
 
 
99
 
class KviUserToolBarTemplate
100
 
{
101
 
public:
102
 
        KviUserToolBarTemplate();
103
 
        ~KviUserToolBarTemplate();
104
 
private:
105
 
        int m_id;
106
 
public:
107
 
        enum ToolButtonType { Separator, Button, Menu };
108
 
        QList<KviUserToolBarData> * m_pDataList;
109
 
        void copyFromToolBar(KviUserToolBar *toolbar);
110
 
        int insertSeparatorItem();
111
 
        int insertNormalItem(const char *name, const char *sbar,const char *img,const char *buffer, KviPopupMenu * menu=0);
112
 
        static bool saveToolBarTemplate(const char *filename);
113
 
        static bool loadToolBarTemplate(const char *filename,KviStr &error);
114
 
        bool isEmpty();
115
 
        void clearToolBar();
116
 
private:
117
 
        void save(QFile *f);
118
 
        void buildDataBuffer(KviStr &str);
119
 
        bool loadFromDataBuffer(KviStr &buffer,KviStr &error);
120
 
};
121
 
 
122
 
class KviToolButton : public KviToolBarButton
123
 
{
124
 
        Q_OBJECT
125
 
public:
126
 
        KviToolButton(int id, const QPixmap & pm, const char * textLabel, const char * grouptext, QObject * receiver, const char * slot, QToolBar * parent);
127
 
        ~KviToolButton();
128
 
private:
129
 
        int m_BtnId;
130
 
signals:
131
 
        void idClicked(int);
132
 
public slots:
133
 
        void wasClicked();
134
 
};
135
 
 
136
 
#endif //!_KVI_UTOOLBAR_H_INCLUDED_