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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [native/] [jni/] [qt-peer/] [qtmenubarpeer.cpp] - Blame information for rev 774

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 774 jeremybenn
/* qtmenubarpeer.cpp --
2
   Copyright (C)  2005  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 <assert.h>
39
#include <QMenuBar>
40
#include <QToolBar>
41
#include <QMenu>
42
#include <QList>
43
#include <QThread>
44
#include <gnu_java_awt_peer_qt_QtMenuBarPeer.h>
45
#include "nativewrapper.h"
46
#include "qtstrings.h"
47
#include "mainthreadinterface.h"
48
 
49
/*
50
 * Event wrapper to add a menu to a menu bar
51
 */
52
class MenuBarAdd : public AWTEvent {
53
 
54
 private:
55
  QMenuBar *widget;
56
  QMenu *menu;
57
  bool isHelp;
58
 
59
 public:
60
  MenuBarAdd(QMenuBar *w, QMenu *m, bool help) : AWTEvent()
61
  {
62
    widget = w;
63
    menu = m;
64
    isHelp = help;
65
  }
66
 
67
  void runEvent()
68
  {
69
    if ( isHelp )
70
      widget->addSeparator();
71
    QAction *ptr = widget->addMenu( menu );
72
  }
73
};
74
 
75
/**
76
 * Event wrapper to remove a menu from a menu bar.
77
 */
78
class MenuBarRemove : public AWTEvent {
79
 
80
 private:
81
  QMenuBar *widget;
82
  QMenu *menu;
83
 
84
 public:
85
  MenuBarRemove(QMenuBar *w, QMenu *m) : AWTEvent()
86
  {
87
    widget = w;
88
    menu = m;
89
  }
90
 
91
  void runEvent()
92
  {
93
    // FIXME
94
  }
95
};
96
 
97
 
98
/*
99
 * Constructs a QMenuBar object.
100
 */
101
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuBarPeer_init
102
  (JNIEnv *env, jobject obj)
103
{
104
  QMenuBar *menubar = new QMenuBar();
105
  assert( menubar );
106
  setNativeObject( env, obj, menubar );
107
}
108
 
109
/*
110
 * Adds a menu item.
111
 */
112
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuBarPeer_addMenu
113
(JNIEnv *env, jobject obj, jobject menuPeer)
114
{
115
  QMenuBar *menubar = (QMenuBar *)getNativeObject(env, obj);
116
  assert( menubar );
117
  QMenu *menu = (QMenu *)getNativeObject(env, menuPeer);
118
  assert( menu );
119
  mainThread->postEventToMain( new MenuBarAdd( menubar, menu, false ) );
120
}
121
 
122
/*
123
 * Add a help menu.
124
 */
125
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuBarPeer_addHelpMenu
126
(JNIEnv *env, jobject obj, jobject menuPeer)
127
{
128
  QMenuBar *menubar = (QMenuBar *)getNativeObject(env, obj);
129
  assert( menubar );
130
  QMenu *menu = (QMenu *)getNativeObject(env, menuPeer);
131
  assert( menu );
132
 
133
  mainThread->postEventToMain( new MenuBarAdd( menubar, menu, true ) );
134
}
135
 
136
/*
137
 * Delete a menu.
138
 */
139
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtMenuBarPeer_delMenu
140
(JNIEnv *env, jobject obj, jobject menuPeer)
141
{
142
  QMenuBar *menubar = (QMenuBar *)getNativeObject(env, obj);
143
  assert( menubar );
144
  QMenu *menu = (QMenu *)getNativeObject(env, menuPeer);
145
  assert( menu );
146
 
147
  // FIXME
148
 
149
}
150
 

powered by: WebSVN 2.1.0

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