Blame src/ibuspanelservice.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) 2009-2014 Google Inc. All rights reserved.
Packit 3ff832
 * Copyright (c) 2017-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
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_PANEL_SERVICE_H_
Packit 3ff832
#define __IBUS_PANEL_SERVICE_H_
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * SECTION: ibuspanelservice
Packit 3ff832
 * @short_description: Panel service back-end.
Packit 3ff832
 * @stability: Stable
Packit 3ff832
 *
Packit 3ff832
 * An IBusPanelService is a base class for UI services.
Packit 3ff832
 * Developers can "extend" this class for panel UI development.
Packit 3ff832
 */
Packit 3ff832
#include "ibuslookuptable.h"
Packit 3ff832
#include "ibusservice.h"
Packit 3ff832
#include "ibusproplist.h"
Packit 3ff832
#include "ibusxevent.h"
Packit 3ff832
Packit 3ff832
/*
Packit 3ff832
 * Type macros.
Packit 3ff832
 */
Packit 3ff832
Packit 3ff832
/* define GOBJECT macros */
Packit 3ff832
#define IBUS_TYPE_PANEL_SERVICE                \
Packit 3ff832
    (ibus_panel_service_get_type ())
Packit 3ff832
#define IBUS_PANEL_SERVICE(obj)                        \
Packit 3ff832
    (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_PANEL_SERVICE, IBusPanelService))
Packit 3ff832
#define IBUS_PANEL_SERVICE_CLASS(klass)        \
Packit 3ff832
    (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_PANEL_SERVICE, IBusPanelServiceClass))
Packit 3ff832
#define IBUS_IS_PANEL_SERVICE(obj)                     \
Packit 3ff832
    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_PANEL_SERVICE))
Packit 3ff832
#define IBUS_IS_PANEL_SERVICE_CLASS(klass)             \
Packit 3ff832
    (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_PANEL_SERVICE))
Packit 3ff832
#define IBUS_PANEL_SERVICE_GET_CLASS(obj)      \
Packit 3ff832
    (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_PANEL_SERVICE, IBusPanelServiceClass))
Packit 3ff832
Packit 3ff832
G_BEGIN_DECLS
Packit 3ff832
Packit 3ff832
typedef struct _IBusPanelService IBusPanelService;
Packit 3ff832
typedef struct _IBusPanelServiceClass IBusPanelServiceClass;
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * IBusPanelService:
Packit 3ff832
 *
Packit 3ff832
 * An opaque data type representing an IBusPanelService.
Packit 3ff832
 */
Packit 3ff832
struct _IBusPanelService {
Packit 3ff832
    IBusService parent;
Packit 3ff832
    /* instance members */
Packit 3ff832
};
Packit 3ff832
Packit 3ff832
struct _IBusPanelServiceClass {
Packit 3ff832
    IBusServiceClass parent;
Packit 3ff832
Packit 3ff832
    /* class members */
Packit 3ff832
    void     (* focus_in)                  (IBusPanelService       *panel,
Packit 3ff832
                                            const gchar
Packit 3ff832
                                                   *input_context_path);
Packit 3ff832
    void     (* focus_out)                 (IBusPanelService       *panel,
Packit 3ff832
                                            const gchar
Packit 3ff832
                                                   *input_context_path);
Packit 3ff832
    void     (* register_properties)       (IBusPanelService       *panel,
Packit 3ff832
                                            IBusPropList           *prop_list);
Packit 3ff832
    void     (* set_cursor_location)       (IBusPanelService       *panel,
Packit 3ff832
                                            gint                    x,
Packit 3ff832
                                            gint                    y,
Packit 3ff832
                                            gint                    w,
Packit 3ff832
                                            gint                    h);
Packit 3ff832
    void     (* update_auxiliary_text)     (IBusPanelService       *panel,
Packit 3ff832
                                            IBusText               *text,
Packit 3ff832
                                            gboolean                visible);
Packit 3ff832
    void     (* update_lookup_table)       (IBusPanelService       *panel,
Packit 3ff832
                                            IBusLookupTable        *lookup_table,
Packit 3ff832
                                            gboolean                visible);
Packit 3ff832
    void     (* update_preedit_text)       (IBusPanelService       *panel,
Packit 3ff832
                                            IBusText               *text,
Packit 3ff832
                                            guint                  cursor_pos,
Packit 3ff832
                                            gboolean               visible);
Packit 3ff832
    void     (* update_property)           (IBusPanelService       *panel,
Packit 3ff832
                                            IBusProperty           *prop);
Packit 3ff832
    void     (* cursor_down_lookup_table)  (IBusPanelService       *panel);
Packit 3ff832
    void     (* cursor_up_lookup_table)    (IBusPanelService       *panel);
Packit 3ff832
    void     (* hide_auxiliary_text)       (IBusPanelService       *panel);
Packit 3ff832
    void     (* hide_language_bar)         (IBusPanelService       *panel);
Packit 3ff832
    void     (* hide_lookup_table)         (IBusPanelService       *panel);
Packit 3ff832
    void     (* hide_preedit_text)         (IBusPanelService       *panel);
Packit 3ff832
    void     (* page_down_lookup_table)    (IBusPanelService       *panel);
Packit 3ff832
    void     (* page_up_lookup_table)      (IBusPanelService       *panel);
Packit 3ff832
    void     (* reset)                     (IBusPanelService       *panel);
Packit 3ff832
    void     (* show_auxiliary_text)       (IBusPanelService       *panel);
Packit 3ff832
    void     (* show_language_bar)         (IBusPanelService       *panel);
Packit 3ff832
    void     (* show_lookup_table)         (IBusPanelService       *panel);
Packit 3ff832
    void     (* show_preedit_text)         (IBusPanelService       *panel);
Packit 3ff832
    void     (* start_setup)               (IBusPanelService       *panel);
Packit 3ff832
    void     (* state_changed)             (IBusPanelService       *panel);
Packit 3ff832
    void     (* destroy_context)           (IBusPanelService       *panel,
Packit 3ff832
                                            const gchar
Packit 3ff832
                                                   *input_context_path);
Packit 3ff832
    void     (* set_content_type)          (IBusPanelService       *panel,
Packit 3ff832
                                            guint                   purpose,
Packit 3ff832
                                            guint                   hints);
Packit 3ff832
    void     (* set_cursor_location_relative)
Packit 3ff832
                                           (IBusPanelService       *panel,
Packit 3ff832
                                            gint                    x,
Packit 3ff832
                                            gint                    y,
Packit 3ff832
                                            gint                    w,
Packit 3ff832
                                            gint                    h);
Packit 3ff832
    void     (* panel_extension_received)
Packit 3ff832
                                           (IBusPanelService       *panel,
Packit 3ff832
                                            IBusExtensionEvent     *event);
Packit 3ff832
    gboolean (* process_key_event)
Packit 3ff832
                                           (IBusPanelService       *panel,
Packit 3ff832
                                            guint                   keyval,
Packit 3ff832
                                            guint                   keycode,
Packit 3ff832
                                            guint                   state);
Packit 3ff832
    void     (* commit_text_received)
Packit 3ff832
                                           (IBusPanelService       *panel,
Packit 3ff832
                                            IBusText               *text);
Packit 3ff832
    void     (* candidate_clicked_lookup_table)
Packit 3ff832
                                           (IBusPanelService       *panel,
Packit 3ff832
                                            guint                   index,
Packit 3ff832
                                            guint                   button,
Packit 3ff832
                                            guint                   state);
Packit 3ff832
Packit 3ff832
    /*< private >*/
Packit 3ff832
    /* padding */
Packit 3ff832
    gpointer pdummy[2];  // We can add 8 pointers without breaking the ABI.
Packit 3ff832
};
Packit 3ff832
Packit 3ff832
GType            ibus_panel_service_get_type  (void);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_panel_service_new:
Packit 3ff832
 * @connection: An GDBusConnection.
Packit 3ff832
 *
Packit 3ff832
 * Creates a new #IBusPanelService from an #GDBusConnection.
Packit 3ff832
 *
Packit 3ff832
 * Returns: A newly allocated #IBusPanelService.
Packit 3ff832
 */
Packit 3ff832
IBusPanelService *ibus_panel_service_new (GDBusConnection    *connection);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_panel_service_candidate_clicked:
Packit 3ff832
 * @panel: An IBusPanelService
Packit 3ff832
 * @index: Index in the Lookup table
Packit 3ff832
 * @button: GdkEventButton::button (1: left button, etc.)
Packit 3ff832
 * @state: GdkEventButton::state (key modifier flags)
Packit 3ff832
 *
Packit 3ff832
 * Notify that a candidate is clicked
Packit 3ff832
 * by sending a "CandidateClicked" to IBus service.
Packit 3ff832
 */
Packit 3ff832
void ibus_panel_service_candidate_clicked (IBusPanelService *panel,
Packit 3ff832
                                           guint             index,
Packit 3ff832
                                           guint             button,
Packit 3ff832
                                           guint             state);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_panel_service_cursor_down:
Packit 3ff832
 * @panel: An IBusPanelService
Packit 3ff832
 *
Packit 3ff832
 * Notify that the cursor is down
Packit 3ff832
 * by sending a "CursorDown" to IBus service.
Packit 3ff832
 */
Packit 3ff832
void ibus_panel_service_cursor_down       (IBusPanelService *panel);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_panel_service_cursor_up:
Packit 3ff832
 * @panel: An IBusPanelService
Packit 3ff832
 *
Packit 3ff832
 * Notify that the cursor is up
Packit 3ff832
 * by sending a "CursorUp" to IBus service.
Packit 3ff832
 */
Packit 3ff832
void ibus_panel_service_cursor_up         (IBusPanelService *panel);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_panel_service_page_down:
Packit 3ff832
 * @panel: An IBusPanelService
Packit 3ff832
 *
Packit 3ff832
 * Notify that the page is down
Packit 3ff832
 * by sending a "PageDown" to IBus service.
Packit 3ff832
 */
Packit 3ff832
void ibus_panel_service_page_down         (IBusPanelService *panel);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_panel_service_page_up:
Packit 3ff832
 * @panel: An IBusPanelService
Packit 3ff832
 *
Packit 3ff832
 * Notify that the page is up
Packit 3ff832
 * by sending a "PageUp" to IBus service.
Packit 3ff832
 */
Packit 3ff832
void ibus_panel_service_page_up           (IBusPanelService *panel);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_panel_service_property_activate:
Packit 3ff832
 * @panel: An IBusPanelService
Packit 3ff832
 * @prop_name: A property name
Packit 3ff832
 * @prop_state: State of the property
Packit 3ff832
 *
Packit 3ff832
 * Notify that a property is active
Packit 3ff832
 * by sending a "PropertyActivate" message to IBus service.
Packit 3ff832
 */
Packit 3ff832
void ibus_panel_service_property_activate (IBusPanelService *panel,
Packit 3ff832
                                           const gchar      *prop_name,
Packit 3ff832
                                           guint             prop_state);
Packit 3ff832
/**
Packit 3ff832
 * ibus_panel_service_property_show:
Packit 3ff832
 * @panel: An IBusPanelService
Packit 3ff832
 * @prop_name: A property name
Packit 3ff832
 *
Packit 3ff832
 * Notify that a property is shown
Packit 3ff832
 * by sending a "ValueChanged" message to IBus service.
Packit 3ff832
 */
Packit 3ff832
void ibus_panel_service_property_show     (IBusPanelService *panel,
Packit 3ff832
                                           const gchar      *prop_name);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_panel_service_property_hide:
Packit 3ff832
 * @panel: An IBusPanelService
Packit 3ff832
 * @prop_name: A property name
Packit 3ff832
 *
Packit 3ff832
 * Notify that a property is hidden
Packit 3ff832
 * by sending a "ValueChanged" message to IBus service.
Packit 3ff832
 */
Packit 3ff832
void ibus_panel_service_property_hide     (IBusPanelService *panel,
Packit 3ff832
                                           const gchar      *prop_name);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_panel_service_commit_text:
Packit 3ff832
 * @panel: An #IBusPanelService
Packit 3ff832
 * @text: An #IBusText
Packit 3ff832
 *
Packit 3ff832
 * Notify that a text is sent
Packit 3ff832
 * by sending a "CommitText" message to IBus service.
Packit 3ff832
 */
Packit 3ff832
void ibus_panel_service_commit_text       (IBusPanelService *panel,
Packit 3ff832
                                           IBusText         *text);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_panel_service_panel_extension:
Packit 3ff832
 * @panel: An #IBusPanelService
Packit 3ff832
 * @event: (transfer full): A #PanelExtensionEvent which is sent to a
Packit 3ff832
 *                          panel extension. 
Packit 3ff832
 *
Packit 3ff832
 * Enable or disable a panel extension with #IBusExtensionEvent.
Packit 3ff832
 * Notify that a data is sent
Packit 3ff832
 * by sending a "PanelExtension" message to IBus panel extension service.
Packit 3ff832
 */
Packit 3ff832
void ibus_panel_service_panel_extension   (IBusPanelService   *panel,
Packit 3ff832
                                           IBusExtensionEvent *event);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_panel_service_panel_extension_register_keys:
Packit 3ff832
 * @panel: An #IBusPanelService
Packit 3ff832
 * @first_property_name: the first name of the shortcut keys. This is %NULL
Packit 3ff832
 " terminated.
Packit 3ff832
 *
Packit 3ff832
 * Register shortcut keys to enable panel extensions with #IBusExtensionEvent.
Packit 3ff832
 * Notify that a data is sent
Packit 3ff832
 * by sending a "PanelExtensionRegisterKeys" message to IBus panel extension
Packit 3ff832
 * service. Seems Vala does not support uint[][3] and use
Packit 3ff832
 * IBusProcessKeyEventData[]. E.g.
Packit 3ff832
 * IBusProcessKeyEventData[] keys = {{
Packit 3ff832
 *         IBUS_KEY_e, 0, IBUS_SHIFT_MASK | IBUS_SUPER_MASK }};
Packit 3ff832
 * ibus_panel_service_panel_extension_register_keys(panel, "emoji", keys, NULL);
Packit 3ff832
 */
Packit 3ff832
void ibus_panel_service_panel_extension_register_keys
Packit 3ff832
                                           (IBusPanelService  *panel,
Packit 3ff832
                                            const gchar       *first_property_name,
Packit 3ff832
                                            ...);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_panel_service_update_preedit_text_received:
Packit 3ff832
 * @panel: An #IBusPanelService
Packit 3ff832
 * @text: Update content.
Packit 3ff832
 * @cursor_pos: Current position of cursor
Packit 3ff832
 * @visible: Whether the pre-edit buffer is visible.
Packit 3ff832
 *
Packit 3ff832
 * Notify that the preedit is updated by the panel extension
Packit 3ff832
 *
Packit 3ff832
 * (Note: The table object will be released, if it is floating.
Packit 3ff832
 *  If caller want to keep the object, caller should make the object
Packit 3ff832
 *  sink by g_object_ref_sink.)
Packit 3ff832
 */
Packit 3ff832
void ibus_panel_service_update_preedit_text_received
Packit 3ff832
                                          (IBusPanelService *panel,
Packit 3ff832
                                           IBusText         *text,
Packit 3ff832
                                           guint             cursor_pos,
Packit 3ff832
                                           gboolean          visible);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_panel_service_show_preedit_text_received:
Packit 3ff832
 * @panel: An IBusPanelService
Packit 3ff832
 *
Packit 3ff832
 * Notify that the preedit is shown by the panel extension
Packit 3ff832
 */
Packit 3ff832
void ibus_panel_service_show_preedit_text_received
Packit 3ff832
                                          (IBusPanelService *panel);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_panel_service_hide_preedit_text_received:
Packit 3ff832
 * @panel: An IBusPanelService
Packit 3ff832
 *
Packit 3ff832
 * Notify that the preedit is hidden by the panel extension
Packit 3ff832
 */
Packit 3ff832
void ibus_panel_service_hide_preedit_text_received
Packit 3ff832
                                          (IBusPanelService *panel);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_panel_service_update_auxiliary_text_received:
Packit 3ff832
 * @panel: An #IBusPanelService
Packit 3ff832
 * @text: An #IBusText
Packit 3ff832
 * @visible: Whether the auxilirary text is visible.
Packit 3ff832
 *
Packit 3ff832
 * Notify that the auxilirary is updated by the panel extension.
Packit 3ff832
 *
Packit 3ff832
 * (Note: The table object will be released, if it is floating.
Packit 3ff832
 *  If caller want to keep the object, caller should make the object
Packit 3ff832
 *  sink by g_object_ref_sink.)
Packit 3ff832
 */
Packit 3ff832
void ibus_panel_service_update_auxiliary_text_received
Packit 3ff832
                                          (IBusPanelService *panel,
Packit 3ff832
                                           IBusText         *text,
Packit 3ff832
                                           gboolean          visible);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_panel_service_update_lookup_table_received:
Packit 3ff832
 * @panel: An #IBusPanelService
Packit 3ff832
 * @table: An #IBusLookupTable
Packit 3ff832
 * @visible: Whether the lookup table is visible.
Packit 3ff832
 *
Packit 3ff832
 * Notify that the lookup table is updated by the panel extension.
Packit 3ff832
 *
Packit 3ff832
 * (Note: The table object will be released, if it is floating.
Packit 3ff832
 *  If caller want to keep the object, caller should make the object
Packit 3ff832
 *  sink by g_object_ref_sink.)
Packit 3ff832
 */
Packit 3ff832
void ibus_panel_service_update_lookup_table_received
Packit 3ff832
                                          (IBusPanelService *panel,
Packit 3ff832
                                           IBusLookupTable  *table,
Packit 3ff832
                                           gboolean          visible);
Packit 3ff832
G_END_DECLS
Packit 3ff832
#endif