kmenubar.h
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1997, 1998, 1999, 2000 Sven Radej (radej@kde.org) 00003 Copyright (C) 1997, 1998, 1999, 2000 Matthias Ettrich (ettrich@kde.org) 00004 Copyright (C) 1999, 2000 Daniel "Mosfet" Duley (mosfet@kde.org) 00005 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 00021 */ 00022 00023 //$Id: kmenubar.h 465272 2005-09-29 09:47:40Z mueller $ 00024 00025 #ifndef _KMENUBAR_H 00026 #define _KMENUBAR_H 00027 00028 #include <qmenubar.h> 00029 00030 #include <kdelibs_export.h> 00031 00042 class KDEUI_EXPORT KMenuBar : public QMenuBar 00043 { 00044 Q_OBJECT 00045 00046 public: 00047 00048 KMenuBar (QWidget *parent=0, const char *name=0); 00049 ~KMenuBar (); 00050 00068 void setTopLevelMenu(bool top_level = true); 00069 00075 bool isTopLevelMenu() const; 00076 00077 // TT are overloading virtuals :( 00078 virtual void setGeometry( const QRect &r ); 00079 virtual void setGeometry( int x, int y, int w, int h ); 00080 virtual void resize( int w, int h ); 00081 void resize( const QSize& s ) { QMenuBar::resize( s ); } 00082 00083 virtual void show(); 00084 virtual void setFrameStyle( int ); 00085 virtual void setLineWidth( int ); 00086 virtual void setMargin( int ); 00087 virtual QSize sizeHint() const; 00088 protected slots: 00089 void slotReadConfig(); 00090 protected: 00091 virtual void showEvent( QShowEvent* ); 00092 virtual void resizeEvent( QResizeEvent* ); 00093 virtual bool eventFilter(QObject *, QEvent *); 00094 #ifdef Q_WS_X11 00095 virtual bool x11Event( XEvent* ); 00096 #endif 00097 virtual void closeEvent( QCloseEvent* ); 00098 virtual void drawContents( QPainter* ); 00099 private slots: 00100 void updateFallbackSize(); 00101 void selectionTimeout(); 00102 private: 00103 void setTopLevelMenuInternal(bool top_level); 00104 void updateMenuBarSize(); 00105 void checkSize( int& w, int& h ); 00106 static int block_resize; 00107 protected: 00108 virtual void virtual_hook( int id, void* data ); 00109 private: 00110 class KMenuBarPrivate; 00111 KMenuBarPrivate *d; 00112 }; 00113 00114 #endif