You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.9 KiB
68 lines
2.9 KiB
/***************************************************************************
|
|
* ktouchkeyboard.h *
|
|
* ---------------- *
|
|
* Copyright (C) 2004 by Andreas Nicolai *
|
|
* ghorwin@users.sourceforge.net *
|
|
* *
|
|
* 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. *
|
|
***************************************************************************/
|
|
|
|
#ifndef KTOUCHKEYBOARD_H
|
|
#define KTOUCHKEYBOARD_H
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include <config.h>
|
|
#endif
|
|
|
|
#include <tqvaluevector.h>
|
|
|
|
#include "ktouchkeyconnector.h"
|
|
#include "ktouchkey.h"
|
|
|
|
class KURL;
|
|
|
|
/// This class stores the keyboard tqlayout and the connectivity between characters
|
|
/// and the actual keys.
|
|
class KTouchKeyboard {
|
|
public:
|
|
/// Default constructor, sets up the standard number keyboard.
|
|
KTouchKeyboard() { createDefault(); }
|
|
/// Clears the keyboard (resets all data)
|
|
void clear();
|
|
/// Loads a keyboard tqlayout (old format) from file (returns true if successful).
|
|
bool load(TQWidget * window, const KURL& url);
|
|
/// Loads a lecture (in XML format) from file (returns true if successful).
|
|
bool loadXML(TQWidget * window, const KURL& url);
|
|
/// Saves the lecture data to file (returns true if successful).
|
|
bool saveXML(TQWidget * window, const KURL& url) const;
|
|
/// Creates the default number keyboard.
|
|
void createDefault();
|
|
/// Updates the indices in the KTouchKeyConnector objects for faster access.
|
|
void updateConnections();
|
|
|
|
TQValueVector<KTouchKey> m_keys; ///< Vector with key definitions.
|
|
TQValueVector<KTouchKeyConnector> m_connectors; ///< Vector with connectivity data.
|
|
|
|
TQString m_title; ///< Title of the keyboard (to appear in the menu).
|
|
TQString m_comment; ///< Comments about the creator of the keyboard tqlayout.
|
|
TQString m_language; ///< Language ID of keyboard
|
|
TQString m_fontSuggestions; ///< Suggestions of fonts to be used on the keys.
|
|
|
|
// These variables are recalculated after the keyboard was loaded.
|
|
int m_width; ///< The width of the keyboard (maximum of the sums of all keywidths in each line).
|
|
int m_height; ///< The height of the keyboard (sum of all key row heights).
|
|
|
|
private:
|
|
/// Loads keyboard data from file
|
|
bool read(TQTextStream& in);
|
|
/// Loads keyboard data from file into an XML document
|
|
bool read(const TQDomDocument& doc);
|
|
/// Saves keyboard data in the XML document
|
|
void write(TQDomDocument& doc) const;
|
|
};
|
|
|
|
#endif // KTOUCHKEYBOARD_H
|