OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [native/] [jni/] [gtk-peer/] [gnu_java_awt_peer_gtk_GtkFramePeer.c] - Blame information for rev 774

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 774 jeremybenn
/* gtkframepeer.c -- Native implementation of GtkFramePeer
2
   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
3
 
4
   This file is part of GNU Classpath.
5
 
6
   GNU Classpath 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 2, or (at your option)
9
   any later version.
10
 
11
   GNU Classpath is distributed in the hope that it will be useful, but
12
   WITHOUT ANY WARRANTY; without even the implied warranty of
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
   General Public License for more details.
15
 
16
   You should have received a copy of the GNU General Public License
17
   along with GNU Classpath; see the file COPYING.  If not, write to the
18
   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
   02110-1301 USA.
20
 
21
   Linking this library statically or dynamically with other modules is
22
   making a combined work based on this library.  Thus, the terms and
23
   conditions of the GNU General Public License cover the whole
24
   combination.
25
 
26
   As a special exception, the copyright holders of this library give you
27
   permission to link this library with independent modules to produce an
28
   executable, regardless of the license terms of these independent
29
   modules, and to copy and distribute the resulting executable under
30
   terms of your choice, provided that you also meet, for each linked
31
   independent module, the terms and conditions of the license of that
32
   module.  An independent module is a module which is not derived from
33
   or based on this library.  If you modify this library, you may extend
34
   this exception to your version of the library, but you are not
35
   obligated to do so.  If you do not wish to do so, delete this
36
   exception statement from your version. */
37
 
38
#include "gtkpeer.h"
39
#include "gnu_java_awt_peer_gtk_GtkFramePeer.h"
40
 
41
JNIEXPORT void JNICALL
42
Java_gnu_java_awt_peer_gtk_GtkFramePeer_removeMenuBarPeer
43
  (JNIEnv *env, jobject obj)
44
{
45
  void *ptr;
46
  void *mptr;
47
  void *fixed;
48
  GList* children;
49
 
50
  gdk_threads_enter ();
51
 
52
  ptr = gtkpeer_get_widget (env, obj);
53
 
54
  fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
55
  children = gtk_container_get_children (GTK_CONTAINER (fixed));
56
 
57
  while (children != NULL && !GTK_IS_MENU_SHELL (children->data))
58
  {
59
    children = children->next;
60
  }
61
 
62
  /* If there's a menu bar, remove it. */
63
  if (children != NULL)
64
    {
65
      mptr = children->data;
66
 
67
      /* This will actually destroy the MenuBar. By removing it from
68
         its parent, the reference count for the MenuBar widget will
69
         decrement to 0. The widget will be automatically destroyed by
70
         GTK. */
71
      gtk_container_remove (GTK_CONTAINER (fixed), GTK_WIDGET (mptr));
72
    }
73
 
74
  gdk_threads_leave ();
75
}
76
 
77
JNIEXPORT void JNICALL
78
Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarPeer
79
  (JNIEnv *env, jobject obj, jobject menubar)
80
{
81
  void *ptr;
82
  void *mptr;
83
  void *fixed;
84
 
85
  gdk_threads_enter ();
86
 
87
  ptr = gtkpeer_get_widget (env, obj);
88
 
89
  if (menubar)
90
    {
91
      mptr = gtkpeer_get_widget (env, menubar);
92
 
93
      fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
94
      gtk_fixed_put (GTK_FIXED (fixed), mptr, 0, 0);
95
      gtk_widget_show (mptr);
96
    }
97
 
98
  gdk_threads_leave ();
99
}
100
 
101
JNIEXPORT jint JNICALL
102
Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight
103
  (JNIEnv *env, jobject obj __attribute__((unused)), jobject menubar)
104
{
105
  GtkWidget *ptr;
106
  GtkRequisition requisition;
107
 
108
  gdk_threads_enter ();
109
 
110
  ptr = gtkpeer_get_widget (env, menubar);
111
 
112
  gtk_widget_size_request (ptr, &requisition);
113
 
114
  gdk_threads_leave ();
115
 
116
  return requisition.height;
117
}
118
 
119
JNIEXPORT void JNICALL
120
Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarWidth
121
  (JNIEnv *env, jobject obj, jobject menubar, jint width)
122
{
123
  gdk_threads_enter ();
124
 
125
  Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarWidthUnlocked
126
    (env, obj, menubar, width);
127
 
128
  gdk_threads_leave ();
129
}
130
 
131
JNIEXPORT void JNICALL
132
Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarWidthUnlocked
133
  (JNIEnv *env, jobject obj __attribute__((unused)), jobject menubar, jint width)
134
{
135
  GtkWidget *ptr;
136
  GtkRequisition natural_req;
137
 
138
  if (menubar)
139
    {
140
      ptr = gtkpeer_get_widget (env, menubar);
141
 
142
      /* Get the menubar's natural size request. */
143
      gtk_widget_set_size_request (GTK_WIDGET (ptr), -1, -1);
144
      gtk_widget_size_request (GTK_WIDGET (ptr), &natural_req);
145
 
146
      /* Set the menubar's size request to width by natural_req.height. */
147
      gtk_widget_set_size_request (GTK_WIDGET (ptr),
148
                                   width, natural_req.height);
149
    }
150
}
151
 
152
JNIEXPORT void JNICALL
153
Java_gnu_java_awt_peer_gtk_GtkFramePeer_gtkFixedSetVisible
154
  (JNIEnv *env, jobject obj, jboolean visible)
155
{
156
  void *ptr;
157
  void *fixed;
158
 
159
  gdk_threads_enter ();
160
 
161
  ptr = gtkpeer_get_widget (env, obj);
162
 
163
  fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
164
 
165
  if (visible)
166
    gtk_widget_show (GTK_WIDGET (fixed));
167
  else
168
    gtk_widget_hide (GTK_WIDGET (fixed));
169
 
170
  gdk_threads_leave ();
171
}
172
 
173
JNIEXPORT void JNICALL
174
Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImage
175
  (JNIEnv *env, jobject obj, jobject gtkimage)
176
{
177
  void *ptr;
178
  GdkPixbuf *pixbuf = NULL;
179
 
180
  gdk_threads_enter ();
181
 
182
  pixbuf = cp_gtk_image_get_pixbuf (env, gtkimage);
183
  g_assert (pixbuf != NULL);
184
 
185
  ptr = gtkpeer_get_widget (env, obj);
186
 
187
  gtk_window_set_icon (GTK_WINDOW (ptr), pixbuf);
188
 
189
  gdk_threads_leave ();
190
}
191
 
192
JNIEXPORT void JNICALL
193
Java_gnu_java_awt_peer_gtk_GtkFramePeer_maximize
194
(JNIEnv *env, jobject obj)
195
{
196
  void *ptr;
197
  gdk_threads_enter ();
198
  ptr = gtkpeer_get_widget (env, obj);
199
  gtk_window_maximize (GTK_WINDOW (ptr));
200
  gdk_threads_leave ();
201
}
202
 
203
JNIEXPORT void JNICALL
204
Java_gnu_java_awt_peer_gtk_GtkFramePeer_unmaximize
205
(JNIEnv *env, jobject obj)
206
{
207
  void *ptr;
208
  gdk_threads_enter ();
209
  ptr = gtkpeer_get_widget (env, obj);
210
  gtk_window_unmaximize (GTK_WINDOW (ptr));
211
  gdk_threads_leave ();
212
}
213
 
214
JNIEXPORT void JNICALL
215
Java_gnu_java_awt_peer_gtk_GtkFramePeer_iconify
216
(JNIEnv *env, jobject obj)
217
{
218
  void *ptr;
219
  gdk_threads_enter ();
220
  ptr = gtkpeer_get_widget (env, obj);
221
  gtk_window_iconify (GTK_WINDOW (ptr));
222
  gdk_threads_leave ();
223
}
224
 
225
JNIEXPORT void JNICALL
226
Java_gnu_java_awt_peer_gtk_GtkFramePeer_deiconify
227
(JNIEnv *env, jobject obj)
228
{
229
  void *ptr;
230
  gdk_threads_enter ();
231
  ptr = gtkpeer_get_widget (env, obj);
232
  gtk_window_deiconify (GTK_WINDOW (ptr));
233
  gdk_threads_leave ();
234
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.