/[classpath]/classpath/native/jni/qt-peer/qtframepeer.cpp
ViewVC logotype

Diff of /classpath/native/jni/qt-peer/qtframepeer.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by robilad, Mon Aug 15 21:53:12 2005 UTC revision 1.3 by smarothy, Tue Aug 16 23:22:09 2005 UTC
# Line 68  public: Line 68  public:
68    
69  #define I_KNOW_WHAT_IM_DOING  #define I_KNOW_WHAT_IM_DOING
70  #define PARENT QMainWindow  #define PARENT QMainWindow
71  #include "eventmethods.cpp"  #include "eventmethods.h"
72  };  };
73    
74  /**  /**
# Line 104  class FrameGetMenuHeightEvent : public A Line 104  class FrameGetMenuHeightEvent : public A
104        
105  private:  private:
106    QMainWindow *frame;    QMainWindow *frame;
107    int *value;    int **value;
108        
109  public:  public:
110    FrameGetMenuHeightEvent(QMainWindow *w, int *v) : AWTEvent()    FrameGetMenuHeightEvent(QMainWindow *w, int **v) : AWTEvent()
111    {    {
112      frame = w;      frame = w;
113      value = v;      value = v;
# Line 117  public: Line 117  public:
117    {    {
118      QMenuBar *mb = frame->menuBar();      QMenuBar *mb = frame->menuBar();
119      assert( mb );      assert( mb );
120      int v;      int *v = (int *)malloc( sizeof( int ) );
121      if( mb->isVisible() )      *v = mb->sizeHint().height();
       v = mb->size().height();  
   
     if(v <= 0 || v >= 0xFFFFF )  // Work around for strange values.  
       v = MenuSizeDefault;  
   
122      *value = v;      *value = v;
123    }    }
124  };  };
# Line 139  QWidget *frameChildWidget( JNIEnv *env, Line 134  QWidget *frameChildWidget( JNIEnv *env,
134                                             "getPeer",                                             "getPeer",
135                                             "()Ljava/awt/peer/ComponentPeer;" );                                             "()Ljava/awt/peer/ComponentPeer;" );
136    assert(getPeerMID);    assert(getPeerMID);
   jobject framepeerobj = env->CallObjectMethod( component, getPeerMID, 0);  
137    
138    QMainWindow *window = (QMainWindow *)getNativeObject(env, framepeerobj);    jobject framepeerobj = env->CallObjectMethod( component, getPeerMID, 0);
139      if( framepeerobj == NULL )
140        return (QWidget *)NULL;
141    
142    return window->centralWidget();    MyWindow *window = (MyWindow *)getNativeObject(env, framepeerobj);
143      assert( window );
144      return window;
145  }  }
146    
147  /*  /*
# Line 158  JNIEXPORT void JNICALL Java_gnu_java_awt Line 156  JNIEXPORT void JNICALL Java_gnu_java_awt
156    QWidget *central = new QWidget( frame );    QWidget *central = new QWidget( frame );
157    assert( central );    assert( central );
158    
   frame->setCentralWidget( central );  
159    setNativeObject( env, obj, frame );    setNativeObject( env, obj, frame );
160  }  }
161    
# Line 171  JNIEXPORT jint JNICALL Java_gnu_java_awt Line 168  JNIEXPORT jint JNICALL Java_gnu_java_awt
168    QMainWindow *frame = (QMainWindow *) getNativeObject( env, obj );    QMainWindow *frame = (QMainWindow *) getNativeObject( env, obj );
169    assert( frame );    assert( frame );
170    
171    int value = 0;    int *value = NULL;
172    mainThread->postEventToMain( new FrameGetMenuHeightEvent( frame, &value ) );    mainThread->postEventToMain( new FrameGetMenuHeightEvent( frame, &value ) );
173    
174    while(value == 0); // (Busy) wait for the value to    while(value == NULL); // (Busy) wait for the value to
175    // get set by the main thread.    // get set by the main thread.
176    
177    return (jint)value;    return (jint)(*value);
178  }  }
179    
180  /*  /*

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26