• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kdeui

kpanelextension.cpp

Go to the documentation of this file.
00001 /*****************************************************************
00002 
00003 Copyright (c) 2000 Matthias Elter
00004 
00005 Permission is hereby granted, free of charge, to any person obtaining a copy
00006 of this software and associated documentation files (the "Software"), to deal
00007 in the Software without restriction, including without limitation the rights
00008 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00009 copies of the Software, and to permit persons to whom the Software is
00010 furnished to do so, subject to the following conditions:
00011 
00012 The above copyright notice and this permission notice shall be included in
00013 all copies or substantial portions of the Software.
00014 
00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
00018 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00019 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00020 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00021 
00022 ******************************************************************/
00023 
00024 #include <qpopupmenu.h>
00025 
00026 #include <kconfig.h>
00027 
00028 #include "kpanelextension.h"
00029 #include "kpanelextension.moc"
00030 
00031 class KPanelExtensionPrivate
00032 {
00033 public:
00034     KPanelExtensionPrivate() 
00035       : _size(KPanelExtension::SizeNormal), 
00036         _customMenu(0),
00037         _customSize(58),
00038         _reserveStrut(true)
00039     {}
00040 
00041     KPanelExtension::Size _size;
00042     QPopupMenu* _customMenu;
00043     int _customSize;
00044     bool _reserveStrut;
00045 };
00046 
00047 KPanelExtension::KPanelExtension(const QString& configFile, Type type,
00048                  int actions, QWidget *parent, const char *name)
00049   : QFrame(parent, name)
00050   , _type(type)
00051   , _position( Top )
00052   , _alignment( LeftTop )
00053   , _config(0)
00054   , _actions(actions)
00055 {
00056     d = new KPanelExtensionPrivate;
00057     setFrameStyle(NoFrame);
00058     _config = new KConfig(configFile);
00059 }
00060 
00061 KPanelExtension::~KPanelExtension()
00062 {
00063     delete _config;
00064     delete d;
00065 }
00066 
00067 void KPanelExtension::setPosition( Position p )
00068 {
00069   if( _position == p ) return;
00070   _position = p;
00071   positionChange( p );
00072 }
00073 
00074 void KPanelExtension::setAlignment( Alignment a )
00075 {
00076   if( _alignment == a ) return;
00077   _alignment = a;
00078   alignmentChange( a );
00079 }
00080 
00081 void KPanelExtension::setSize( Size size, int customSize )
00082 {
00083   if ( d->_size == size && d->_customSize == customSize ) return;
00084   d->_size = size;
00085   d->_customSize = customSize;
00086   emit updateLayout();
00087 }
00088 
00089 void KPanelExtension::action( Action a )
00090 {
00091   if ( (a & About) )
00092     about();
00093   if ( (a & Help) )
00094     help();
00095   if ( (a & Preferences) )
00096     preferences();
00097   if ( (a & ReportBug) )
00098     reportBug();
00099 }
00100 
00101 Qt::Orientation KPanelExtension::orientation()
00102 {
00103     if (_position == Left || _position == Right)
00104     return Vertical;
00105     else
00106     return Horizontal;
00107 }
00108 
00109 KPanelExtension::Size KPanelExtension::sizeSetting() const
00110 {
00111     return d->_size;
00112 }
00113 
00114 int KPanelExtension::customSize() const
00115 {
00116     return d->_customSize;
00117 }
00118 
00119 int KPanelExtension::sizeInPixels() const
00120 {
00121   if (d->_size == SizeTiny)
00122   {
00123     return 24;
00124   }
00125   else if (d->_size == SizeSmall)
00126   {
00127     return 30;
00128   }
00129   else if (d->_size == SizeNormal)
00130   {
00131     return 46;
00132   }
00133   else if (d->_size == SizeLarge)
00134   {
00135     return 58;
00136   }
00137 
00138   return d->_customSize;
00139 }
00140 
00141 QPopupMenu* KPanelExtension::customMenu() const
00142 {
00143     return d->_customMenu;
00144 }
00145 
00146 void KPanelExtension::setCustomMenu(QPopupMenu* menu)
00147 {
00148     d->_customMenu = menu;
00149 }
00150 
00151 bool KPanelExtension::reserveStrut() const
00152 {
00153     return position() == Floating || d->_reserveStrut;
00154 }
00155 
00156 void KPanelExtension::setReserveStrut(bool reserve)
00157 {
00158     d->_reserveStrut = reserve;
00159 }
00160 
00161 void KPanelExtension::virtual_hook( int, void* )
00162 { /*BASE::virtual_hook( id, data );*/ }
00163 

kdeui

Skip menu "kdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal