Files
squeekboard/eek/eek-key.h
2011-01-27 16:58:59 +09:00

136 lines
5.4 KiB
C

/*
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef EEK_KEY_H
#define EEK_KEY_H 1
#include <glib-object.h>
#include "eek-element.h"
#include "eek-types.h"
G_BEGIN_DECLS
#define EEK_TYPE_KEY (eek_key_get_type())
#define EEK_KEY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_KEY, EekKey))
#define EEK_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_KEY, EekKeyClass))
#define EEK_IS_KEY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_KEY))
#define EEK_IS_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_KEY))
#define EEK_KEY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_KEY, EekKeyClass))
typedef struct _EekKeyClass EekKeyClass;
typedef struct _EekKeyPrivate EekKeyPrivate;
struct _EekKey
{
/*< private >*/
EekElement parent;
EekKeyPrivate *priv;
};
/**
* EekKeyClass:
* @set_keycode: virtual function for setting keycode of the key
* @get_keycode: virtual function for getting keycode of the key
* @set_keysyms: virtual function for setting symbol matrix of the key
* @get_keysyms: virtual function for getting symbol matrix of the key
* @set_index: virtual function for setting position of the key in the
* section
* @get_index: virtual function for getting position of the key in the
* section
* @set_outline: virtual function for setting outline shape of the key
* @get_outline: virtual function for getting outline shape of the key
* @pressed: class handler for #EekKey::pressed signal
* @released: class handler for #EekKey::released signal
* @is_pressed: virtual function for getting whether the key is pressed
*/
struct _EekKeyClass
{
/*< private >*/
EekElementClass parent_class;
/*< public >*/
void (* set_keycode) (EekKey *self,
guint keycode);
guint (* get_keycode) (EekKey *self);
void (* set_keysyms) (EekKey *self,
guint *keysyms,
gint num_groups,
gint num_levels);
void (* get_keysyms) (EekKey *self,
guint **keysyms,
gint *num_groups,
gint *num_levels);
void (* set_index) (EekKey *self,
gint column,
gint row);
void (* get_index) (EekKey *self,
gint *column,
gint *row);
void (* set_outline) (EekKey *self,
EekOutline *outline);
EekOutline *(* get_outline) (EekKey *self);
gboolean (* is_pressed) (EekKey *self);
/* signals */
void (* pressed) (EekKey *key);
void (* released) (EekKey *key);
/*< private >*/
/* padding */
gpointer pdummy[23];
};
GType eek_key_get_type (void) G_GNUC_CONST;
void eek_key_set_keycode (EekKey *key,
guint keycode);
guint eek_key_get_keycode (EekKey *key);
void eek_key_set_keysyms (EekKey *key,
guint *keysyms,
gint num_groups,
gint num_levels);
void eek_key_get_keysyms (EekKey *key,
guint **keysyms,
gint *num_groups,
gint *num_levels);
guint eek_key_get_keysym (EekKey *key);
guint eek_key_get_keysym_at_index (EekKey *key,
gint group,
gint level);
void eek_key_set_index (EekKey *key,
gint column,
gint row);
void eek_key_get_index (EekKey *key,
gint *column,
gint *row);
void eek_key_set_outline (EekKey *key,
EekOutline *outline);
EekOutline *eek_key_get_outline (EekKey *key);
gboolean eek_key_is_pressed (EekKey *key);
G_END_DECLS
#endif /* EEK_KEY_H */