1 <!-- ##### SECTION ./tmpl/color_contexts.sgml:Long_Description ##### -->
3 The #GdkColorContext type is used for allocating groups of colors.
6 It is now deprecated in favor of the gdk_colormap_*() functions described in
7 the <link linkend="gdk-Colormaps-and-Colors">Colormaps and Colors</link>
12 <!-- ##### SECTION ./tmpl/color_contexts.sgml:See_Also ##### -->
18 <!-- ##### SECTION ./tmpl/color_contexts.sgml:Short_Description ##### -->
19 routines for allocating colors (deprecated).
22 <!-- ##### SECTION ./tmpl/color_contexts.sgml:Title ##### -->
26 <!-- ##### SECTION ./tmpl/input_contexts.sgml:Long_Description ##### -->
28 A #GdkIC input context is used for each user interface element which supports
29 internationalized text input. See the
30 <link linkend="gdk-Input-Methods">Input Methods</link> section for an overview
31 of how internationalized text input works in GTK+.
35 <!-- ##### SECTION ./tmpl/input_contexts.sgml:See_Also ##### -->
41 <!-- ##### SECTION ./tmpl/input_contexts.sgml:Short_Description ##### -->
42 internationalized text input properties.
45 <!-- ##### SECTION ./tmpl/input_contexts.sgml:Title ##### -->
49 <!-- ##### SECTION ./tmpl/input_methods.sgml:Long_Description ##### -->
51 Input Methods provide a way for complex character sets to be used in GTK+.
52 Languages such as Chinese, Japanese, and Korean (often abbreviated to CJK)
53 use a large number of ideographs, making it impossible to support all
54 characters with a simple keyboard. Instead, text is usually
55 <emphasis>pre-edited</emphasis> using a phonetic alphabet and then
56 <emphasis>composed</emphasis> to form the ideographs.
59 GTK+ makes use of the input method mechanism provided by the X Windows
60 platform. When a GTK+ application is started, it opens a connection to the
61 input method appropriate for the current locale (if any).
64 Widgets which handle textual input, such as #GtkEntry, need to do a number of
65 things to support internationalized text input:
68 <term>When the widget is realized:</term>
69 <listitem><para>Check if an input method is being used with gdk_im_ready().
70 If it is, create a new <link linkend="gdk-Input-Contexts">Input Context</link>
71 using gdk_ic_new(). Find out which events the
72 <link linkend="gdk-Input-Contexts">Input Context</link> needs to receive
73 with gdk_ic_get_events(), and make sure that the widget's window receives
74 these events using gdk_window_set_events().
79 <term>When the widget's size, state or cursor position changes:</term>
81 Update the appropriate
82 <link linkend="gdk-Input-Contexts">Input Context</link> attributes
83 using gdk_ic_set_attr().
88 <term>When the keyboard focus enters or leaves the widget:</term>
90 Call gdk_im_begin() or gdk_im_end() to start or finish editing the text.
95 <term>When the widget receives a key_press event:</term>
97 The <structfield>string</structfield> and <structfield>length</structfield>
98 fields of the #GdkEventKey struct should be used to insert the composed text
104 <term>When the widget is unrealized:</term>
106 Destroy the <link linkend="gdk-Input-Contexts">Input Context</link>.
113 See the XLib reference manual for more detailed information on input methods,
114 and the #GtkEntry and #GtkText widgets for some example code.
118 <!-- ##### SECTION ./tmpl/input_methods.sgml:See_Also ##### -->
122 <term><link linkend="gdk-Input-Contexts">Input Contexts</link></term>
124 Used for each widget that handles internationalized text input using the
133 <!-- ##### SECTION ./tmpl/input_methods.sgml:Short_Description ##### -->
134 support for internationalized text input.
137 <!-- ##### SECTION ./tmpl/input_methods.sgml:Title ##### -->
141 <!-- ##### MACRO GDK_CORE_POINTER ##### -->
143 This macro contains an integer value representing
144 the device ID for the core pointer device.
148 <!-- ##### MACRO GDK_GC_X11 ##### -->
155 <!-- ##### MACRO GDK_GC_X11_GET_CLASS ##### -->
162 <!-- ##### MACRO GDK_WINDOWING_NANOX ##### -->
168 <!-- ##### STRUCT GdkColorContext ##### -->
179 @need_to_free_colormap:
188 <!-- ##### STRUCT GdkColorContextDither ##### -->
198 <!-- ##### ENUM GdkColorContextMode ##### -->
203 @GDK_CC_MODE_UNDEFINED:
205 @GDK_CC_MODE_STD_CMAP:
207 @GDK_CC_MODE_MY_GRAY:
208 @GDK_CC_MODE_PALETTE:
210 <!-- ##### STRUCT GdkDeviceClass ##### -->
216 <!-- ##### STRUCT GdkDeviceInfo ##### -->
218 The #GdkDeviceInfo structure contains information about a
219 device. It has the following fields:
222 @deviceid: a unique integer ID for this device.
223 @name: the human-readable name for the device.
224 @source: the type of device.
225 @mode: a value indicating whether the device is enabled and
226 how the device coordinates map to the screen.
227 @has_cursor: if %TRUE, a cursor will be displayed indicating
228 the current on-screen location to the user. Otherwise,
229 the application is responsible for drawing a cursor
231 @num_axes: the number of axes for this device.
232 @axes: a pointer to an array of GdkAxisUse values which
233 give the mapping of axes onto the possible valuators
235 @num_keys: the number of macro buttons.
236 @keys: a pointer to an array of #GdkDeviceKey structures
237 which describe what key press events are generated
238 for each macro button.
240 <!-- ##### STRUCT GdkDrawableClass ##### -->
246 <!-- ##### STRUCT GdkGCClass ##### -->
252 <!-- ##### STRUCT GdkIC ##### -->
254 The #GdkIC struct is an opaque structure representing an input context
255 for use with the global <link linkend="gdk-Input-Methods">Input Method</link>.
259 <!-- ##### STRUCT GdkICAttr ##### -->
261 The #GdkICAttr struct is used when getting and setting attributes of the
262 input context. It is used together with a #GdkICAttributesType mask which
263 specifies which of the fields are being set or returned.
266 @style: the pre-edit and status style. This attribute is required when
267 creating the #GdkIC, and cannot be changed.
268 @client_window: the #GdkWindow in which the input method will display its
269 pre-edit and status areas or create subwindows.
270 The preedit_area and status_area attributes are specified relative to this
271 window. This attribute is required when creating the #GdkIC, and cannot be
273 @focus_window: the #GdkWindow which is to be used when editing text.
274 gdk_im_begin() sets this attribute before starting the text input process,
275 so it is normally not necessary to set it elsewhere.
276 @filter_events: the mask of events that the input method requires.
277 See the gdk_ic_get_events() function. This attribute is read-only and is
279 @spot_location: the position of the insertion cursor, for use with the
280 %GDK_IM_PREEDIT_POSITION style. The y coordinate specifies the baseline of
282 @line_spacing: the line spacing to be used in the pre-edit and status areas
283 when displaying multi-line text.
284 @cursor: the cursor to use in the input method's windows.
285 If this attribute isn't set it is determined by the input method.
286 @preedit_fontset: the font to use for the pre-edit area.
287 If this attribute isn't set it is determined by the input method.
288 @preedit_area: the area in which the input method will display pre-editing
289 data, used for the %GDK_IM_PREEDIT_POSITION and %GDK_IM_PREEDIT_AREA styles.
290 @preedit_area_needed: the area that the input method requests for displaying
291 pre-editing data, used for the %GDK_IM_PREEDIT_POSITION and
292 %GDK_IM_PREEDIT_AREA styles.
293 @preedit_foreground: the foreground color to use for the pre-edit area.
294 This color must already be allocated in the preedit_colormap.
295 If this attribute isn't set it is determined by the input method.
296 @preedit_background: the background color to use for the pre-edit area.
297 This color must already be allocated in the preedit_colormap.
298 If this attribute isn't set it is determined by the input method.
299 @preedit_pixmap: the background pixmap to use for the pre-edit area.
300 If this attribute isn't set it is determined by the input method.
301 @preedit_colormap: the colormap the input method should use to allocate colors.
302 The default value is the colormap of client_window.
303 @status_fontset: the font to use for the status area.
304 If this attribute isn't set it is determined by the input method.
305 @status_area: the are that the input method will display status information in.
306 This is used for the %GDK_IM_STATUS_AREA style.
307 @status_area_needed: the size that the input method requests for displaying
308 status information, for the %GDK_IM_STATUS_AREA style.
309 @status_foreground: the foreground color to use for the status area.
310 This color must already be allocated in the status_colormap.
311 If this attribute isn't set it is determined by the input method.
312 @status_background: the background color to use for the status area.
313 This color must already be allocated in the status_colormap.
314 If this attribute isn't set it is determined by the input method.
315 @status_pixmap: the background pixmap to use for the status area.
316 If this attribute isn't set it is determined by the input method.
317 @status_colormap: the colormap the input method should use to allocate colors.
318 The default value is the colormap of client_window.
320 <!-- ##### ENUM GdkICAttributesType ##### -->
322 The #GdkICAttributesType contains a set of bit-flags which are used to
323 specify which of the attributes in a #GdkICAttr are being set or returned.
326 It also contains several combinations of the flags which specify required
327 attributes for the various styles:
330 <term>%GDK_IC_ALL_REQ:</term>
332 the set of attributes required for all styles.
337 <term>%GDK_IC_PREEDIT_AREA_REQ:</term>
339 the set of additional attributes required for the
340 %GDK_IM_PREEDIT_AREA pre-edit style.
345 <term>%GDK_IC_PREEDIT_POSITION_REQ:</term>
347 the set of additional attributes required for the
348 %GDK_IM_PREEDIT_POSITION pre-edit style.
353 <term>%GDK_IC_STATUS_AREA_REQ:</term>
355 the set of additional attributes required for the
356 %GDK_IM_STATUS_AREA status style.
363 @GDK_IC_CLIENT_WINDOW:
364 @GDK_IC_FOCUS_WINDOW:
365 @GDK_IC_FILTER_EVENTS:
366 @GDK_IC_SPOT_LOCATION:
367 @GDK_IC_LINE_SPACING:
369 @GDK_IC_PREEDIT_FONTSET:
370 @GDK_IC_PREEDIT_AREA:
371 @GDK_IC_PREEDIT_AREA_NEEDED:
372 @GDK_IC_PREEDIT_FOREGROUND:
373 @GDK_IC_PREEDIT_BACKGROUND:
374 @GDK_IC_PREEDIT_PIXMAP:
375 @GDK_IC_PREEDIT_COLORMAP:
376 @GDK_IC_STATUS_FONTSET:
378 @GDK_IC_STATUS_AREA_NEEDED:
379 @GDK_IC_STATUS_FOREGROUND:
380 @GDK_IC_STATUS_BACKGROUND:
381 @GDK_IC_STATUS_PIXMAP:
382 @GDK_IC_STATUS_COLORMAP:
384 @GDK_IC_PREEDIT_AREA_REQ:
385 @GDK_IC_PREEDIT_POSITION_REQ:
386 @GDK_IC_STATUS_AREA_REQ:
388 <!-- ##### ENUM GdkIMStyle ##### -->
390 A set of bit-flags used to specify the input method styles which are supported
391 or which are currently in use. The flags can be divided into 2 groups, the
392 pre-edit flags and the status flags.
395 The pre-edit flags specify how pre-editing data is displayed.
396 For example, this could display the text being typed in the phonetic
397 alphabet before it is composed and inserted as an ideograph.
400 The status flags specify how status information is displayed.
401 The status information can be thought of as an extension of the
402 standard keyboard mode indicators, such as the Caps Lock indicator.
406 The %GDK_IM_PREEDIT_CALLBACKS and %GDK_IM_STATUS_CALLBACKS styles are not
407 currently supported in GTK+.
411 @GDK_IM_PREEDIT_AREA: The application provides the input method with an area
412 in which to perform <emphasis>off-the-spot</emphasis> pre-editing.
413 @GDK_IM_PREEDIT_CALLBACKS: The application registers a number of callback
414 functions which are used to display pre-editing data.
415 @GDK_IM_PREEDIT_POSITION: The application provides the input method with the
416 position of the insertion cursor, for <emphasis>over-the-spot</emphasis>
417 pre-editing. The input method creates its own window over the widget to
418 display the pre-editing data.
419 @GDK_IM_PREEDIT_NOTHING: The input method uses the root X window to perform
420 pre-editing, so the application does not need to do anything.
421 @GDK_IM_PREEDIT_NONE: No pre-editing is done by the input method, or no
422 pre-editing data needs to be displayed.
423 @GDK_IM_PREEDIT_MASK: A bit-mask containing all the pre-edit flags.
424 @GDK_IM_STATUS_AREA: The application provides the input method with an area
425 in which to display status information.
426 @GDK_IM_STATUS_CALLBACKS: The applications registers a number of callback
427 functions which are used to display status information.
428 @GDK_IM_STATUS_NOTHING: The input method uses the root X window to display
429 status information, so the application does not need to do anything.
430 @GDK_IM_STATUS_NONE: The input method does not display status information.
431 @GDK_IM_STATUS_MASK: A bit-mask containing all the status flags.
433 <!-- ##### STRUCT GdkKeyInfo ##### -->
442 <!-- ##### STRUCT GdkKeymapClass ##### -->
448 <!-- ##### ENUM GdkPixbufAlphaMode ##### -->
453 @GDK_PIXBUF_ALPHA_BILEVEL:
454 @GDK_PIXBUF_ALPHA_FULL:
456 <!-- ##### FUNCTION gdk_color_context_add_palette ##### -->
466 <!-- ##### FUNCTION gdk_color_context_free ##### -->
473 <!-- ##### FUNCTION gdk_color_context_free_dither ##### -->
480 <!-- ##### FUNCTION gdk_color_context_get_index_from_palette ##### -->
492 <!-- ##### FUNCTION gdk_color_context_get_pixel ##### -->
504 <!-- ##### FUNCTION gdk_color_context_get_pixel_from_palette ##### -->
516 <!-- ##### FUNCTION gdk_color_context_get_pixels ##### -->
529 <!-- ##### FUNCTION gdk_color_context_get_pixels_incremental ##### -->
543 <!-- ##### FUNCTION gdk_color_context_init_dither ##### -->
550 <!-- ##### FUNCTION gdk_color_context_new ##### -->
559 <!-- ##### FUNCTION gdk_color_context_new_mono ##### -->
568 <!-- ##### FUNCTION gdk_color_context_query_color ##### -->
577 <!-- ##### FUNCTION gdk_color_context_query_colors ##### -->
587 <!-- ##### VARIABLE gdk_core_pointer ##### -->
593 <!-- ##### VARIABLE gdk_display_name ##### -->
599 <!-- ##### FUNCTION gdk_display_set_sm_client_id ##### -->
607 <!-- ##### FUNCTION gdk_font_full_name_free ##### -->
609 Frees a full font name obtained from gdk_font_full_name_get().
612 @name: a full font name.
614 <!-- ##### FUNCTION gdk_font_full_name_get ##### -->
616 Returns a comma-separated list of XLFDs for the
617 fonts making up a given #GdkFont.
621 @Returns: a newly-allocated string containing a list of XLFDs,
622 should be freed with gdk_font_full_name_free() when no longer needed.
624 <!-- ##### FUNCTION gdk_get_client_window ##### -->
633 <!-- ##### FUNCTION gdk_get_default_display ##### -->
640 <!-- ##### FUNCTION gdk_get_default_screen ##### -->
647 <!-- ##### FUNCTION gdk_ic_attr_destroy ##### -->
649 Destroys the given #GdkICAttr struct, freeing the allocated memory.
652 @attr: a #GdkICAttr struct.
654 <!-- ##### FUNCTION gdk_ic_attr_new ##### -->
656 Creates a new #GdkICAttr struct, with all fields set to 0.
657 The #GdkICAttr struct should be freed with gdk_ic_attr_destroy() when no
661 @Returns: a new #GdkICAttr struct.
663 <!-- ##### FUNCTION gdk_ic_destroy ##### -->
665 Destroys the input context.
670 <!-- ##### FUNCTION gdk_ic_get_attr ##### -->
672 Gets attributes of a #GdkIC.
676 @attr: a #GdkICAttr struct to contain the returned attributes.
677 @mask: a #GdkICAttributesType mask specifying which attributes to get.
678 @Returns: a #GdkICAttributesType mask specifying which of the attributes
679 were not retrieved succesfully.
681 <!-- ##### FUNCTION gdk_ic_get_events ##### -->
683 Returns the mask of events that the input method needs to function properly.
684 This is typically called in a widget's realize method after creating the
685 #GdkIC. The returned event mask is then combined with the widget's
686 own event mask and applied using gdk_window_set_events().
690 @Returns: the mask of events that the input method needs to function
693 <!-- ##### FUNCTION gdk_ic_get_style ##### -->
695 Returns the pre-edit and status style of the #GdkIC.
699 @Returns: the pre-edit and status style of the #GdkIC.
701 <!-- ##### FUNCTION gdk_ic_new ##### -->
703 Creates a new #GdkIC using the given attributes.
706 @attr: a #GdkICAttr struct containing attributes to use for the input context.
707 @mask: a #GdkICAttributesType mask specifying which of the attributes in @attr
709 @Returns: a new #GdkIC.
711 <!-- ##### FUNCTION gdk_ic_set_attr ##### -->
713 Sets attributes of the #GdkIC.
716 Note that the GDK_IC_STYLE and GDK_IC_CLIENT_WINDOW attributes can only be set
717 when creating the #GdkIC, and the GDK_IC_FILTER_EVENTS attribute is read-only.
721 @attr: a #GdkICAttr struct containing attributes to use for the input context.
722 @mask: a #GdkICAttributesType mask specifying which of the attributes in @attr
724 @Returns: a #GdkICAttributesType mask indicating which of the attributes
725 were not set successfully.
727 <!-- ##### FUNCTION gdk_im_begin ##### -->
729 Starts editing, using the given input context and #GdkWindow.
730 This should be called when the widget receives the input focus, typically in
731 the widget's focus_in_event method.
735 @window: the #GdkWindow which will be receiving the key press events.
737 <!-- ##### FUNCTION gdk_im_decide_style ##### -->
739 Decides which input method style should be used, by comparing the styles given
740 in @supported_style with those of the available input method.
743 @supported_style: styles which are supported by the widget.
744 @Returns: the best style in @supported_style that is also supported by the
745 available input method.
747 <!-- ##### FUNCTION gdk_im_end ##### -->
749 Stops editing using the input method.
750 This should be called when the widget loses the input focus, typically in
751 the widget's focus_out_event method.
755 <!-- ##### FUNCTION gdk_im_ready ##### -->
757 Checks if an input method is to be used for the current locale.
758 If GTK+ has been compiled without support for input methods, or the current
759 locale doesn't need an input method, then this will return FALSE.
762 @Returns: TRUE if an input method is available and should be used.
764 <!-- ##### FUNCTION gdk_im_set_best_style ##### -->
766 Sets the best pre-edit and/or status style which should be used.
767 This will affect the style chosen in gdk_im_decide_style().
770 The order of the pre-edit styles is (from worst to best):
771 %GDK_IM_PREEDIT_NONE, %GDK_IM_PREEDIT_NOTHING, %GDK_IM_PREEDIT_AREA,
772 %GDK_IM_PREEDIT_POSITION, %GDK_IM_PREEDIT_CALLBACKS.
773 The order of the status styles is:
774 %GDK_IM_STATUS_NONE, %GDK_IM_STATUS_NOTHING, %GDK_IM_STATUS_AREA,
775 %GDK_IM_STATUS_CALLBACKS.
778 So, for example, to set the best allowed pre-edit style to %GDK_IM_PREEDIT_AREA
783 gdk_im_set_best_style (GDK_IM_PREEDIT_AREA);
787 Or to set the best allowed pre-edit style to %GDK_IM_PREEDIT_POSITION and the
788 best allowed status style to %GDK_IM_STATUS_NOTHING you can do this:
792 gdk_im_set_best_style (GDK_IM_PREEDIT_POSITION | GDK_IM_STATUS_NOTHING);
797 @best_allowed_style: a bit-mask with the best pre-edit style and/or the best
798 status style to use. If 0 is used, then the current bit-mask of all allowed
800 @Returns: a bit-mask of all the styles allowed.
802 <!-- ##### FUNCTION gdk_input_list_devices ##### -->
804 Lists all available input devices, along with their
805 configuration information.
808 @Returns: A #GList of #GdkDeviceInfo structures. This list
809 is internal data of GTK+ and should not be modified
812 <!-- ##### FUNCTION gdk_input_motion_events ##### -->
814 Retrieves the motion history for a given device/window pair.
817 @window: a #GdkWindow.
818 @deviceid: the device for which to retrieve motion history.
819 @start: the start time.
820 @stop: the stop time.
821 @nevents_return: location to store the number of events returned.
822 @Returns: a newly allocated array containing all the events
823 from @start to @stop. This array should be freed
824 with g_free() when you are finished using it.
826 <!-- ##### FUNCTION gdk_input_set_axes ##### -->
828 Sets the mapping of the axes (valuators) of a device
829 onto the predefined valuator types that GTK+ understands.
832 @deviceid: the device to configure.
833 @axes: an array of GdkAxisUse. This length of this array
834 must match the number of axes for the device.
836 <!-- ##### FUNCTION gdk_input_set_key ##### -->
838 Sets the key event generated when a macro button is pressed.
841 @deviceid: the device to configure.
842 @index_: the index of the macro button.
843 @keyval: the key value for the #GdkKeypressEvent to generate.
844 (a value of 0 means no event will be generated.)
845 @modifiers: the modifier field for the generated
848 <!-- ##### FUNCTION gdk_input_set_mode ##### -->
850 Enables or disables a device, and determines how the
851 device maps onto the screen.
854 @deviceid: the device to configure.
856 @Returns: %TRUE if the device supports the given mode, otherwise
857 %FALSE and the device's mode is unchanged.
859 <!-- ##### FUNCTION gdk_input_set_source ##### -->
861 Sets the source type for a device.
864 @deviceid: the device to configure
865 @source: the new source type.
867 <!-- ##### FUNCTION gdk_input_window_get_pointer ##### -->
869 Returns information about the current position of the pointer
870 within a window, including extended device information.
871 Any of the return parameters may be %NULL, in which case,
872 they will be ignored.
875 @window: a #GdkWindow.
876 @deviceid: a device ID.
877 @x: location to store current x postion.
878 @y: location to store current y postion.
879 @pressure: location to store current pressure.
880 @xtilt: location to store current tilt in the x direction.
881 @ytilt: location to store current tilt in the y direction.
882 @mask: location to store the current modifier state.
884 <!-- ##### VARIABLE gdk_leader_window ##### -->
890 <!-- ##### FUNCTION gdk_open_display ##### -->
898 <!-- ##### VARIABLE gdk_progclass ##### -->
904 <!-- ##### VARIABLE gdk_screen ##### -->
910 <!-- ##### FUNCTION gdk_screen_close ##### -->
917 <!-- ##### FUNCTION gdk_screen_get_window_at_pointer ##### -->
927 <!-- ##### FUNCTION gdk_screen_use_virtual_screen ##### -->
935 <!-- ##### VARIABLE gdk_selection_property ##### -->
941 <!-- ##### FUNCTION gdk_set_default_display ##### -->
948 <!-- ##### FUNCTION gdkx_visual_get_for_screen ##### -->