Blame src/ibushotkey.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_HOTKEY_H_
Packit 3ff832
#define __IBUS_HOTKEY_H_
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * SECTION: ibushotkey
Packit 3ff832
 * @short_description: Hotkeys and associated events.
Packit 3ff832
 * @stability: Stable
Packit 3ff832
 *
Packit 3ff832
 * An IBusHotkeyProfile associates a hotkey and an event.
Packit 3ff832
 */
Packit 3ff832
Packit 3ff832
#include "ibusserializable.h"
Packit 3ff832
Packit 3ff832
/*
Packit 3ff832
 * Type macros.
Packit 3ff832
 */
Packit 3ff832
/* define IBusHotkeyProfile macros */
Packit 3ff832
#define IBUS_TYPE_HOTKEY_PROFILE             \
Packit 3ff832
    (ibus_hotkey_profile_get_type ())
Packit 3ff832
#define IBUS_HOTKEY_PROFILE(obj)             \
Packit 3ff832
    (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_HOTKEY_PROFILE, IBusHotkeyProfile))
Packit 3ff832
#define IBUS_HOTKEY_PROFILE_CLASS(klass)     \
Packit 3ff832
    (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_HOTKEY_PROFILE, IBusHotkeyProfileClass))
Packit 3ff832
#define IBUS_IS_HOTKEY_PROFILE(obj)          \
Packit 3ff832
    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_HOTKEY_PROFILE))
Packit 3ff832
#define IBUS_IS_HOTKEY_PROFILE_CLASS(klass)  \
Packit 3ff832
    (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_HOTKEY_PROFILE))
Packit 3ff832
#define IBUS_HOTKEY_PROFILE_GET_CLASS(obj)   \
Packit 3ff832
    (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_HOTKEY_PROFILE, IBusHotkeyProfileClass))
Packit 3ff832
Packit 3ff832
G_BEGIN_DECLS
Packit 3ff832
Packit 3ff832
typedef struct _IBusHotkeyProfile IBusHotkeyProfile;
Packit 3ff832
typedef struct _IBusHotkeyProfileClass IBusHotkeyProfileClass;
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * IBusHotkeyProfile:
Packit 3ff832
 *
Packit 3ff832
 * An opaque data type representing an IBusHotkeyProfile.
Packit 3ff832
 */
Packit 3ff832
struct _IBusHotkeyProfile {
Packit 3ff832
    IBusSerializable parent;
Packit 3ff832
Packit 3ff832
    /* members */
Packit 3ff832
};
Packit 3ff832
Packit 3ff832
struct _IBusHotkeyProfileClass {
Packit 3ff832
    IBusSerializableClass parent;
Packit 3ff832
Packit 3ff832
    void (* trigger) (IBusHotkeyProfile *profile,
Packit 3ff832
                      GQuark             event,
Packit 3ff832
                      gpointer           user_data);
Packit 3ff832
};
Packit 3ff832
Packit 3ff832
/* hotkey profile functions */
Packit 3ff832
GType            ibus_hotkey_profile_get_type   (void);
Packit 3ff832
/**
Packit 3ff832
 * ibus_hotkey_profile_new:
Packit 3ff832
 *
Packit 3ff832
 * Creates a new #IBusHotkeyProfile.
Packit 3ff832
 *
Packit 3ff832
 * Returns: A newly allocated #IBusHotkeyProfile.
Packit 3ff832
 */
Packit 3ff832
IBusHotkeyProfile
Packit 3ff832
                *ibus_hotkey_profile_new        (void);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_hotkey_profile_add_hotkey :
Packit 3ff832
 * @profile: An IBusHotkeyProfile.
Packit 3ff832
 * @keyval: Keycode of the hotkey.
Packit 3ff832
 * @modifiers: Modifiers of the hotkey.
Packit 3ff832
 * @event: The event to be associated.
Packit 3ff832
 *
Packit 3ff832
 * Adds a hotkey and its associated event to an #IBusHotkeyProfile.
Packit 3ff832
 *
Packit 3ff832
 * Returns: Always %TRUE.
Packit 3ff832
 */
Packit 3ff832
gboolean         ibus_hotkey_profile_add_hotkey (IBusHotkeyProfile  *profile,
Packit 3ff832
                                                 guint               keyval,
Packit 3ff832
                                                 guint               modifiers,
Packit 3ff832
                                                 GQuark              event);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_hotkey_profile_add_hotkey_from_string:
Packit 3ff832
 * @profile: An IBusHotkeyProfile.
Packit 3ff832
 * @str: Key in string representation.  '+' is the separator.
Packit 3ff832
 * @event: The event to be associated.
Packit 3ff832
 *
Packit 3ff832
 * Adds a hotkey and its associated event to an #IBusHotkeyProfile.
Packit 3ff832
 * The hotkey is in string format, such like
Packit 3ff832
 * <constant>Control+Shift+A</constant>.
Packit 3ff832
 *
Packit 3ff832
 * Returns: FALSE if @str contains invalid symbol; TRUE otherwise.
Packit 3ff832
 */
Packit 3ff832
gboolean         ibus_hotkey_profile_add_hotkey_from_string
Packit 3ff832
                                                (IBusHotkeyProfile  *profile,
Packit 3ff832
                                                 const gchar        *str,
Packit 3ff832
                                                 GQuark              event);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_hotkey_profile_remove_hotkey:
Packit 3ff832
 * @profile: An IBusHotkeyProfile.
Packit 3ff832
 * @keyval: Keycode of the hotkey.
Packit 3ff832
 * @modifiers: Modifiers of the hotkey.
Packit 3ff832
 *
Packit 3ff832
 * Removes the hotkey for an #IBusHotkeyProfile.
Packit 3ff832
 *
Packit 3ff832
 * Returns: %FALSE if the key is not in @profile, %TRUE otherwise.
Packit 3ff832
 */
Packit 3ff832
gboolean         ibus_hotkey_profile_remove_hotkey
Packit 3ff832
                                                (IBusHotkeyProfile  *profile,
Packit 3ff832
                                                 guint               keyval,
Packit 3ff832
                                                 guint               modifiers);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_hotkey_profile_remove_hotkey_by_event:
Packit 3ff832
 * @profile: An IBusHotkeyProfile.
Packit 3ff832
 * @event: The associated event.
Packit 3ff832
 *
Packit 3ff832
 * Removes the hotkey for an #IBusHotkeyProfile by event.
Packit 3ff832
 *
Packit 3ff832
 * Returns: %FALSE if no such event in @profile, %TRUE otherwise.
Packit 3ff832
 */
Packit 3ff832
gboolean         ibus_hotkey_profile_remove_hotkey_by_event
Packit 3ff832
                                                (IBusHotkeyProfile  *profile,
Packit 3ff832
                                                 GQuark              event);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_hotkey_profile_filter_key_event:
Packit 3ff832
 * @profile: An IBusHotkeyProfile.
Packit 3ff832
 * @keyval: Keycode of the hotkey.
Packit 3ff832
 * @modifiers: Modifiers of the hotkey.
Packit 3ff832
 * @prev_keyval: Keycode of the hotkey.
Packit 3ff832
 * @prev_modifiers: Modifiers of the hotkey.
Packit 3ff832
 * @user_data: user data for signal "trigger".
Packit 3ff832
 *
Packit 3ff832
 * Emits a <constant>::trigger</constant> signal when a hotkey is in a profile.
Packit 3ff832
 *
Packit 3ff832
 * Returns: 0 if releasing a hotkey and the hotkey is not in the profile;
Packit 3ff832
 * an associated event otherwise.
Packit 3ff832
 *
Packit 3ff832
 * See also: ::trigger
Packit 3ff832
 */
Packit 3ff832
GQuark           ibus_hotkey_profile_filter_key_event
Packit 3ff832
                                                (IBusHotkeyProfile  *profile,
Packit 3ff832
                                                 guint               keyval,
Packit 3ff832
                                                 guint               modifiers,
Packit 3ff832
                                                 guint               prev_keyval,
Packit 3ff832
                                                 guint               prev_modifiers,
Packit 3ff832
                                                 gpointer            user_data);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_hotkey_profile_lookup_hotkey:
Packit 3ff832
 * @profile: An IBusHotkeyProfile.
Packit 3ff832
 * @keyval: Keycode of the hotkey.
Packit 3ff832
 * @modifiers: Modifiers of the hotkey.
Packit 3ff832
 *
Packit 3ff832
 * Returns: The event associated to the hotkey or 0 if the hotkey is not in the
Packit 3ff832
 * profile.
Packit 3ff832
 */
Packit 3ff832
GQuark           ibus_hotkey_profile_lookup_hotkey
Packit 3ff832
                                                (IBusHotkeyProfile  *profile,
Packit 3ff832
                                                 guint               keyval,
Packit 3ff832
                                                 guint               modifiers);
Packit 3ff832
Packit 3ff832
G_END_DECLS
Packit 3ff832
#endif