detectwidget.h
00001 /* 00002 * Copyright (c) 2004 Lubos Lunak <l.lunak@kde.org> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 00020 #ifndef __DETECTWIDGET_H__ 00021 #define __DETECTWIDGET_H__ 00022 00023 #include "detectwidgetbase.h" 00024 00025 #include <kdialogbase.h> 00026 #include <kwin.h> 00027 00028 #include "../../rules.h" 00029 00030 namespace KWinInternal 00031 { 00032 00033 class DetectWidget 00034 : public DetectWidgetBase 00035 { 00036 Q_OBJECT 00037 public: 00038 DetectWidget( QWidget* parent = NULL, const char* name = NULL ); 00039 }; 00040 00041 class DetectDialog 00042 : public KDialogBase 00043 { 00044 Q_OBJECT 00045 public: 00046 DetectDialog( QWidget* parent = NULL, const char* name = NULL ); 00047 void detect( WId window ); 00048 QCString selectedClass() const; 00049 bool selectedWholeClass() const; 00050 QCString selectedRole() const; 00051 bool selectedWholeApp() const; 00052 NET::WindowType selectedType() const; 00053 QString selectedTitle() const; 00054 Rules::StringMatch titleMatch() const; 00055 QCString selectedMachine() const; 00056 const KWin::WindowInfo& windowInfo() const; 00057 signals: 00058 void detectionDone( bool ); 00059 protected: 00060 virtual bool eventFilter( QObject* o, QEvent* e ); 00061 private: 00062 void selectWindow(); 00063 void readWindow( WId window ); 00064 void executeDialog(); 00065 WId findWindow(); 00066 QCString wmclass_class; 00067 QCString wmclass_name; 00068 QCString role; 00069 NET::WindowType type; 00070 QString title; 00071 QCString extrarole; 00072 QCString machine; 00073 DetectWidget* widget; 00074 QDialog* grabber; 00075 KWin::WindowInfo info; 00076 }; 00077 00078 inline 00079 const KWin::WindowInfo& DetectDialog::windowInfo() const 00080 { 00081 return info; 00082 } 00083 00084 } // namespace 00085 00086 #endif