21#ifndef __ko_koolbar_h__
22#define __ko_koolbar_h__
27#include <koffice_export.h>
33class KoKoolBarItem :
public TQObject
39 KoKoolBarItem( KoKoolBarGroup *_grp,
const TQPixmap& _pix,
const TQString& _text = TQString() );
41 int id()
const {
return m_id; }
43 bool isEnabled()
const {
return m_bEnabled; }
44 void setEnabled(
bool _e ) { m_bEnabled = _e; }
46 int height()
const {
return m_iHeight; }
47 TQPixmap pixmap()
const {
return m_pixmap; }
48 void setText(
const TQString & text ) { m_strText = text; }
49 TQString text()
const {
return m_strText; }
52 void pressed(
int _group,
int _id );
55 void calc( TQWidget* );
58 KoKoolBarGroup* m_pGroup;
63 class KoKoolBarItemPrivate;
64 KoKoolBarItemPrivate *d;
67class KoKoolBarGroup :
public TQObject
72 KoKoolBarGroup( KoKoolBar *_bar,
const TQString& _text );
75 void append( KoKoolBarItem *_i ) { m_mapItems.insert( _i->id(), _i ); }
76 void remove(
int _id );
78 KoKoolBar* bar()
const {
return m_pBar; }
79 TQPushButton* button()
const {
return m_pButton; }
80 int id()
const {
return m_id; }
81 bool isEnabled()
const {
return m_bEnabled; }
82 void setEnabled(
bool _e ) { m_bEnabled = _e; }
83 KoKoolBarItem* item(
int _id )
const {
return m_mapItems[ _id ]; }
84 int items()
const {
return m_mapItems.size(); }
85 TQIntDictIterator<KoKoolBarItem> iterator()
const {
return TQIntDictIterator<KoKoolBarItem>( m_mapItems ); }
91 TQIntDict<KoKoolBarItem> m_mapItems;
95 TQPushButton* m_pButton;
97 class KoKoolBarGroupPrivate;
98 KoKoolBarGroupPrivate *d;
101class KoKoolBarBox :
public TQFrame
106 KoKoolBarBox( KoKoolBar *_bar );
108 void setActiveGroup( KoKoolBarGroup *_grp );
109 int maxHeight()
const;
111 void sizeChanged() { resizeEvent(0L); }
118 virtual void resizeEvent( TQResizeEvent *_ev );
119 virtual void drawContents( TQPainter * );
120 virtual void mousePressEvent( TQMouseEvent *_ev )
121 { KoKoolBarItem *item = findByPos( _ev->pos().y() + m_iYOffset );
if ( !item )
return; item->press(); }
123 KoKoolBarItem* findByPos(
int _abs_y )
const;
125 bool needsScrolling()
const;
126 bool isAtBottom()
const;
127 bool isAtTop()
const;
128 void updateScrollButtons();
133 KoKoolBarGroup *m_pGroup;
134 TQPushButton* m_pButtonUp;
135 TQPushButton* m_pButtonDown;
136 class KoKoolBarBoxPrivate;
137 KoKoolBarBoxPrivate *d;
140class KOFFICEUI_EXPORT KoKoolBar :
public TQWidget
145 KoKoolBar( TQWidget *_parent = 0L,
const char *_name = 0L );
146 virtual ~KoKoolBar() { };
148 virtual int insertGroup(
const TQString& _text );
149 virtual int insertItem(
int _grp,
const TQPixmap& _pix,
const TQString& _text = TQString(),
150 TQObject *_obj = 0L,
const char *_slot = 0L );
151 virtual void removeGroup(
int _grp );
152 virtual void removeItem(
int _grp,
int _id );
153 virtual void renameItem(
int _grp,
int _id,
const TQString & _text );
154 virtual void setActiveGroup(
int _grp );
155 virtual int activeGroup()
const {
return m_iActiveGroup; }
156 virtual void enableItem(
int _grp,
int _id,
bool _enable );
157 virtual void enableGroup(
int _grp,
bool _enable );
160 virtual void resizeEvent( TQResizeEvent *_ev );
162 TQIntDict<KoKoolBarGroup> m_mapGroups;
165 KoKoolBarBox* m_pBox;
166 class KoKoolBarPrivate;