Blame src/ibushotkey.h

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