gst_plugins_base/gst-libs/gst/interfaces/navigation.c
changeset 2 5505e8908944
parent 0 0e761a78d257
child 7 567bb019e3e3
equal deleted inserted replaced
1:4c282e7dd6d3 2:5505e8908944
       
     1 /* GStreamer Navigation
       
     2  * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
       
     3  *
       
     4  * navigation.c: navigation design virtual class function wrappers
       
     5  *
       
     6  * This library is free software; you can redistribute it and/or
       
     7  * modify it under the terms of the GNU Library General Public
       
     8  * License as published by the Free Software Foundation; either
       
     9  * version 2 of the License, or (at your option) any later version.
       
    10  *
       
    11  * This library is distributed in the hope that it will be useful,
       
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    14  * Library General Public License for more details.
       
    15  *
       
    16  * You should have received a copy of the GNU Library General Public
       
    17  * License along with this library; if not, write to the
       
    18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    19  * Boston, MA 02111-1307, USA.
       
    20  */
       
    21 
       
    22 #ifdef HAVE_CONFIG_H
       
    23 #include "config.h"
       
    24 #endif
       
    25 
       
    26 #include <gst/interfaces/navigation.h>
       
    27 
       
    28 static void gst_navigation_class_init (GstNavigationInterface * iface);
       
    29 #ifdef __SYMBIAN32__
       
    30 EXPORT_C
       
    31 #endif
       
    32 
       
    33 
       
    34 GType
       
    35 gst_navigation_get_type (void)
       
    36 {
       
    37   static GType gst_navigation_type = 0;
       
    38 
       
    39   if (!gst_navigation_type) {
       
    40     static const GTypeInfo gst_navigation_info = {
       
    41       sizeof (GstNavigationInterface),
       
    42       (GBaseInitFunc) gst_navigation_class_init,
       
    43       NULL,
       
    44       NULL,
       
    45       NULL,
       
    46       NULL,
       
    47       0,
       
    48       0,
       
    49       NULL,
       
    50     };
       
    51 
       
    52     gst_navigation_type = g_type_register_static (G_TYPE_INTERFACE,
       
    53         "GstNavigation", &gst_navigation_info, 0);
       
    54   }
       
    55 
       
    56   return gst_navigation_type;
       
    57 }
       
    58 
       
    59 static void
       
    60 gst_navigation_class_init (GstNavigationInterface * iface)
       
    61 {
       
    62   /* default virtual functions */
       
    63   iface->send_event = NULL;
       
    64 }
       
    65 
       
    66 /* The interface implementer should make sure that the object can handle
       
    67  * the event. */
       
    68 #ifdef __SYMBIAN32__
       
    69 EXPORT_C
       
    70 #endif
       
    71 
       
    72 void
       
    73 gst_navigation_send_event (GstNavigation * navigation, GstStructure * structure)
       
    74 {
       
    75   GstNavigationInterface *iface = GST_NAVIGATION_GET_IFACE (navigation);
       
    76 
       
    77   if (iface->send_event) {
       
    78     iface->send_event (navigation, structure);
       
    79   }
       
    80 }
       
    81 #ifdef __SYMBIAN32__
       
    82 EXPORT_C
       
    83 #endif
       
    84 
       
    85 
       
    86 void
       
    87 gst_navigation_send_key_event (GstNavigation * navigation, const char *event,
       
    88     const char *key)
       
    89 {
       
    90   gst_navigation_send_event (navigation,
       
    91       gst_structure_new ("application/x-gst-navigation", "event", G_TYPE_STRING,
       
    92           event, "key", G_TYPE_STRING, key, NULL));
       
    93 }
       
    94 #ifdef __SYMBIAN32__
       
    95 EXPORT_C
       
    96 #endif
       
    97 
       
    98 
       
    99 void
       
   100 gst_navigation_send_mouse_event (GstNavigation * navigation, const char *event,
       
   101     int button, double x, double y)
       
   102 {
       
   103   gst_navigation_send_event (navigation,
       
   104       gst_structure_new ("application/x-gst-navigation", "event", G_TYPE_STRING,
       
   105           event, "button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x,
       
   106           "pointer_y", G_TYPE_DOUBLE, y, NULL));
       
   107 }