source: trunk/desktop/src/vdesktop.c@ 166

Last change on this file since 166 was 166, checked in by cinc, 19 years ago

Added code for object menus.

File size: 5.5 KB
Line 
1/* ***** BEGIN LICENSE BLOCK *****
2* Version: CDDL 1.0/LGPL 2.1
3*
4* The contents of this file are subject to the COMMON DEVELOPMENT AND
5* DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
6* this file except in compliance with the License. You may obtain a copy of
7* the License at http://www.sun.com/cddl/
8*
9* Software distributed under the License is distributed on an "AS IS" basis,
10* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11* for the specific language governing rights and limitations under the
12* License.
13*
14* The Original Code is "NOM" Netlabs Object Model
15*
16* The Initial Developer of the Original Code is
17* netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
18* Portions created by the Initial Developer are Copyright (C) 2005-2006
19* the Initial Developer. All Rights Reserved.
20*
21* Contributor(s):
22*
23* Alternatively, the contents of this file may be used under the terms of
24* the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
25* case the provisions of the LGPL are applicable instead of those above. If
26* you wish to allow use of your version of this file only under the terms of
27* the LGPL, and not to allow others to use your version of this file under
28* the terms of the CDDL, indicate your decision by deleting the provisions
29* above and replace them with the notice and other provisions required by the
30* LGPL. If you do not delete the provisions above, a recipient may use your
31* version of this file under the terms of any one of the CDDL or the LGPL.
32*
33* ***** END LICENSE BLOCK ***** */
34
35#define INCL_DOSPROCESS
36#define INCL_DOS
37#define INCL_DOSPROFILE
38#define INCL_DOSERRORS
39#define INCL_PM
40#include <os2.h>
41#include <stdio.h>
42#include <stdlib.h>
43#include <string.h>
44#include <gtk/gtk.h>
45#include "debug_window.h"
46#include <gc.h>
47
48#include "nom.h"
49#include "nomtk.h"
50#include "nomgc.h"
51#include "nomguitk.h"
52#include "nomfolderwindow.h"
53#include "wpobject.h"
54#include "wpfolder.h"
55#include "desktoptypes.h"
56
57int createQuitWindow(void);
58
59static gboolean
60handleEvent (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
61{
62
63 DosBeep(5000, 100);
64 //g_malloc(1250000);
65 //g_message("%s: allocated...", __FUNCTION__);
66 //WPObject_wpDisplayMenu(wpFolder, pWindow, NULL, 0, 0, NULL);
67
68 return FALSE;
69}
70
71/*
72 Main entry point. This function is called from the EMX wrapper. Be aware that gtk_init()
73 is already called in the wrapper.
74 */
75int _System main_loop()
76{
77 char desktopDir[CCHMAXPATH]={0};
78 PNOM_ENV pEnv;
79 NOMClassMgr *NOMClassMgrObject;
80 GtkWidget* window;
81 int a;
82 ULONG pMem;
83 HREGDLL hReg=NULLHANDLE;
84
85 /* Desktop folder */
86 WPFolder *wpDesktop;
87
88 hReg=nomBeginRegisterDLLWithGC();
89 if(NULLHANDLE==hReg)
90 return 1;
91
92 /* Register DLLs with the garbage collector */
93 g_assert(nomRegisterDLLByName(hReg, "GLIB2.DLL" ));
94 g_assert(nomRegisterDLLByName(hReg, "GOBJECT2.DLL"));
95 g_assert(nomRegisterDLLByName(hReg, "GMODULE2.DLL"));
96 g_assert(nomRegisterDLLByName(hReg, "GDK2.DLL"));
97 g_assert(nomRegisterDLLByName(hReg, "GDKPIX2.DLL"));
98 g_assert(nomRegisterDLLByName(hReg, "GTK2.DLL" ));
99 g_assert(nomRegisterDLLByName(hReg, "ATK.DLL" ));
100 g_assert(nomRegisterDLLByName(hReg, "NOBJTK.DLL"));
101 g_assert(nomRegisterDLLByName(hReg, "VDESKTOP.DLL"));
102 /* Add Pango here? */
103
104 nomEndRegisterDLLWithGC(hReg);
105
106 g_message("We started...\n");
107
108#if 0
109 /* Initialize thread subsystem */
110 if(!g_thread_supported())
111 g_thread_init(NULL);
112#endif
113
114 /* Create a window with a 'quit' button to terminate us */
115 createQuitWindow();
116
117 /* Query current dir */
118 g_strlcpy(desktopDir, g_get_current_dir(), sizeof(desktopDir));
119 dbgPrintf("Desktop: %s", desktopDir);
120
121 /*
122 Bootstrap our objects...
123 */
124 pEnv=nomTkInit();
125
126 if(!pEnv) {
127 nomPrintf("Can't initialize NOM environment. Exit...\n");
128 return(1);
129 }
130
131
132 /* Init SOM */
133 NOMClassMgrObject=nomEnvironmentNew();
134 //dbgPrintf( "NOMClassMgrObject: %x", NOMClassMgrObject);
135
136 /* Create desktop folder */
137 wpDesktop=WPFolderNew();
138
139 dbgPrintf( "Created desktop object: %x", wpDesktop);
140 WPFolder_tstSetFullPath(wpDesktop, desktopDir, NULLHANDLE);
141
142 WPFolder_wpOpen(wpDesktop, NULL, OPEN_DEFAULT, NULL, NULL);
143 /* WPFolder_wpPopulate(wpObject, 0,"blabla 2", 0, NULL); */
144
145#if 0
146 /* Folder toplevel window. */
147 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
148
149 /* FIXME: Set default size of folder frame. Will later use a stored value */
150 gtk_window_set_default_size (GTK_WINDOW (window), 650, 400);
151
152 g_signal_connect (GTK_WIDGET(window), "size-request",
153 G_CALLBACK (handleEvent), NULL/*nomSelf*/);
154
155 gtk_widget_show(window);
156 g_message("Window handle: %x", window);
157#endif
158
159 /* All GTK applications must have a gtk_main(). Control ends here
160 * and waits for an event to occur (like a key press or
161 * mouse event). */
162 gtk_main ();
163
164
165#if 0
166 mem=g_malloc(1250000);
167 memset(mem, 0xaa, 10000);
168 // *pGlobalMemInExe=mem;
169 for(a=0;a<50;a++){
170 g_malloc(1250000);
171 printf("%x %x %x %x %d\n", *mem, *(mem+1), *(mem+2), *(mem+3), 0);
172 //printf("%x\n", *((ULONG*)pGlobalMemInExe));
173 }
174#endif
175
176 printf("And now we quit...\n");
177
178 return 0;
179}
180
181
182/*
183 Just a test function for making noise...
184 */
185void _System theBeep(void)
186{
187 DosBeep(2500,400);
188 DosBeep(500,200);
189 DosBeep(1500,200);
190 DosBeep(2500,400);
191 DosBeep(1500,200);
192 DosBeep(500,200);
193 DosBeep(2500,400);
194}
Note: See TracBrowser for help on using the repository browser.