kpanelextension.h
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 #ifndef __kpanelextension_h__ 00025 #define __kpanelextension_h__ 00026 00027 #include <tqframe.h> 00028 #include <kdelibs_export.h> 00029 00030 class TQPopupMenu; 00031 class KConfig; 00032 class KPanelExtensionPrivate; 00033 00097 class KDEUI_EXPORT KPanelExtension : public TQFrame 00098 { 00099 Q_OBJECT 00100 00101 public: 00102 00104 enum Type { Normal = 0, Stretch }; 00105 // KDE4: Merge these with KPanelApplet's enums 00107 enum Action { About = 1, Help = 2, Preferences = 4, ReportBug = 8 }; 00108 enum Position { Left = 0, Right, Top, Bottom, Floating }; 00109 enum Alignment { LeftTop = 0, Center, RightBottom }; 00111 enum Size { SizeTiny = 0, SizeSmall, SizeNormal, SizeLarge, SizeCustom }; 00112 00122 KPanelExtension(const TQString& configFile, Type t = Normal, 00123 int actions = 0, TQWidget *parent = 0, const char *name = 0); 00124 00128 ~KPanelExtension(); 00129 00139 virtual TQSize sizeHint(Position /*p*/, TQSize maxsize) const { return maxsize; } 00140 00150 KConfig* config() const { return _config; } 00151 00156 Type type() const { return _type; } 00157 00162 int actions() const { return _actions; } 00163 00174 virtual void action( Action a ); 00175 00176 00183 virtual Position preferedPosition() const { return Bottom; } 00184 00188 void setPosition( Position p ); 00192 void setAlignment( Alignment a ); 00197 void setSize( Size size, int customSize ); 00198 00203 Size sizeSetting() const; 00204 00209 int customSize() const; 00210 00216 TQPopupMenu* customMenu() const; 00217 00224 bool reserveStrut() const; 00225 00226 signals: 00232 void updateLayout(); 00233 00238 void maintainFocus(bool); 00239 00240 protected: 00241 00249 virtual void about() {} 00250 00258 virtual void help() {} 00259 00267 virtual void preferences() {} 00268 00277 virtual void reportBug() {} 00278 00282 Position position() const { return _position; } 00283 00287 Alignment alignment() const { return _alignment; } 00288 00292 Orientation orientation(); 00293 00298 int sizeInPixels() const; 00299 00305 virtual void positionChange( Position ) {} 00306 00312 virtual void alignmentChange( Alignment ) {} 00313 00324 void setCustomMenu(TQPopupMenu*); 00325 00331 void setReserveStrut(bool shouldUseStrut); 00332 00333 private: 00334 Type _type; 00335 Position _position; 00336 Alignment _alignment; 00337 KConfig* _config; 00338 int _actions; 00339 protected: 00340 virtual void virtual_hook( int id, void* data ); 00341 private: 00342 KPanelExtensionPrivate *d; 00343 }; 00344 00345 #endif