1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
|
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimp3migration.c
* Copyright (C) 2011 Michael Natterer <mitch@gimp.org>
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "gimpwidgetstypes.h"
#include "gimp3migration.h"
GtkWidget *
gtk_box_new (GtkOrientation orientation,
gint spacing)
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
return gtk_hbox_new (FALSE, spacing);
else
return gtk_vbox_new (FALSE, spacing);
}
GtkWidget *
gtk_button_box_new (GtkOrientation orientation)
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
return gtk_hbutton_box_new ();
else
return gtk_vbutton_box_new ();
}
GtkWidget *
gtk_paned_new (GtkOrientation orientation)
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
return gtk_hpaned_new ();
else
return gtk_vpaned_new ();
}
GtkWidget *
gtk_scale_new (GtkOrientation orientation,
GtkAdjustment *adjustment)
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
return gtk_hscale_new (adjustment);
else
return gtk_vscale_new (adjustment);
}
GtkWidget *
gtk_scrollbar_new (GtkOrientation orientation,
GtkAdjustment *adjustment)
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
return gtk_hscrollbar_new (adjustment);
else
return gtk_vscrollbar_new (adjustment);
}
GtkWidget *
gtk_separator_new (GtkOrientation orientation)
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
return gtk_hseparator_new ();
else
return gtk_vseparator_new ();
}
#if ! GTK_CHECK_VERSION (3, 3, 0)
gboolean
gdk_event_triggers_context_menu (const GdkEvent *event)
{
g_return_val_if_fail (event != NULL, FALSE);
if (event->type == GDK_BUTTON_PRESS)
{
GdkEventButton *bevent = (GdkEventButton *) event;
if (bevent->button == 3 &&
! (bevent->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK)))
return TRUE;
#ifdef GDK_WINDOWING_QUARTZ
if (bevent->button == 1 &&
! (bevent->state & (GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)) &&
(bevent->state & GDK_CONTROL_MASK))
return TRUE;
#endif
}
return FALSE;
}
GdkModifierType
gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
GdkModifierIntent intent)
{
g_return_val_if_fail (GDK_IS_KEYMAP (keymap), 0);
#ifdef GDK_WINDOWING_QUARTZ
switch (intent)
{
case GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR:
return GDK_MOD2_MASK;
case GDK_MODIFIER_INTENT_CONTEXT_MENU:
return GDK_CONTROL_MASK;
case GDK_MODIFIER_INTENT_EXTEND_SELECTION:
return GDK_SHIFT_MASK;
case GDK_MODIFIER_INTENT_MODIFY_SELECTION:
return GDK_MOD2_MASK;
case GDK_MODIFIER_INTENT_NO_TEXT_INPUT:
return GDK_MOD2_MASK | GDK_CONTROL_MASK;
default:
g_return_val_if_reached (0);
}
#else
switch (intent)
{
case GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR:
return GDK_CONTROL_MASK;
case GDK_MODIFIER_INTENT_CONTEXT_MENU:
return 0;
case GDK_MODIFIER_INTENT_EXTEND_SELECTION:
return GDK_SHIFT_MASK;
case GDK_MODIFIER_INTENT_MODIFY_SELECTION:
return GDK_CONTROL_MASK;
case GDK_MODIFIER_INTENT_NO_TEXT_INPUT:
return GDK_MOD1_MASK | GDK_CONTROL_MASK;
default:
g_return_val_if_reached (0);
}
#endif
}
GdkModifierType
gtk_widget_get_modifier_mask (GtkWidget *widget,
GdkModifierIntent intent)
{
GdkDisplay *display;
g_return_val_if_fail (GTK_IS_WIDGET (widget), 0);
display = gtk_widget_get_display (widget);
return gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
intent);
}
#endif /* GTK+ 3.3 */
|