buttons.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef __BUTTONS_H_
00031 #define __BUTTONS_H_
00032
00033 #include <qevent.h>
00034 #include <qdragobject.h>
00035 #include <qlistbox.h>
00036
00037
00039
00040 class ButtonDrag: public QStoredDrag
00041 {
00042 public:
00043 ButtonDrag( char btn, QWidget* parent, const char* name=0 );
00044 ~ButtonDrag() {};
00045
00046 static bool canDecode( QDragMoveEvent* e );
00047 static bool decode( QDropEvent* e, char& btn );
00048 };
00049
00050
00052
00053 class ButtonSource: public QListBox
00054 {
00055 Q_OBJECT
00056
00057 public:
00058 ButtonSource( QWidget* parent=0, const char* name=0 );
00059 ~ButtonSource();
00060
00061 void hideAllButtons();
00062 void showAllButtons();
00063
00064 signals:
00065 void buttonDropped();
00066
00067 public slots:
00068 void hideButton( char btn );
00069 void showButton( char btn );
00070
00071 protected:
00072 void dragEnterEvent( QDragEnterEvent* e );
00073 void dragMoveEvent( QDragMoveEvent* e );
00074 void dragLeaveEvent( QDragLeaveEvent* e );
00075 void dropEvent( QDropEvent* e );
00076 void mousePressEvent( QMouseEvent* e );
00077
00078 private:
00079 char convertToChar( QString s );
00080 QString convertToString( char btn );
00081
00082 int spacerCount;
00083 };
00084
00085
00087
00088 class ButtonDropSite: public QFrame
00089 {
00090 Q_OBJECT
00091
00092 public:
00093 ButtonDropSite( QWidget* parent=0, const char* name=0 );
00094 ~ButtonDropSite();
00095
00096
00097
00098 QString buttonsLeft;
00099 QString buttonsRight;
00100
00101 signals:
00102 void buttonAdded( char c );
00103 void buttonRemoved( char c );
00104 void changed();
00105
00106 public slots:
00107 void removeClickedButton();
00108
00109 protected:
00110 void dragEnterEvent( QDragEnterEvent* e );
00111 void dragMoveEvent( QDragMoveEvent* e );
00112 void dragLeaveEvent( QDragLeaveEvent* e );
00113 void dropEvent( QDropEvent* e );
00114 void mousePressEvent( QMouseEvent* e );
00115
00116 void drawContents( QPainter* p );
00117 int buttonWidth( char btn );
00118 int calcButtonStringWidth( const QString& s );
00119 char removeButtonAtPoint( QPoint p );
00120 void buttonInsertedAtPoint( QPoint p, bool& isleft, int& strPos );
00121 void drawButtonString( QPainter* p, QString& s, int offset );
00122
00123 QPoint mouseClickPoint;
00124 };
00125
00126
00127 #endif
00128
This file is part of the documentation for kwin Library Version 3.3.0.