Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 101 lines (83 sloc) 3.562 kB
5dc9ac0 @jtappin * Split high-level code into submodules
jtappin authored
1 ! Copyright (C) 2011
2 ! Free Software Foundation, Inc.
3
4 ! This file is part of the gtk-fortran GTK+ Fortran Interface library.
5
6 ! This is free software; you can redistribute it and/or modify
7 ! it under the terms of the GNU General Public License as published by
8 ! the Free Software Foundation; either version 3, or (at your option)
9 ! any later version.
10
11 ! This software 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
14 ! GNU General Public License for more details.
15
16 ! Under Section 7 of GPL version 3, you are granted additional
17 ! permissions described in the GCC Runtime Library Exception, version
18 ! 3.1, as published by the Free Software Foundation.
19
20 ! You should have received a copy of the GNU General Public License along with
21 ! this program; see the files COPYING3 and COPYING.RUNTIME respectively.
22 ! If not, see <http://www.gnu.org/licenses/>.
23 !
24 ! Contributed by James Tappin
25 ! Last modification: 11-21-2011
26
27 ! --------------------------------------------------------
28 ! gtk-hl-accelerator.f90
d92a293 @jtappin Merge branch 'gtk2_24_glib2_32' of https://github.com/jerryd/gtk-fortran
jtappin authored
29 ! Generated: Sun Aug 19 21:39:00 2012 GMT
5dc9ac0 @jtappin * Split high-level code into submodules
jtappin authored
30 ! Please do not edit this file directly,
31 ! Edit gtk-hl-accelerator-tmpl.f90, and use ./mk_gtk_hl.pl to regenerate.
585e643 @jtappin Update syntax for conditional lines in high-level templates.
jtappin authored
32 ! Generated for GTK+ version: 2.24.0.
452dabf @jtappin Resync high-level routines to other branches.
jtappin authored
33 ! Generated for GLIB version: 2.32.0.
5dc9ac0 @jtappin * Split high-level code into submodules
jtappin authored
34 ! --------------------------------------------------------
35
36
37 module gtk_hl_accelerator
38 !*
39 ! Accelerator
40 ! A convenience function to add an accelerator to a widget (button or
41 ! menu item).
42 !/
43
44 use iso_c_binding
45
46 ! Auto-generated use's
47 use gtk, only: gtk_widget_add_accelerator, &
48 & GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, &
e6eb552 @jtappin * Add scrolled window to HL_CONTAINER, and a markup friendly set labe…
jtappin authored
49 & TRUE, FALSE
5dc9ac0 @jtappin * Split high-level code into submodules
jtappin authored
50
51 use gdk, only: gdk_keyval_from_name
52
53
54 implicit none
55
56 contains
57 !+
58 subroutine hl_gtk_widget_add_accelerator(widget, signal, accel_group, &
59 & accel_key, accel_mods, accel_flags)
60 type(c_ptr), intent(in) :: widget
61 character(kind=c_char), dimension(*), intent(in) :: signal
62 type(c_ptr), intent(in) :: accel_group
63 character(kind=c_char), dimension(*), intent(in) :: accel_key
64 integer(kind=c_int), intent(in), optional :: accel_mods, accel_flags
65
66 ! Add an accelerator to a widget (just saves a lot of code duplication)
67 !
68 ! WIDGET: c_ptr: required: The widget with which the accelerator is
69 ! associated.
70 ! SIGNAL: string: required: The signal with which the accelerator is
71 ! associated
72 ! ACCEL_GROUP: c_ptr: required: The accelerator group to which the
73 ! accelerator belongs (must have been created and added to
74 ! the top-level window).
75 ! ACCEL_KEY: string: required: The key name to use for the accelerator
76 ! ACCEL_MODS: c_int: optional: The key modifiers for the accelerator,
77 ! This defaults to GDK_CONTROL_MASK, set it to 0 to use the
78 ! unmodified key.
79 ! ACCEL_FLAGS: c_int: optional: Flags for the accelerator, if not present
80 ! then GTK_ACCEL_VISIBLE, is used (to hide the accelerator,
81 ! use ACCEL_FLAGS=0).
82 !-
83
84 integer(kind=c_int) :: ikey, imods, iflags
85
86 ikey = gdk_keyval_from_name(accel_key)
87 if (present(accel_mods)) then
88 imods = accel_mods
89 else
90 imods = GDK_CONTROL_MASK
91 end if
92 if (present(accel_flags)) then
93 iflags = accel_flags
94 else
95 iflags = GTK_ACCEL_VISIBLE
96 end if
97 call gtk_widget_add_accelerator(widget, signal, &
98 & accel_group, ikey, imods, iflags)
99 end subroutine hl_gtk_widget_add_accelerator
100 end module gtk_hl_accelerator
Something went wrong with that request. Please try again.