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
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
00099
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
This file is part of the documentation for kwin Library Version 3.2.3.