summaryrefslogtreecommitdiff
path: root/src/plugins/android.linux.x86/src/com/motorola/studio/android/nativeos/NativeUI.java
blob: 17d8e5a72a7f83bb10f2d684ae73688185e6f2a6 (plain)
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
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.motorola.studio.android.nativeos;

import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.internal.gtk.OS;
import org.eclipse.swt.widgets.Composite;

import com.motorola.studio.android.nativeos.linux.gtk.GtkBridge;

/***
 * This class is responsible for provide LINUX X86 specific constants values 
 * and implementation of INativeUI interface
 */
@SuppressWarnings("restriction")
public class NativeUI implements INativeUI
{
    String DEFAULT_COMMANDLINE = "";

    String DEFAULT_USEVNC = "false";

    /*
     * (non-Javadoc)
     * @see com.motorola.studio.android.nativeos.INativeUI#getDefaultCommandLine()
     */
    public String getDefaultCommandLine()
    {
        return DEFAULT_COMMANDLINE;
    }

    /*
     * (non-Javadoc)
     * @see com.motorola.studio.android.nativeos.INativeUI#getDefaultUseVnc()
     */
    public String getDefaultUseVnc()
    {
        return DEFAULT_USEVNC;
    }

    /*
     * (non-Javadoc)
     * @see com.motorola.studio.android.nativeos.INativeUI#getWindowHandle(java.lang.String)
     */
    public long getWindowHandle(String windowName)
    {
        return GtkBridge.getWindowHandle(windowName);
    }

    /*
     * (non-Javadoc)
     * @see com.motorola.studio.android.nativeos.INativeUI#getWindowProperties(long)
     */
    public long getWindowProperties(long windowHandle)
    {
        return 0;
    }

    /*
     *     (non-Javadoc)
     * @see com.motorola.studio.android.nativeos.INativeUI#setWindowProperties(long, long)
     */
    public void setWindowProperties(long windowHandle, long originalProperties)
    {
        //Do nothing
    }

    /*
     * (non-Javadoc)
     * @see com.motorola.studio.android.nativeos.INativeUI#embedWindow(long, org.eclipse.swt.widgets.Composite)
     */
    public long embedWindow(long windowHandle, Composite composite)
    {
        long hnd = 0;
        hnd = composite.embeddedHandle;
        return GtkBridge.embedNativeWindow(hnd, windowHandle);
    }

    /*
     * (non-Javadoc)
     * @see com.motorola.studio.android.nativeos.INativeUI#unembedWindow(long, long)
     */
    public void unembedWindow(long windowHandle, long originalParent)
    {
        GtkBridge.unembedNativeWindow(windowHandle, originalParent);
    }

    /*
     * (non-Javadoc)
     * @see com.motorola.studio.android.nativeos.INativeUI#getWindowSize(long, long)
     */
    public Point getWindowSize(long originalWindowHandle, long windowHandle)
    {
        return GtkBridge.getWindowSize(originalWindowHandle);
    }

    /*
     * (non-Javadoc)
     * @see com.motorola.studio.android.nativeos.INativeUI#setWindowStyle(long)
     */
    public void setWindowStyle(long windowHandle)
    {
        //Not needed on Linux
    }

    /*
     * (non-Javadoc)
     * @see com.motorola.studio.android.nativeos.INativeUI#hideWindow(long)
     */
    public void hideWindow(long windowHandle)
    {
        GtkBridge.hideWindow(windowHandle);
    }

    /*
     *     (non-Javadoc)
     * @see com.motorola.studio.android.nativeos.INativeUI#showWindow(long)
     */
    public void showWindow(long windowHandle)
    {
        GtkBridge.showWindow(windowHandle);
    }

    /*
     * (non-Javadoc)
     * @see com.motorola.studio.android.nativeos.INativeUI#restoreWindow(long)
     */
    public void restoreWindow(long windowHandle)
    {
        GtkBridge.restoreWindow(windowHandle);
    }

    /*
     * (non-Javadoc)
     * @see com.motorola.studio.android.nativeos.INativeUI#sendNextLayoutCommand(long, long)
     */
    public void sendNextLayoutCommand(long originalParent, long windowHandle)
    {
        GtkBridge.pressKey(originalParent, OS.GDK_Control_L);
        GtkBridge.pressKey(originalParent, OS.GDK_F11);
        GtkBridge.releaseKey(originalParent, OS.GDK_F11);
        GtkBridge.releaseKey(originalParent, OS.GDK_Control_L);
    }

    /*
     * (non-Javadoc)
     * @see com.motorola.studio.android.nativeos.INativeUI#isWindowEnabled(long)
     */
    public boolean isWindowEnabled(long windowHandle)
    {
        // Current not needed on Linux
        return false;
    }

    /*
     * (non-Javadoc)
     * @see com.motorola.studio.android.nativeos.INativeUI#setWindowFocus(long)
     */
    public void setWindowFocus(long windowHandle)
    {
        // Current not needed on Linux
    }
}