1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
/****************************************************************************
* Copyright (C) 2009 by Björn Ruberg <bjoern@ruberg-wegener.de> *
* *
* 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. *
* *
* 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 WIDGET_H
#define WIDGET_H
#include "tooltip.h"
#include <plasma/containment.h>
#include <plasma/dataengine.h>
#include <plasma/widgets/label.h>
#define XK_TECHNICAL
#define XK_PUBLISHING
#define XK_LATIN1
#include <X11/keysym.h>
class AlphaNumKey;
class FuncKey;
class QGraphicsGridLayout;
class PlasmaboardWidget : public Plasma::Containment
{
Q_OBJECT
public:
// Basic Create/Destroy
PlasmaboardWidget(QGraphicsWidget *parent);
~PlasmaboardWidget();
// The paintInterface procedure paints the applet to screen
void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option,
QWidget*);
/*
* Draws just basic keys on the keyboard - just for writing
*/
void initBasicKeyboard(int offset=0);
/*
* Draws nearly all keys of a pc-105 keyboard on the board
*/
void initExtendedKeyboard();
/*
* Deletes all keys for resetting the keyboard
*/
void resetKeyboard();
/*
* Clears lock key and calls clear()
*/
void clearAnything();
Plasma::Label* switcher;
public Q_SLOTS:
/*
Unsets all pressed keys despite of caps
*/
void clear();
/*
Triggers a relabeling of alphanumeric keys on the keyboard
*/
void relabelKeys();
/*
Sets tooltip to a new text
*/
void setTooltip(QString text, QSizeF buttonSize, QPointF position);
void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data);
private:
/*
* Removes tooltip
*/
void clearTooltip();
Plasma::DataEngine* engine;
QList<AlphaNumKey*> alphaKeys; // normal keys labeled with symbols like a, b, c
QList<FuncKey*> funcKeys; // functional keys like shift, backspace, enter
QList<FuncKey*> extKeys; // keys only shown in the extended layout as F1, F2,..
bool isLevel2; // second key level activated
bool isAlternative; // alternative key level activated
bool isLocked; // is lock activddated
bool basicKeys; // are basic keys displayed
bool extendedKeys; // are extended keys displayed
QGraphicsGridLayout *m_layout; // layout the keys are positioned in
//Plasma::ToolTipContent tooltip;
Tooltip* tooltip;
signals:
void shiftKey(bool value);
void altKey(bool value);
void altGrKey(bool value);
void superKey(bool value);
void controlKey(bool value);
void menuKey(bool value);
};
#endif /* WIDGET_H */
|