|
Packit Service |
1d8f1c |
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
|
Packit Service |
1d8f1c |
/* vim:set et sts=4: */
|
|
Packit Service |
1d8f1c |
/* ibus - The Input Bus
|
|
Packit Service |
1d8f1c |
* Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
|
|
Packit Service |
1d8f1c |
* Copyright (C) 2008-2013 Red Hat, Inc.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* This library is free software; you can redistribute it and/or
|
|
Packit Service |
1d8f1c |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
1d8f1c |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
1d8f1c |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* This library is distributed in the hope that it will be useful,
|
|
Packit Service |
1d8f1c |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
1d8f1c |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
1d8f1c |
* Lesser General Public License for more details.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
1d8f1c |
* License along with this library; if not, write to the Free Software
|
|
Packit Service |
1d8f1c |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
|
Packit Service |
1d8f1c |
* USA
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
#if !defined (__IBUS_H_INSIDE__) && !defined (IBUS_COMPILATION)
|
|
Packit Service |
1d8f1c |
#error "Only <ibus.h> can be included directly"
|
|
Packit Service |
1d8f1c |
#endif
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
#ifndef __IBUS_OBJECT_H_
|
|
Packit Service |
1d8f1c |
#define __IBUS_OBJECT_H_
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* SECTION: ibusobject
|
|
Packit Service |
1d8f1c |
* @short_description: Base object of IBus.
|
|
Packit Service |
1d8f1c |
* @title: IBusObject
|
|
Packit Service |
1d8f1c |
* @stability: Stable
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* IBusObject is the base object for all objects in IBus.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
#include <glib-object.h>
|
|
Packit Service |
1d8f1c |
#include "ibustypes.h"
|
|
Packit Service |
1d8f1c |
#include "ibusdebug.h"
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/*
|
|
Packit Service |
1d8f1c |
* Type macros.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/* define GOBJECT macros */
|
|
Packit Service |
1d8f1c |
#define IBUS_TYPE_OBJECT \
|
|
Packit Service |
1d8f1c |
(ibus_object_get_type ())
|
|
Packit Service |
1d8f1c |
#define IBUS_OBJECT(obj) \
|
|
Packit Service |
1d8f1c |
(G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_OBJECT, IBusObject))
|
|
Packit Service |
1d8f1c |
#define IBUS_OBJECT_CLASS(klass) \
|
|
Packit Service |
1d8f1c |
(G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_OBJECT, IBusObjectClass))
|
|
Packit Service |
1d8f1c |
#define IBUS_IS_OBJECT(obj) \
|
|
Packit Service |
1d8f1c |
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_OBJECT))
|
|
Packit Service |
1d8f1c |
#define IBUS_IS_OBJECT_CLASS(klass) \
|
|
Packit Service |
1d8f1c |
(G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_OBJECT))
|
|
Packit Service |
1d8f1c |
#define IBUS_OBJECT_GET_CLASS(obj) \
|
|
Packit Service |
1d8f1c |
(G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_OBJECT, IBusObjectClass))
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* IBusObjectFlags:
|
|
Packit Service |
1d8f1c |
* @IBUS_IN_DESTRUCTION: Used in GObjectClass::dispose
|
|
Packit Service |
1d8f1c |
* @IBUS_DESTROYED: Used during emitting IBusObject::destroy signal.
|
|
Packit Service |
1d8f1c |
* @IBUS_RESERVED_1: Reserved.
|
|
Packit Service |
1d8f1c |
* @IBUS_RESERVED_2: Reserved.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* The flags are used internally.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
typedef enum {
|
|
Packit Service |
1d8f1c |
IBUS_IN_DESTRUCTION = (1 << 0),
|
|
Packit Service |
1d8f1c |
IBUS_DESTROYED = (1 << 1),
|
|
Packit Service |
1d8f1c |
IBUS_RESERVED_1 = (1 << 2),
|
|
Packit Service |
1d8f1c |
IBUS_RESERVED_2 = (1 << 3),
|
|
Packit Service |
1d8f1c |
} IBusObjectFlags;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
#define IBUS_OBJECT_FLAGS(obj) (IBUS_OBJECT (obj)->flags)
|
|
Packit Service |
1d8f1c |
#define IBUS_OBJECT_SET_FLAGS(obj,flag) G_STMT_START{ (IBUS_OBJECT_FLAGS (obj) |= (flag)); }G_STMT_END
|
|
Packit Service |
1d8f1c |
#define IBUS_OBJECT_UNSET_FLAGS(obj,flag) G_STMT_START{ (IBUS_OBJECT_FLAGS (obj) &= ~(flag)); }G_STMT_END
|
|
Packit Service |
1d8f1c |
#define IBUS_OBJECT_IN_DESTRUCTION(obj) (IBUS_OBJECT_FLAGS (obj) & IBUS_IN_DESTRUCTION)
|
|
Packit Service |
1d8f1c |
#define IBUS_OBJECT_DESTROYED(obj) (IBUS_OBJECT_FLAGS (obj) & IBUS_DESTROYED)
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
G_BEGIN_DECLS
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
typedef struct _IBusObject IBusObject;
|
|
Packit Service |
1d8f1c |
typedef struct _IBusObjectClass IBusObjectClass;
|
|
Packit Service |
1d8f1c |
typedef struct _IBusObjectPrivate IBusObjectPrivate;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* IBusObject:
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* All the fields in the <structname>IBusObject</structname> structure are
|
|
Packit Service |
1d8f1c |
* private to the #IBusObject and should never be accessed directly.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
struct _IBusObject {
|
|
Packit Service |
1d8f1c |
GInitiallyUnowned parent;
|
|
Packit Service |
1d8f1c |
/* instance members */
|
|
Packit Service |
1d8f1c |
guint32 flags;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
IBusObjectPrivate *priv;
|
|
Packit Service |
1d8f1c |
};
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
typedef void ( *IBusObjectDestroyFunc) (IBusObject *object);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
struct _IBusObjectClass {
|
|
Packit Service |
1d8f1c |
GInitiallyUnownedClass parent;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/* signals */
|
|
Packit Service |
1d8f1c |
void (* destroy) (IBusObject *object);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/*< private >*/
|
|
Packit Service |
1d8f1c |
/* padding */
|
|
Packit Service |
1d8f1c |
gpointer pdummy[7];
|
|
Packit Service |
1d8f1c |
};
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
GType ibus_object_get_type (void);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* ibus_object_new:
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Creates a new #IBusObject.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Returns: A newly allocated #IBusObject
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
IBusObject *ibus_object_new (void);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* ibus_object_destroy:
|
|
Packit Service |
1d8f1c |
* @object: an #IBusObject to destroy.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Emit the "destory" signal notifying all reference holders that they should
|
|
Packit Service |
1d8f1c |
* release the #IBusObject.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* The memory for the object itself won't be deleted until its reference count
|
|
Packit Service |
1d8f1c |
* actually drops to 0; ibus_object_destroy merely asks reference holders to
|
|
Packit Service |
1d8f1c |
* release their references. It does not free the object.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
void ibus_object_destroy (IBusObject *object);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
G_END_DECLS
|
|
Packit Service |
1d8f1c |
#endif
|
|
Packit Service |
1d8f1c |
|