summaryrefslogtreecommitdiffstats
path: root/src/MainWidget.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 02:19:41 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 02:19:41 +0000
commitd728c2086bb8bb99df2828948644c14194a91681 (patch)
tree3f62305a8afc7dbb36d90ab5fc6fc0538972b71e /src/MainWidget.h
downloadkvkbd-d728c2086bb8bb99df2828948644c14194a91681.tar.gz
kvkbd-d728c2086bb8bb99df2828948644c14194a91681.zip
Added KDE3 version of kvkbd
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvkbd@1095344 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/MainWidget.h')
-rw-r--r--src/MainWidget.h166
1 files changed, 166 insertions, 0 deletions
diff --git a/src/MainWidget.h b/src/MainWidget.h
new file mode 100644
index 0000000..0eb87ac
--- /dev/null
+++ b/src/MainWidget.h
@@ -0,0 +1,166 @@
+/***************************************************************************
+ * Copyright (C) 2007 by Todor Gyumyushev *
+ * yodor@developer.bg *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * 0000 *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#ifndef KVKBDMAINWIDGET_H
+#define KVKBDMAINWIDGET_H
+
+
+#include <qevent.h>
+#include <qpoint.h>
+#include <qtimer.h>
+#include <kaboutdata.h>
+#include <ksystemtray.h>
+#include <kpopupmenu.h>
+#include <qpainter.h>
+#include <qthread.h>
+
+#include "resizabledragwidget.h"
+#include "VButton.h"
+#include "numpadvbutton.h"
+#include <X11/Xlib.h>
+
+class KbdDock;
+class KbdTray;
+
+class MainWidget : public ResizableDragWidget
+{
+Q_OBJECT
+public:
+ MainWidget(KAboutData *about=0, bool tren=false, QWidget *parent=0,const char *name="", WFlags f=WStyle_Customize | Qt::WX11BypassWM |WStyle_NormalBorder);
+ void mappingNotify(XMappingEvent *e);
+ void finishInit();
+ bool close ( bool alsoDelete );
+
+public slots:
+ void keyPress(unsigned int keycode);
+
+ void toggleCaps();
+ void toggleNumlock();
+
+ void toggleShift();
+
+ void queryModState();
+ void showDock();
+
+ void quitClicked();
+ void chooseFont();
+ void toggleNumericPad();
+ void toggleFontAutoRes();
+ void restorePosition();
+ void showConfigMenu();
+// void shutDown();
+ void saveState();
+
+protected:
+ void resizeEvent(QResizeEvent *e);
+ void hideEvent ( QHideEvent *e );
+
+
+private:
+ void updateFont();
+
+ bool nresize;
+
+ bool keyState(int iKey);
+ void keyPress(int keycode);
+ void setupText(VButton &v);
+
+
+ VButton *caps;
+ VButton *lshft;
+ VButton *rshft;
+
+ VButton *lctrl;
+ VButton *rctrl;
+
+ VButton *lalt;
+ VButton *ralt;
+
+ VButton *win;
+ VButton *mnu;
+
+ VButton *numl;
+ VButton *div;
+ VButton *mul;
+ VButton *min;
+ VButton *plu;
+ VButton *ent;
+
+ NumpadVButton *ins;
+ NumpadVButton *del;
+
+ QValueList<VButton *> btns;
+ QValueList<VButton *> mod_keys;
+ QValueList<VButton *> other_keys;
+ QValueList<NumpadVButton *> numl_keys;
+
+ void send_key(unsigned int keycode, bool press, bool release);
+
+ Display *display;
+ KbdTray *tray;
+ KbdDock *dock;
+
+ bool stand_alone;
+ long keysym2ucs(KeySym keysym);
+
+ bool extent_visible;
+ VButton *quit;
+ VButton *popup_menu;
+ VButton *extent;
+ double sdxs;
+ double sdxb;
+ int mnu_dock;
+ int mnu_autores;
+
+};
+
+
+class KbdDock : public DragWidget
+{
+ Q_OBJECT
+
+public:
+ KbdDock(MainWidget *m);
+ ~KbdDock();
+
+ void paintEvent(QPaintEvent *);
+
+
+private:
+ QPixmap icn;
+ MainWidget *mainWidget;
+
+
+protected:
+ void mouseReleaseEvent(QMouseEvent *e);
+
+};
+
+class KbdTray : public KSystemTray
+{
+
+public:
+ KbdTray( QWidget* parent = 0, const char* name = 0 );
+
+protected:
+ void mousePressEvent(QMouseEvent *);
+
+};
+
+#endif