Blame libxklavier/xkl_config_rec.h

Packit 7e555f
/*
Packit 7e555f
 * Copyright (C) 2002-2006 Sergey V. Udaltsov <svu@gnome.org>
Packit 7e555f
 *
Packit 7e555f
 * This library is free software; you can redistribute it and/or
Packit 7e555f
 * modify it under the terms of the GNU Lesser General Public
Packit 7e555f
 * License as published by the Free Software Foundation; either
Packit 7e555f
 * version 2 of the License, or (at your option) any later version.
Packit 7e555f
 *
Packit 7e555f
 * This library is distributed in the hope that it will be useful,
Packit 7e555f
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 7e555f
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 7e555f
 * Lesser General Public License for more details.
Packit 7e555f
 *
Packit 7e555f
 * You should have received a copy of the GNU Lesser General Public
Packit 7e555f
 * License along with this library; if not, write to the
Packit 7e555f
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Packit 7e555f
 * Boston, MA 02111-1307, USA.
Packit 7e555f
 */
Packit 7e555f
Packit 7e555f
#ifndef __XKL_CONFIG_REC_H__
Packit 7e555f
#define __XKL_CONFIG_REC_H__
Packit 7e555f
Packit 7e555f
#include <glib-object.h>
Packit 7e555f
#include <libxklavier/xkl_engine.h>
Packit 7e555f
Packit 7e555f
#ifdef __cplusplus
Packit 7e555f
extern "C" {
Packit 7e555f
#endif				/* __cplusplus */
Packit 7e555f
Packit 7e555f
        /**
Packit 7e555f
         * XklConfigRec:
Packit 7e555f
         * @layouts: (array zero-terminated=1):
Packit 7e555f
         * @variants: (array zero-terminated=1):
Packit 7e555f
         * @options: (array zero-terminated=1):
Packit 7e555f
         */
Packit 7e555f
	typedef struct _XklConfigRec XklConfigRec;
Packit 7e555f
	typedef struct _XklConfigRecClass XklConfigRecClass;
Packit 7e555f
Packit 7e555f
#define XKL_TYPE_CONFIG_REC             (xkl_config_rec_get_type ())
Packit 7e555f
#define XKL_CONFIG_REC(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), XKL_TYPE_CONFIG_REC, XklConfigRec))
Packit 7e555f
#define XKL_CONFIG_REC_CLASS(obj)       (G_TYPE_CHECK_CLASS_CAST ((obj), XKL_CONFIG_REC,  XklConfigRecClass))
Packit 7e555f
#define XKL_IS_CONFIG_REC(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XKL_TYPE_CONFIG_REC))
Packit 7e555f
#define XKL_IS_CONFIG_REC_CLASS(obj)    (G_TYPE_CHECK_CLASS_TYPE ((obj), XKL_TYPE_CONFIG_REC))
Packit 7e555f
#define XKL_CONFIG_REC_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), XKL_TYPE_CONFIG_REC, XklConfigRecClass))
Packit 7e555f
Packit 7e555f
/*
Packit 7e555f
 * Basic configuration params
Packit 7e555f
 */
Packit 7e555f
	struct _XklConfigRec {
Packit 7e555f
/*
Packit 7e555f
 * The superclass object
Packit 7e555f
 */
Packit 7e555f
		GObject parent;
Packit 7e555f
/*
Packit 7e555f
 * The keyboard model
Packit 7e555f
 */
Packit 7e555f
		gchar *model;
Packit 7e555f
/*
Packit 7e555f
 * The array of keyboard layouts
Packit 7e555f
 */
Packit 7e555f
		gchar **layouts;
Packit 7e555f
/*
Packit 7e555f
 * The array of keyboard layout variants (if any)
Packit 7e555f
 */
Packit 7e555f
		gchar **variants;
Packit 7e555f
/*
Packit 7e555f
 * The array of keyboard layout options
Packit 7e555f
 */
Packit 7e555f
		gchar **options;
Packit 7e555f
	};
Packit 7e555f
Packit 7e555f
/*
Packit 7e555f
 * The XklConfigRec class, derived from GObject
Packit 7e555f
 */
Packit 7e555f
	struct _XklConfigRecClass {
Packit 7e555f
		/*
Packit 7e555f
		 * The superclass
Packit 7e555f
		 */
Packit 7e555f
		GObjectClass parent_class;
Packit 7e555f
	};
Packit 7e555f
Packit 7e555f
/**
Packit 7e555f
 * xkl_config_rec_get_type:
Packit 7e555f
 *
Packit 7e555f
 * Get type info for XConfigRec
Packit 7e555f
 *
Packit 7e555f
 * Returns: GType for XConfigRec
Packit 7e555f
 */
Packit 7e555f
	extern GType xkl_config_rec_get_type(void);
Packit 7e555f
Packit 7e555f
/**
Packit 7e555f
 * xkl_config_rec_new:
Packit 7e555f
 *
Packit 7e555f
 * Create new XklConfigRec
Packit 7e555f
 *
Packit 7e555f
 * Returns: new instance
Packit 7e555f
 */
Packit 7e555f
	extern XklConfigRec *xkl_config_rec_new(void);
Packit 7e555f
Packit 7e555f
/**
Packit 7e555f
 * xkl_config_rec_activate:
Packit 7e555f
 * @data: valid XKB configuration
Packit 7e555f
 * @engine: the engine
Packit 7e555f
 *
Packit 7e555f
 * Activates some XKB configuration
Packit 7e555f
 * description. Can be NULL
Packit 7e555f
 *
Packit 7e555f
 * Returns: TRUE on success
Packit 7e555f
 */
Packit 7e555f
	extern gboolean xkl_config_rec_activate(const XklConfigRec * data,
Packit 7e555f
						XklEngine * engine);
Packit 7e555f
Packit 7e555f
/**
Packit 7e555f
 * xkl_config_rec_get_from_server:
Packit 7e555f
 * @data: buffer for XKB configuration
Packit 7e555f
 * @engine: the engine
Packit 7e555f
 *
Packit 7e555f
 * Loads the current XKB configuration (from X server)
Packit 7e555f
 *
Packit 7e555f
 * Returns: TRUE on success
Packit 7e555f
 */
Packit 7e555f
	extern gboolean xkl_config_rec_get_from_server(XklConfigRec * data,
Packit 7e555f
						       XklEngine * engine);
Packit 7e555f
Packit 7e555f
/**
Packit 7e555f
 * xkl_config_rec_get_from_backup:
Packit 7e555f
 * @data: buffer for XKB configuration
Packit 7e555f
 * @engine: the engine
Packit 7e555f
 *
Packit 7e555f
 * Loads the current XKB configuration (from backup)
Packit 7e555f
 *
Packit 7e555f
 * Returns: TRUE on success
Packit 7e555f
 */
Packit 7e555f
	extern gboolean xkl_config_rec_get_from_backup(XklConfigRec * data,
Packit 7e555f
						       XklEngine * engine);
Packit 7e555f
Packit 7e555f
/**
Packit 7e555f
 * xkl_config_rec_write_to_file:
Packit 7e555f
 * @file_name: name of the file to create
Packit 7e555f
 * @data: valid XKB configuration
Packit 7e555f
 * description. Can be NULL
Packit 7e555f
 * @binary: flag indicating whether the output file should be binary
Packit 7e555f
 * @engine: the engine
Packit 7e555f
 *
Packit 7e555f
 * Writes some XKB configuration into XKM/XKB/... file
Packit 7e555f
 *
Packit 7e555f
 * Returns: TRUE on success
Packit 7e555f
 */
Packit 7e555f
	extern gboolean xkl_config_rec_write_to_file(XklEngine * engine,
Packit 7e555f
						     const gchar *
Packit 7e555f
						     file_name,
Packit 7e555f
						     const XklConfigRec *
Packit 7e555f
						     data,
Packit 7e555f
						     const gboolean
Packit 7e555f
						     binary);
Packit 7e555f
Packit 7e555f
/**
Packit 7e555f
 * xkl_config_rec_get_from_root_window_property:
Packit 7e555f
 * @rules_atom_name: atom name of the root window property to read
Packit 7e555f
 * @rules_file_out: pointer to hold the file name
Packit 7e555f
 * @config_out: buffer to hold the result
Packit 7e555f
 * @engine: the engine
Packit 7e555f
 *
Packit 7e555f
 * Gets the XKB configuration from any root window property
Packit 7e555f
 *
Packit 7e555f
 * Returns: TRUE on success
Packit 7e555f
 */
Packit 7e555f
	extern gboolean
Packit 7e555f
	    xkl_config_rec_get_from_root_window_property(XklConfigRec *
Packit 7e555f
							 config_out,
Packit 7e555f
							 Atom
Packit 7e555f
							 rules_atom_name,
Packit 7e555f
							 gchar **
Packit 7e555f
							 rules_file_out,
Packit 7e555f
							 XklEngine *
Packit 7e555f
							 engine);
Packit 7e555f
Packit 7e555f
/**
Packit 7e555f
 * xkl_config_rec_set_to_root_window_property:
Packit 7e555f
 * @rules_atom_name: atom name of the root window property to write
Packit 7e555f
 * @rules_file: rules file name
Packit 7e555f
 * @config: configuration to save 
Packit 7e555f
 * @engine: the engine
Packit 7e555f
 *
Packit 7e555f
 * Saves the XKB configuration into any root window property
Packit 7e555f
 *
Packit 7e555f
 * Returns: TRUE on success
Packit 7e555f
 */
Packit 7e555f
	extern gboolean xkl_config_rec_set_to_root_window_property(const
Packit 7e555f
								   XklConfigRec
Packit 7e555f
								   *
Packit 7e555f
								   config,
Packit 7e555f
								   Atom
Packit 7e555f
								   rules_atom_name,
Packit 7e555f
								   gchar *
Packit 7e555f
								   rules_file,
Packit 7e555f
								   XklEngine
Packit 7e555f
								   *
Packit 7e555f
								   engine);
Packit 7e555f
Packit 7e555f
/**
Packit 7e555f
 * xkl_engine_backup_names_prop:
Packit 7e555f
 * @engine: the engine
Packit 7e555f
 *
Packit 7e555f
 * Backups current XKB configuration into some property - 
Packit 7e555f
 * if this property is not defined yet.
Packit 7e555f
 *
Packit 7e555f
 * Returns: TRUE on success
Packit 7e555f
 */
Packit 7e555f
	extern gboolean xkl_engine_backup_names_prop(XklEngine * engine);
Packit 7e555f
Packit 7e555f
/**
Packit 7e555f
 * xkl_restore_names_prop:
Packit 7e555f
 * @engine: the engine
Packit 7e555f
 *
Packit 7e555f
 * Restores XKB from the property saved by xkl_backup_names_prop
Packit 7e555f
 *
Packit 7e555f
 * Returns: TRUE on success
Packit 7e555f
 */
Packit 7e555f
	extern gboolean xkl_restore_names_prop(XklEngine * engine);
Packit 7e555f
Packit 7e555f
/**
Packit 7e555f
 * xkl_config_rec_reset:
Packit 7e555f
 * @data: record to reset
Packit 7e555f
 *
Packit 7e555f
 * Resets the record (equal to Destroy and Init)
Packit 7e555f
 */
Packit 7e555f
	extern void xkl_config_rec_reset(XklConfigRec * data);
Packit 7e555f
Packit 7e555f
/**
Packit 7e555f
 * xkl_config_rec_equals:
Packit 7e555f
 * @data1: record to compare
Packit 7e555f
 * @data2: another record
Packit 7e555f
 *
Packit 7e555f
 * Compares two records
Packit 7e555f
 *
Packit 7e555f
 * Returns: TRUE if records are same
Packit 7e555f
 */
Packit 7e555f
	extern gboolean xkl_config_rec_equals(XklConfigRec * data1,
Packit 7e555f
					      XklConfigRec * data2);
Packit 7e555f
Packit 7e555f
/**
Packit 7e555f
 * xkl_config_rec_set_layouts:
Packit 7e555f
 * @data: record to change
Packit 7e555f
 * @new_layouts: (array zero-terminated=1) (transfer none): zero terminated
Packit 7e555f
 * list of new layout names.
Packit 7e555f
 *
Packit 7e555f
 * Sets a new layout list. 
Packit 7e555f
 *
Packit 7e555f
 * Frees the previous layout list. This is primarily useful for bindings, in C
Packit 7e555f
 * you can manipulate the @layouts record member directly.
Packit 7e555f
 */
Packit 7e555f
	extern void xkl_config_rec_set_layouts(XklConfigRec * data,
Packit 7e555f
					       const gchar ** new_layouts);
Packit 7e555f
Packit 7e555f
/**
Packit 7e555f
 * xkl_config_rec_set_variants:
Packit 7e555f
 * @data: record to change
Packit 7e555f
 * @new_variants: (transfer none) (array zero-terminated=1): zero terminated
Packit 7e555f
 * list of new variant names.
Packit 7e555f
 *
Packit 7e555f
 * Sets a new variant list. 
Packit 7e555f
 *
Packit 7e555f
 * Frees the previous variant list. This is primarily useful for bindings, in C
Packit 7e555f
 * you can manipulate the @variants record member directly.
Packit 7e555f
 */
Packit 7e555f
	extern void xkl_config_rec_set_variants(XklConfigRec * data,
Packit 7e555f
						const gchar ** new_variants);
Packit 7e555f
Packit 7e555f
/**
Packit 7e555f
 * xkl_config_rec_set_options:
Packit 7e555f
 * @data: record to change
Packit 7e555f
 * @new_options: (transfer none) (array zero-terminated=1): zero terminated
Packit 7e555f
 * list of new option names.
Packit 7e555f
 *
Packit 7e555f
 * Sets a new option list. 
Packit 7e555f
 *
Packit 7e555f
 * Frees the previous option list. This is primarily useful for bindings, in C
Packit 7e555f
 * you can manipulate the @options record member directly.
Packit 7e555f
 */
Packit 7e555f
	extern void xkl_config_rec_set_options(XklConfigRec * data,
Packit 7e555f
					       const gchar ** new_options);
Packit 7e555f
Packit 7e555f
/**
Packit 7e555f
 * xkl_config_rec_set_model:
Packit 7e555f
 * @data: record to change
Packit 7e555f
 * @new_model: (transfer none): new keyboard name.
Packit 7e555f
 *
Packit 7e555f
 * Sets a new model. 
Packit 7e555f
 *
Packit 7e555f
 * Frees the previous model. This is primarily useful for bindings, in C
Packit 7e555f
 * you can manipulate the @model record member directly.
Packit 7e555f
 */
Packit 7e555f
	extern void xkl_config_rec_set_model(XklConfigRec * data,
Packit 7e555f
					     const gchar * new_model);
Packit 7e555f
Packit 7e555f
#ifdef __cplusplus
Packit 7e555f
}
Packit 7e555f
#endif				/* __cplusplus */
Packit 7e555f
#endif