Blame src/ibusfactory.h

Packit 3ff832
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
Packit 3ff832
/* vim:set et sts=4: */
Packit 3ff832
/* ibus - The Input Bus
Packit 3ff832
 * Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
Packit 3ff832
 * Copyright (C) 2008-2013 Red Hat, Inc.
Packit 3ff832
 *
Packit 3ff832
 * This library is free software; you can redistribute it and/or
Packit 3ff832
 * modify it under the terms of the GNU Lesser General Public
Packit 3ff832
 * License as published by the Free Software Foundation; either
Packit 3ff832
 * version 2.1 of the License, or (at your option) any later version.
Packit 3ff832
 *
Packit 3ff832
 * This library is distributed in the hope that it will be useful,
Packit 3ff832
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 3ff832
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 3ff832
 * Lesser General Public License for more details.
Packit 3ff832
 *
Packit 3ff832
 * You should have received a copy of the GNU Lesser General Public
Packit 3ff832
 * License along with this library; if not, write to the Free Software
Packit 3ff832
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
Packit 3ff832
 * USA
Packit 3ff832
 */
Packit 3ff832
Packit 3ff832
#if !defined (__IBUS_H_INSIDE__) && !defined (IBUS_COMPILATION)
Packit 3ff832
#error "Only <ibus.h> can be included directly"
Packit 3ff832
#endif
Packit 3ff832
Packit 3ff832
#ifndef __IBUS_FACTORY_H_
Packit 3ff832
#define __IBUS_FACTORY_H_
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * SECTION: ibusfactory
Packit 3ff832
 * @short_description: Factory for creating engine instances.
Packit 3ff832
 * @title: IBusFactory
Packit 3ff832
 * @stability: Stable
Packit 3ff832
 *
Packit 3ff832
 * An IBusFactory is an #IBusService that creates input method engine (IME) instance.
Packit 3ff832
 * It provides CreateEngine remote method, which creates an IME instance by name,
Packit 3ff832
 * and returns the D-Bus object path to IBus daemon.
Packit 3ff832
 *
Packit 3ff832
 * see_also: #IBusEngine
Packit 3ff832
 *
Packit 3ff832
 */
Packit 3ff832
Packit 3ff832
#include "ibusservice.h"
Packit 3ff832
#include "ibusserializable.h"
Packit 3ff832
#include "ibusengine.h"
Packit 3ff832
Packit 3ff832
G_BEGIN_DECLS
Packit 3ff832
Packit 3ff832
/*
Packit 3ff832
 * Type macros.
Packit 3ff832
 */
Packit 3ff832
Packit 3ff832
/* define GOBJECT macros */
Packit 3ff832
/**
Packit 3ff832
 * IBUS_TYPE_FACTORY:
Packit 3ff832
 *
Packit 3ff832
 * Return GType of IBus factory.
Packit 3ff832
 */
Packit 3ff832
#define IBUS_TYPE_FACTORY               \
Packit 3ff832
    (ibus_factory_get_type ())
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * IBUS_FACTORY:
Packit 3ff832
 * @obj: An object which is subject to casting.
Packit 3ff832
 *
Packit 3ff832
 * Casts an IBUS_FACTORY or derived pointer into a (IBusFactory*) pointer.
Packit 3ff832
 * Depending on the current debugging level, this function may invoke
Packit 3ff832
 * certain runtime checks to identify invalid casts.
Packit 3ff832
 */
Packit 3ff832
#define IBUS_FACTORY(obj)               \
Packit 3ff832
    (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_FACTORY, IBusFactory))
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * IBUS_FACTORY_CLASS:
Packit 3ff832
 * @klass: A class to be casted.
Packit 3ff832
 *
Packit 3ff832
 * Casts a derived IBusFactoryClass structure into a IBusFactoryClass structure.
Packit 3ff832
 */
Packit 3ff832
#define IBUS_FACTORY_CLASS(klass)       \
Packit 3ff832
    (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_FACTORY, IBusFactoryClass))
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * IBUS_IS_FACTORY:
Packit 3ff832
 * @obj: Instance to check for being a IBUS_FACTORY.
Packit 3ff832
 *
Packit 3ff832
 * Checks whether a valid GTypeInstance pointer is of type IBUS_FACTORY.
Packit 3ff832
 */
Packit 3ff832
#define IBUS_IS_FACTORY(obj)            \
Packit 3ff832
    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_FACTORY))
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * IBUS_IS_FACTORY_CLASS:
Packit 3ff832
 * @klass: A class to be checked.
Packit 3ff832
 *
Packit 3ff832
 * Checks whether class "is a" valid IBusFactoryClass structure of type IBUS_FACTORY or derived.
Packit 3ff832
 */
Packit 3ff832
#define IBUS_IS_FACTORY_CLASS(klass)    \
Packit 3ff832
    (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_FACTORY))
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * IBUS_FACTORY_GET_CLASS:
Packit 3ff832
 * @obj: An object.
Packit 3ff832
 *
Packit 3ff832
 * Get the class of a given object and cast the class to IBusFactoryClass.
Packit 3ff832
 */
Packit 3ff832
#define IBUS_FACTORY_GET_CLASS(obj)     \
Packit 3ff832
    (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_FACTORY, IBusFactoryClass))
Packit 3ff832
Packit 3ff832
typedef struct _IBusFactory IBusFactory;
Packit 3ff832
typedef struct _IBusFactoryClass IBusFactoryClass;
Packit 3ff832
typedef struct _IBusFactoryPrivate IBusFactoryPrivate;
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * IBusFactory:
Packit 3ff832
 *
Packit 3ff832
 * An opaque data type representing an IBusFactory.
Packit 3ff832
 */
Packit 3ff832
struct _IBusFactory {
Packit 3ff832
    /*< private >*/
Packit 3ff832
    IBusService parent;
Packit 3ff832
    IBusFactoryPrivate *priv;
Packit 3ff832
Packit 3ff832
    /* instance members */
Packit 3ff832
};
Packit 3ff832
Packit 3ff832
struct _IBusFactoryClass {
Packit 3ff832
    /*< private >*/
Packit 3ff832
    IBusServiceClass parent;
Packit 3ff832
Packit 3ff832
    /*< public >*/
Packit 3ff832
    /* signals */
Packit 3ff832
    IBusEngine *
Packit 3ff832
                (* create_engine)
Packit 3ff832
                                    (IBusFactory    *factory,
Packit 3ff832
                                     const gchar    *engine_name);
Packit 3ff832
Packit 3ff832
    /*< private >*/
Packit 3ff832
    /* padding */
Packit 3ff832
    gpointer pdummy[7];
Packit 3ff832
};
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_factory_info_get_type:
Packit 3ff832
 *
Packit 3ff832
 * Gets GType of IBus factory information.
Packit 3ff832
 *
Packit 3ff832
 * Returns: GType of IBus factory information.
Packit 3ff832
 */
Packit 3ff832
GType            ibus_factory_get_type          (void);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_factory_new:
Packit 3ff832
 * @connection: An GDBusConnection.
Packit 3ff832
 *
Packit 3ff832
 * Creates a new #IBusFactory.
Packit 3ff832
 *
Packit 3ff832
 * Returns: A newly allocated #IBusFactory.
Packit 3ff832
 */
Packit 3ff832
IBusFactory     *ibus_factory_new               (GDBusConnection *connection);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_factory_add_engine:
Packit 3ff832
 * @factory: An IBusFactory.
Packit 3ff832
 * @engine_name: Name of an engine.
Packit 3ff832
 * @engine_type: GType of an engine.
Packit 3ff832
 *
Packit 3ff832
 * Add an engine to the factory.
Packit 3ff832
 */
Packit 3ff832
void             ibus_factory_add_engine        (IBusFactory    *factory,
Packit 3ff832
                                                 const gchar    *engine_name,
Packit 3ff832
                                                 GType           engine_type);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_factory_create_engine:
Packit 3ff832
 * @factory: An #IBusFactory.
Packit 3ff832
 * @engine_name: Name of an engine.
Packit 3ff832
 *
Packit 3ff832
 * Creates an #IBusEngine with @engine_name.
Packit 3ff832
 *
Packit 3ff832
 * Returns: (transfer full): #IBusEngine with @engine_name.
Packit 3ff832
 */
Packit 3ff832
IBusEngine      *ibus_factory_create_engine     (IBusFactory    *factory,
Packit 3ff832
                                                 const gchar    *engine_name);
Packit 3ff832
Packit 3ff832
G_END_DECLS
Packit 3ff832
#endif
Packit 3ff832