kwin Library API Documentation

buttons.h

00001 /* 00002 $Id: buttons.h,v 1.5 2003/09/19 11:14:41 lunakl Exp $ 00003 00004 This is the new kwindecoration kcontrol module 00005 00006 Copyright (c) 2001 00007 Karol Szwed <gallium@kde.org> 00008 http://gallium.n3.net/ 00009 00010 Supports new kwin configuration plugins, and titlebar button position 00011 modification via dnd interface. 00012 00013 Based on original "kwintheme" (Window Borders) 00014 Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org> 00015 00016 This program is free software; you can redistribute it and/or modify 00017 it under the terms of the GNU General Public License as published by 00018 the Free Software Foundation; either version 2 of the License, or 00019 (at your option) any later version. 00020 00021 This program is distributed in the hope that it will be useful, 00022 but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 GNU General Public License for more details. 00025 00026 You should have received a copy of the GNU General Public License 00027 along with this program; if not, write to the Free Software 00028 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00029 00030 */ 00031 00032 #ifndef __BUTTONS_H_ 00033 #define __BUTTONS_H_ 00034 00035 #include <qevent.h> 00036 #include <qdragobject.h> 00037 #include <qlistbox.h> 00038 00039 00041 00042 class ButtonDrag: public QStoredDrag 00043 { 00044 public: 00045 ButtonDrag( char btn, QWidget* parent, const char* name=0 ); 00046 ~ButtonDrag() {}; 00047 00048 static bool canDecode( QDragMoveEvent* e ); 00049 static bool decode( QDropEvent* e, char& btn ); 00050 }; 00051 00052 00054 00055 class ButtonSource: public QListBox 00056 { 00057 Q_OBJECT 00058 00059 public: 00060 ButtonSource( QWidget* parent=0, const char* name=0 ); 00061 ~ButtonSource(); 00062 00063 void hideAllButtons(); 00064 void showAllButtons(); 00065 00066 signals: 00067 void buttonDropped(); 00068 00069 public slots: 00070 void hideButton( char btn ); 00071 void showButton( char btn ); 00072 00073 protected: 00074 void dragEnterEvent( QDragEnterEvent* e ); 00075 void dragMoveEvent( QDragMoveEvent* e ); 00076 void dragLeaveEvent( QDragLeaveEvent* e ); 00077 void dropEvent( QDropEvent* e ); 00078 void mousePressEvent( QMouseEvent* e ); 00079 00080 private: 00081 char convertToChar( QString s ); 00082 QString convertToString( char btn ); 00083 00084 int spacerCount; 00085 }; 00086 00087 00089 00090 class ButtonDropSite: public QFrame 00091 { 00092 Q_OBJECT 00093 00094 public: 00095 ButtonDropSite( QWidget* parent=0, const char* name=0 ); 00096 ~ButtonDropSite(); 00097 00098 // Allow external classes access our buttons - ensure buttons are 00099 // not duplicated however. 00100 QString buttonsLeft; 00101 QString buttonsRight; 00102 00103 signals: 00104 void buttonAdded( char c ); 00105 void buttonRemoved( char c ); 00106 void changed(); 00107 00108 public slots: 00109 void removeClickedButton(); 00110 00111 protected: 00112 void dragEnterEvent( QDragEnterEvent* e ); 00113 void dragMoveEvent( QDragMoveEvent* e ); 00114 void dragLeaveEvent( QDragLeaveEvent* e ); 00115 void dropEvent( QDropEvent* e ); 00116 void mousePressEvent( QMouseEvent* e ); 00117 00118 void drawContents( QPainter* p ); 00119 int buttonWidth( char btn ); 00120 int calcButtonStringWidth( const QString& s ); 00121 char removeButtonAtPoint( QPoint p ); 00122 void buttonInsertedAtPoint( QPoint p, bool& isleft, int& strPos ); 00123 void drawButtonString( QPainter* p, QString& s, int offset ); 00124 00125 QPoint mouseClickPoint; 00126 }; 00127 00128 00129 #endif 00130 // vim: ts=4
KDE Logo
This file is part of the documentation for kwin Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Dec 16 19:08:40 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003