You can subscribe to this list here.
| 2003 |
Jan
(30) |
Feb
(20) |
Mar
(151) |
Apr
(86) |
May
(23) |
Jun
(25) |
Jul
(107) |
Aug
(141) |
Sep
(55) |
Oct
(85) |
Nov
(65) |
Dec
(2) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(22) |
Feb
(18) |
Mar
(3) |
Apr
(16) |
May
(69) |
Jun
(3) |
Jul
(1) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(6) |
Dec
(1) |
| 2005 |
Jan
(2) |
Feb
(16) |
Mar
|
Apr
|
May
|
Jun
(47) |
Jul
(1) |
Aug
|
Sep
(6) |
Oct
(4) |
Nov
|
Dec
(34) |
| 2006 |
Jan
(39) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
(4) |
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2008 |
Jan
|
Feb
|
Mar
(26) |
Apr
(1) |
May
(1) |
Jun
|
Jul
(5) |
Aug
(2) |
Sep
(8) |
Oct
(8) |
Nov
(22) |
Dec
(30) |
| 2009 |
Jan
(10) |
Feb
(13) |
Mar
(14) |
Apr
(14) |
May
(32) |
Jun
(25) |
Jul
(36) |
Aug
(10) |
Sep
(2) |
Oct
|
Nov
|
Dec
(10) |
| 2010 |
Jan
(9) |
Feb
(4) |
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
(2) |
Jul
(1) |
Aug
(4) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
|
From: <kr_...@us...> - 2003-03-03 21:19:45
|
Update of /cvsroot/htoolkit/port/src/Port
In directory sc8-pr-cvs1:/tmp/cvs-serv32157/Port
Added Files:
Message.hs
Log Message:
Portable message boxes
--- NEW FILE: Message.hs ---
{-# OPTIONS -fglasgow-exts -#include Message.h #-}
-----------------------------------------------------------------------------------------
{-| Module : Message
Copyright : (c) Krasimir Angelov 2003
License : BSD-style
Maintainer : ka2...@ya...
Stability : provisional
Portability : portable
Message boxes
-}
-----------------------------------------------------------------------------------------
module Graphics.UI.Port.Message
( messageInfo
, messageWarning
, messageQuestion
, messageError
) where
import Foreign.C
messageInfo msg = withCString msg osMessageInfo
foreign import ccall osMessageInfo :: CString -> IO ()
messageWarning msg = withCString msg osMessageWarning
foreign import ccall osMessageWarning :: CString -> IO ()
messageQuestion msg = withCString msg osMessageQuestion
foreign import ccall osMessageQuestion :: CString -> IO Bool
messageError msg = withCString msg osMessageError
foreign import ccall osMessageError :: CString -> IO Bool
|
|
From: <kr_...@us...> - 2003-03-03 21:17:22
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv30757/cbits/Win32
Modified Files:
Window.c
Log Message:
Bugfix. Proper Activate/Deactivate events for MDI windows
Index: Window.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Window.c 3 Mar 2003 11:20:21 -0000 1.8
--- Window.c 3 Mar 2003 21:17:16 -0000 1.9
***************
*** 666,683 ****
gCurChar = 0;
break;
- case WM_ACTIVATE:
- if (wParam == WA_INACTIVE)
- {
- if (gInKey)
- handleWindowKeyboard(hWnd, evKeyLost, gCurChar, GetModifiers());
- gInKey = FALSE;
- gCurChar = 0;
- handleWindowDeactivate(hWnd);
- }
- else
- {
- handleWindowActivate(hWnd);
- }
- break;
case WM_CTLCOLORSTATIC:
{
--- 666,669 ----
***************
*** 701,704 ****
--- 687,704 ----
SetActiveWindow(hWnd);
break;
+ case WM_ACTIVATE:
+ if (wParam == WA_INACTIVE)
+ {
+ if (gInKey)
+ handleWindowKeyboard(hWnd, evKeyLost, gCurChar, GetModifiers());
+ gInKey = FALSE;
+ gCurChar = 0;
+ handleWindowDeactivate(hWnd);
+ }
+ else
+ {
+ handleWindowActivate(hWnd);
+ }
+ break;
}
***************
*** 751,754 ****
--- 751,760 ----
strcat(title, "]");
SetWindowText(ghWndFrame, title);
+
+ if (hWnd == (HWND) lParam)
+ handleWindowActivate(hWnd);
+ else
+ if (hWnd == (HWND) wParam)
+ handleWindowDeactivate(hWnd);
}
break;
|
|
From: <kr_...@us...> - 2003-03-03 21:09:25
|
Update of /cvsroot/htoolkit/port/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv27458/port/src/include Modified Files: Internals.h Log Message: MDI for GTK Index: Internals.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/Internals.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Internals.h 3 Mar 2003 00:21:51 -0000 1.5 --- Internals.h 3 Mar 2003 21:09:21 -0000 1.6 *************** *** 25,28 **** --- 25,30 ---- #else + extern GtkWidget *gMDIFrameWidget; + extern GtkWidget *gMDINotebookWidget; extern GtkWidget *gActiveTopLevelWindow; *************** *** 30,33 **** --- 32,37 ---- extern gchar *fromMnemonicString(const gchar *source); extern gchar *toMnemonicString(const gchar *source); + + void createMDIFrame(); #endif |
|
From: <kr_...@us...> - 2003-03-03 19:47:29
|
Update of /cvsroot/htoolkit/port/src/Port
In directory sc8-pr-cvs1:/tmp/cvs-serv15913/src/Port
Modified Files:
Handlers.hs
Log Message:
ensure that getAllWindowHandles will always return list of handles without dupplications
Index: Handlers.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/Port/Handlers.hs,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Handlers.hs 3 Mar 2003 19:44:29 -0000 1.10
--- Handlers.hs 3 Mar 2003 19:47:26 -0000 1.11
***************
*** 201,205 ****
registerWindow hwnd
= do hwnds <- takeMVar windows
! putMVar windows (hwnd:hwnds)
unregisterWindow :: WindowHandle -> IO ()
--- 201,205 ----
registerWindow hwnd
= do hwnds <- takeMVar windows
! putMVar windows (hwnd : L.delete hwnd hwnds)
unregisterWindow :: WindowHandle -> IO ()
|
|
From: <kr_...@us...> - 2003-03-03 19:44:34
|
Update of /cvsroot/htoolkit/port/src/Port In directory sc8-pr-cvs1:/tmp/cvs-serv14802/src/Port Modified Files: Handlers.hs Log Message: fix comment Index: Handlers.hs =================================================================== RCS file: /cvsroot/htoolkit/port/src/Port/Handlers.hs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Handlers.hs 3 Mar 2003 19:23:53 -0000 1.9 --- Handlers.hs 3 Mar 2003 19:44:29 -0000 1.10 *************** *** 197,202 **** -- | 'registerWindow' should be called by all top-level window creation functions. -- The windows are automatically unregistered when destroyed. The registration is used to ! -- implement the'enableAutoQuit' function that automatically quits the gui when ! -- all top-level windows are closed. registerWindow :: WindowHandle -> IO () registerWindow hwnd --- 197,201 ---- -- | 'registerWindow' should be called by all top-level window creation functions. -- The windows are automatically unregistered when destroyed. The registration is used to ! -- implement the automatic quit when all top-level windows are closed. registerWindow :: WindowHandle -> IO () registerWindow hwnd |
|
From: <kr_...@us...> - 2003-03-03 19:23:56
|
Update of /cvsroot/htoolkit/port/src/Port
In directory sc8-pr-cvs1:/tmp/cvs-serv5600/src/Port
Modified Files:
Handlers.hs
Log Message:
the modified getAllWindowHandles returns the list sorted in Z-order
Index: Handlers.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/Port/Handlers.hs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Handlers.hs 10 Feb 2003 22:42:08 -0000 1.8
--- Handlers.hs 3 Mar 2003 19:23:53 -0000 1.9
***************
*** 109,112 ****
--- 109,113 ----
import Control.Monad( when )
import System.IO.Unsafe( unsafePerformIO )
+ import qualified Data.List as L
{-----------------------------------------------------------------------------------------
***************
*** 190,196 ****
-----------------------------------------------------------------------------------------}
{-# NOINLINE windows #-}
! windows :: MVar (PtrMap WindowHandle ())
windows
! = unsafePerformIO (newMVar empty)
-- | 'registerWindow' should be called by all top-level window creation functions.
--- 191,197 ----
-----------------------------------------------------------------------------------------}
{-# NOINLINE windows #-}
! windows :: MVar [WindowHandle]
windows
! = unsafePerformIO (newMVar [])
-- | 'registerWindow' should be called by all top-level window creation functions.
***************
*** 200,214 ****
registerWindow :: WindowHandle -> IO ()
registerWindow hwnd
! = do set <- takeMVar windows
! putMVar windows (insert hwnd () set)
- -- returns True when this was the last open window.
unregisterWindow :: WindowHandle -> IO ()
unregisterWindow hwnd
! = do set <- takeMVar windows
! putMVar windows (delete hwnd set)
getAllWindowHandles :: IO [WindowHandle]
! getAllWindowHandles = fmap keys (readMVar windows)
{-----------------------------------------------------------------------------------------
--- 201,215 ----
registerWindow :: WindowHandle -> IO ()
registerWindow hwnd
! = do hwnds <- takeMVar windows
! putMVar windows (hwnd:hwnds)
unregisterWindow :: WindowHandle -> IO ()
unregisterWindow hwnd
! = do hwnds <- takeMVar windows
! putMVar windows (L.delete hwnd hwnds)
+ -- | 'getAllWindowHandles' returns list of handles for all opened windows, sorted in Z-order.
getAllWindowHandles :: IO [WindowHandle]
! getAllWindowHandles = readMVar windows
{-----------------------------------------------------------------------------------------
***************
*** 405,410 ****
handleWindowActivate :: WindowHandle -> IO ()
! handleWindowActivate hwnd
! = invokeHandler hwnd handlersWindowActivate id
--- 406,413 ----
handleWindowActivate :: WindowHandle -> IO ()
! handleWindowActivate hwnd = do
! hwnds <- takeMVar windows
! putMVar windows (hwnd : L.delete hwnd hwnds)
! invokeHandler hwnd handlersWindowActivate id
|
|
From: <kr_...@us...> - 2003-03-03 19:03:30
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK
In directory sc8-pr-cvs1:/tmp/cvs-serv29829/src/cbits/GTK
Modified Files:
Util.c Window.c
Added Files:
Frame.c
Log Message:
MDI for GTK
--- NEW FILE: Frame.c ---
#include "Types.h"
#include "Internals.h"
#include "Handlers_stub.h"
GtkWidget *gMDIFrameWidget;
GtkWidget *gMDINotebookWidget;
static void frame_close_page_handler(GtkWidget *client)
{
GtkWidget *window = gtk_notebook_get_nth_page(GTK_NOTEBOOK(client), gtk_notebook_get_current_page(GTK_NOTEBOOK(client)));
handleWindowDismiss(window);
}
static void frame_notebook_top_handler(GtkWidget *client)
{
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(client), GTK_POS_TOP);
}
static void frame_notebook_bottom_handler(GtkWidget *client)
{
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(client), GTK_POS_BOTTOM);
}
static void frame_notebook_left_handler(GtkWidget *client)
{
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(client), GTK_POS_LEFT);
}
static void frame_notebook_right_handler(GtkWidget *client)
{
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(client), GTK_POS_RIGHT);
}
static void frame_switch_page_handler(GtkNotebook *notebook,GtkNotebookPage *page,gint page_num,gpointer user_data)
{
// send deactivate message for old
gint old_page_num = g_list_index(notebook->children, notebook->cur_page);
handleWindowDeactivate(gtk_notebook_get_nth_page(notebook, old_page_num));
// send activate message for new
handleWindowActivate(gtk_notebook_get_nth_page(notebook, page_num));
gActiveTopLevelWindow = gtk_widget_get_parent(gtk_widget_get_parent(GTK_WIDGET(notebook)));
}
static gboolean frame_delete_handler(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
handleDismissProcess();
return gtk_true();
}
static gboolean frame_configure_event_handler (GtkWindow *window, GdkEventConfigure *event, gpointer user_data)
{
int i, nCount;
nCount = gtk_notebook_get_n_pages(GTK_NOTEBOOK(gMDINotebookWidget));
for (i = 0; i < nCount; i++)
{
GtkWidget *widget = gtk_notebook_get_nth_page(GTK_NOTEBOOK(gMDINotebookWidget), i);
handleWindowResize(widget,widget->allocation.width,widget->allocation.height);
handleWindowReLayout(widget);
}
return gtk_false();
};
gboolean window_key_press_handler(GtkWidget *widget, GdkEventKey *event, gpointer user_data);
gboolean window_key_release_handler(GtkWidget *widget, GdkEventKey *event, gpointer user_data);
gboolean frame_key_press_handler(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
GtkWidget *window = gtk_notebook_get_nth_page(GTK_NOTEBOOK(gMDINotebookWidget), gtk_notebook_get_current_page(GTK_NOTEBOOK(gMDINotebookWidget)));
return window_key_press_handler(window, event, user_data);
}
gboolean frame_key_release_handler(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
GtkWidget *window = gtk_notebook_get_nth_page(GTK_NOTEBOOK(gMDINotebookWidget), gtk_notebook_get_current_page(GTK_NOTEBOOK(gMDINotebookWidget)));
return window_key_release_handler(window, event, user_data);
}
void createMDIFrame()
{
GtkWidget *menuBar, *box;
GtkWidget *notebook_menu, *menu_item, *pages_menu;
GtkAccelGroup *accel_group;
GSList *group;
/* Create the window. */
gMDIFrameWidget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(gMDIFrameWidget), gAppName);
gtk_signal_connect (GTK_OBJECT(gMDIFrameWidget), "delete-event",
GTK_SIGNAL_FUNC(frame_delete_handler),
NULL);
gtk_signal_connect (GTK_OBJECT(gMDIFrameWidget), "configure-event",
GTK_SIGNAL_FUNC(frame_configure_event_handler),
NULL);
gtk_signal_connect (GTK_OBJECT(gMDIFrameWidget), "key-press-event",
GTK_SIGNAL_FUNC(frame_key_press_handler),
NULL);
gtk_signal_connect (GTK_OBJECT(gMDIFrameWidget), "key-release-event",
GTK_SIGNAL_FUNC(frame_key_release_handler),
NULL);
box = gtk_vbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(gMDIFrameWidget), box);
/* Create the menubar. */
menuBar = gtk_menu_bar_new();
gtk_box_pack_start(GTK_BOX(box), menuBar, FALSE, FALSE, 0);
/* Create client(notebook) */
gMDINotebookWidget = gtk_notebook_new();
gtk_notebook_set_scrollable(GTK_NOTEBOOK(gMDINotebookWidget), gtk_true());
gtk_notebook_popup_enable(GTK_NOTEBOOK(gMDINotebookWidget));
gtk_signal_connect (GTK_OBJECT(gMDINotebookWidget), "switch-page",
GTK_SIGNAL_FUNC(frame_switch_page_handler),
NULL);
gtk_box_pack_end(GTK_BOX(box), gMDINotebookWidget, TRUE, TRUE, 0);
gtk_window_maximize(GTK_WINDOW(gMDIFrameWidget));
gtk_widget_show_all(gMDIFrameWidget);
/* Create "Pages" menu */
pages_menu = gtk_menu_new();
// gtk_menu_set_accel_group(GTK_MENU(pages_menu), accel_group);
menu_item = gtk_menu_item_new_with_label("Pages");
gtk_menu_item_set_submenu(GTK_MENU_ITEM (menu_item), pages_menu);
gtk_widget_show_all(menu_item);
gtk_menu_bar_insert(GTK_MENU_BAR(menuBar), menu_item, 0);
notebook_menu = gtk_menu_new();
//gtk_menu_set_accel_group(GTK_MENU(notebook_menu), accel_group);
menu_item = gtk_radio_menu_item_new_with_label(NULL, "Top");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_item), gtk_true());
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menu_item));
gtk_signal_connect_object (GTK_OBJECT (menu_item), "activate",
GTK_SIGNAL_FUNC (frame_notebook_top_handler), gMDINotebookWidget);
gtk_menu_append(GTK_MENU(notebook_menu), menu_item);
menu_item = gtk_radio_menu_item_new_with_label(group, "Bottom");
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(menu_item));
gtk_signal_connect_object (GTK_OBJECT (menu_item), "activate",
GTK_SIGNAL_FUNC (frame_notebook_bottom_handler), gMDINotebookWidget);
gtk_menu_append(GTK_MENU(notebook_menu), menu_item);
menu_item = gtk_radio_menu_item_new_with_label(group, "Left");
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(menu_item));
gtk_signal_connect_object (GTK_OBJECT (menu_item), "activate",
GTK_SIGNAL_FUNC (frame_notebook_left_handler), gMDINotebookWidget);
gtk_menu_append(GTK_MENU(notebook_menu), menu_item);
menu_item = gtk_radio_menu_item_new_with_label(group, "Right");
group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(menu_item));
gtk_signal_connect_object (GTK_OBJECT (menu_item), "activate",
GTK_SIGNAL_FUNC (frame_notebook_right_handler), gMDINotebookWidget);
gtk_menu_append(GTK_MENU(notebook_menu), menu_item);
menu_item = gtk_menu_item_new_with_label("Notebook");
gtk_menu_item_set_submenu(GTK_MENU_ITEM (menu_item), notebook_menu);
gtk_menu_append(GTK_MENU(pages_menu), menu_item);
menu_item = gtk_menu_item_new();
gtk_menu_append(GTK_MENU(pages_menu), menu_item);
menu_item = gtk_menu_item_new_with_label("Close page");
gtk_signal_connect_object (GTK_OBJECT (menu_item), "activate",
GTK_SIGNAL_FUNC (frame_close_page_handler), gMDINotebookWidget);
gtk_menu_append(GTK_MENU(pages_menu), menu_item);
gtk_widget_show_all(pages_menu);
}
Index: Util.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Util.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Util.c 3 Mar 2003 00:21:50 -0000 1.4
--- Util.c 3 Mar 2003 19:03:24 -0000 1.5
***************
*** 44,47 ****
--- 44,53 ----
gAppName = strdup(AppName);
gDocumentInterface = DocumentInterface;
+
+ if (gDocumentInterface == 2)
+ {
+ createMDIFrame();
+ gActiveObjects++;
+ }
}
};
***************
*** 71,74 ****
--- 77,83 ----
void osQuit()
{
+ gtk_widget_destroy(gMDIFrameWidget);
+ gActiveObjects--;
+
if (gActiveObjects > 0)
{
***************
*** 129,133 ****
GtkBin *GetSW(GtkWidget *window)
{
! GList *children = gtk_container_get_children(GTK_CONTAINER(GTK_BIN(window)->child));
while (children)
--- 138,146 ----
GtkBin *GetSW(GtkWidget *window)
{
! GList *children;
! GtkWidget *vbox;
!
! vbox = (gDocumentInterface == 2) ? window : GTK_BIN(window)->child;
! children = gtk_container_get_children(GTK_CONTAINER(vbox));
while (children)
Index: Window.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Window.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Window.c 3 Mar 2003 13:33:15 -0000 1.7
--- Window.c 3 Mar 2003 19:03:24 -0000 1.8
***************
*** 268,272 ****
/* DAAN: handle destroy event */
! static void frame_destroy_handler(GtkWidget *widget, gpointer user_data)
{
handleWindowDestroy(widget);
--- 268,272 ----
/* DAAN: handle destroy event */
! static void window_destroy_handler(GtkWidget *widget, gpointer user_data)
{
handleWindowDestroy(widget);
***************
*** 274,278 ****
}
! static gboolean frame_delete_handler(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
handleWindowDismiss(widget);
--- 274,278 ----
}
! static gboolean window_delete_handler(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
handleWindowDismiss(widget);
***************
*** 283,287 ****
static int gCurChar = 0;
! static gboolean window_key_press_handler(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
int c;
--- 283,287 ----
static int gCurChar = 0;
! gboolean window_key_press_handler(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
int c;
***************
*** 324,328 ****
};
! static gboolean window_key_release_handler(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
if (gInKey)
--- 324,328 ----
};
! gboolean window_key_release_handler(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
if (gInKey)
***************
*** 339,343 ****
}
- handleWindowDeactivate(widget);
return gtk_false();
};
--- 339,342 ----
***************
*** 371,383 ****
GtkWidget *window, *vbox, *fixed, *sw, *viewport;
- /* Create a toplevel */
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title(GTK_WINDOW(window), gAppName);
-
/* Create a VBox */
vbox = gtk_vbox_new(gtk_false(), 0);
- gtk_container_add(GTK_CONTAINER(window), vbox);
gtk_widget_show(vbox);
/* Create a Scrolled Window */
sw = gtk_scrolled_window_new (NULL, NULL);
--- 370,416 ----
GtkWidget *window, *vbox, *fixed, *sw, *viewport;
/* Create a VBox */
vbox = gtk_vbox_new(gtk_false(), 0);
gtk_widget_show(vbox);
+ if (gDocumentInterface == 2)
+ {
+ window = vbox;
+ gtk_notebook_append_page(GTK_NOTEBOOK(gMDINotebookWidget),vbox,gtk_label_new(gAppName));
+
+ gtk_signal_connect (GTK_OBJECT(vbox), "destroy",
+ GTK_SIGNAL_FUNC(window_destroy_handler),
+ NULL);
+ }
+ else
+ {
+ /* Create a toplevel */
+ window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title(GTK_WINDOW(window), gAppName);
+ gtk_container_add(GTK_CONTAINER(window), vbox);
+
+ gtk_signal_connect (GTK_OBJECT(window), "destroy",
+ GTK_SIGNAL_FUNC(window_destroy_handler),
+ NULL);
+ gtk_signal_connect (GTK_OBJECT(window), "focus-in-event",
+ GTK_SIGNAL_FUNC(window_focus_in_handler),
+ NULL);
+ gtk_signal_connect (GTK_OBJECT(window), "focus-out-event",
+ GTK_SIGNAL_FUNC(window_focus_out_handler),
+ NULL);
+ gtk_signal_connect (GTK_OBJECT (window), "delete-event",
+ GTK_SIGNAL_FUNC(window_delete_handler),
+ NULL);
+ gtk_signal_connect (GTK_OBJECT(window), "configure-event",
+ GTK_SIGNAL_FUNC(window_configure_event_handler),
+ NULL);
+ gtk_signal_connect (GTK_OBJECT(window), "key-press-event",
+ GTK_SIGNAL_FUNC(window_key_press_handler),
+ NULL);
+ gtk_signal_connect (GTK_OBJECT(window), "key-release-event",
+ GTK_SIGNAL_FUNC(window_key_release_handler),
+ NULL);
+ }
+
/* Create a Scrolled Window */
sw = gtk_scrolled_window_new (NULL, NULL);
***************
*** 397,412 ****
/* Signals */
- gtk_signal_connect (GTK_OBJECT(window), "destroy",
- GTK_SIGNAL_FUNC(frame_destroy_handler),
- NULL);
gtk_signal_connect (GTK_OBJECT(fixed), "expose-event",
GTK_SIGNAL_FUNC(window_expose_handler),
window);
- gtk_signal_connect (GTK_OBJECT(window), "focus-in-event",
- GTK_SIGNAL_FUNC(window_focus_in_handler),
- NULL);
- gtk_signal_connect (GTK_OBJECT(window), "focus-out-event",
- GTK_SIGNAL_FUNC(window_focus_out_handler),
- NULL);
gtk_signal_connect (GTK_OBJECT(viewport), "button-press-event",
GTK_SIGNAL_FUNC(window_button_press_handler),
--- 430,436 ----
***************
*** 424,430 ****
GTK_SIGNAL_FUNC(frame_leave_notify_handler),
window);
- gtk_signal_connect (GTK_OBJECT(window), "configure-event",
- GTK_SIGNAL_FUNC(window_configure_event_handler),
- NULL);
gtk_signal_connect (GTK_OBJECT (gtk_viewport_get_hadjustment (GTK_VIEWPORT(viewport))), "value-changed",
GTK_SIGNAL_FUNC(frame_adjustment_value_changed_handler),
--- 448,451 ----
***************
*** 433,445 ****
GTK_SIGNAL_FUNC(frame_adjustment_value_changed_handler),
window);
- gtk_signal_connect (GTK_OBJECT (window), "delete-event",
- GTK_SIGNAL_FUNC(frame_delete_handler),
- NULL);
- gtk_signal_connect (GTK_OBJECT(window), "key-press-event",
- GTK_SIGNAL_FUNC(window_key_press_handler),
- NULL);
- gtk_signal_connect (GTK_OBJECT(window), "key-release-event",
- GTK_SIGNAL_FUNC(window_key_release_handler),
- NULL);
gtk_widget_realize(viewport);
--- 454,457 ----
***************
*** 502,525 ****
char *osGetWindowTitle(WindowHandle window)
{
! char *title = GTK_WINDOW(window)->title;
! return strcpy(rmalloc(strlen(title)+1), title);
};
! void osSetWindowTitle(WindowHandle window, char *txt)
{
! gtk_window_set_title(GTK_WINDOW(window), txt);
};
void osGetWindowViewSize(WindowHandle window, int *res)
{
! int w, h;
! gtk_window_get_size(GTK_WINDOW(window), &w, &h);
! res[0] = w-4;
! res[1] = h-4;
}
void osSetWindowViewSize(WindowHandle window, int w, int h)
{
! gtk_window_resize(GTK_WINDOW(window), w+4, h+4);
}
--- 514,571 ----
char *osGetWindowTitle(WindowHandle window)
{
! char *title;
!
! if (gDocumentInterface == 2)
! {
! GtkWidget *label;
!
! label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(gMDINotebookWidget),window);
! title = gtk_label_get_text(GTK_LABEL(label));
! }
! else
! {
! title = GTK_WINDOW(window)->title;
! }
!
! return strdup(title);
};
! void osSetWindowTitle(WindowHandle window, char *title)
{
! if (gDocumentInterface == 2)
! {
! GtkWidget *label;
!
! label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(gMDINotebookWidget),window);
! gtk_label_set_text(GTK_LABEL(label), title);
!
! gtk_notebook_set_menu_label_text(GTK_NOTEBOOK(gMDINotebookWidget),window,title);
! }
! else
! {
! gtk_window_set_title(GTK_WINDOW(window), title);
! }
};
void osGetWindowViewSize(WindowHandle window, int *res)
{
! if (gDocumentInterface == 2)
! {
! int w, h;
! gtk_window_get_size(GTK_WINDOW(window), &w, &h);
! res[0] = w-4;
! res[1] = h-4;
! }
! else
! {
! res[0] = window->allocation.width-4;
! res[1] = window->allocation.height-4;
! }
}
void osSetWindowViewSize(WindowHandle window, int w, int h)
{
! if (gDocumentInterface != 2)
! gtk_window_resize(GTK_WINDOW(window), w+4, h+4);
}
***************
*** 618,622 ****
if (scrollbar_spacing < 0) scrollbar_spacing = 3;
! if (rectangle.width < child_requisition.width ) rectangle.width -= scrollbar_spacing + vscrollbar_requisition.width;
if (rectangle.height < child_requisition.height) rectangle.height -= scrollbar_spacing + hscrollbar_requisition.height;
--- 664,668 ----
if (scrollbar_spacing < 0) scrollbar_spacing = 3;
! if (rectangle.width < child_requisition.width ) rectangle.width -= scrollbar_spacing + vscrollbar_requisition.width;
if (rectangle.height < child_requisition.height) rectangle.height -= scrollbar_spacing + hscrollbar_requisition.height;
***************
*** 669,695 ****
void osSetWindowRect(WindowHandle window, int x0, int y0, int x1, int y1)
{
! gtk_window_move( GTK_WINDOW(window), x0, y0 );
! gtk_window_resize( GTK_WINDOW(window), abs (x1 - x0), abs (y1 - y0) );
}
void osGetWindowRect(WindowHandle window, int *res)
{
! int x = 0;
! int y = 0;
! int w = 0;
!
! int h = 0;
! gtk_window_get_position( GTK_WINDOW(window), &x, &y );
! gtk_window_get_size( GTK_WINDOW(window), &w, &h );
! res[0] = x;
! res[1] = y;
! res[2] = x+w;
! res[3] = y+h;
}
void osSetWindowResizeable(WindowHandle window, int resizeable )
{
! gtk_window_set_resizable(GTK_WINDOW(window), resizeable != 0);
}
--- 715,756 ----
void osSetWindowRect(WindowHandle window, int x0, int y0, int x1, int y1)
{
! if (gDocumentInterface != 2)
! {
! gtk_window_move(GTK_WINDOW(window), x0, y0);
! gtk_window_resize(GTK_WINDOW(window), abs (x1 - x0), abs (y1 - y0));
! }
}
void osGetWindowRect(WindowHandle window, int *res)
{
! if (gDocumentInterface == 2)
! {
! res[0] = 0;
! res[1] = 0;
! res[2] = window->allocation.width;
! res[3] = window->allocation.height;
! }
! else
! {
! int x = 0;
! int y = 0;
! int w = 0;
! int h = 0;
! gtk_window_get_position( GTK_WINDOW(window), &x, &y);
! gtk_window_get_size( GTK_WINDOW(window), &w, &h);
! res[0] = x;
! res[1] = y;
! res[2] = x+w;
! res[3] = y+h;
! }
}
void osSetWindowResizeable(WindowHandle window, int resizeable )
{
! if (gDocumentInterface != 2 || GTK_IS_DIALOG(window))
! {
! gtk_window_set_resizable(GTK_WINDOW(window), resizeable != 0);
! }
}
|
|
From: <kr_...@us...> - 2003-03-03 13:33:19
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK
In directory sc8-pr-cvs1:/tmp/cvs-serv24890/src/cbits/GTK
Modified Files:
Window.c
Log Message:
Implement osDismissWindow
Index: Window.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Window.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Window.c 3 Mar 2003 12:32:05 -0000 1.6
--- Window.c 3 Mar 2003 13:33:15 -0000 1.7
***************
*** 147,150 ****
--- 147,151 ----
break;
default:
+ break;
}
***************
*** 559,563 ****
void osGetWindowPageSize(WindowHandle window, int *res)
-
{
GtkScrolledWindow *sw = GTK_SCROLLED_WINDOW(GetSW(window));
--- 560,563 ----
***************
*** 577,581 ****
BOOL osDismissWindow(WindowHandle window)
{
! return FALSE;
}
--- 577,587 ----
BOOL osDismissWindow(WindowHandle window)
{
! GtkWidget *widget = window;
!
! gtk_signal_connect (GTK_OBJECT(window), "destroy",
! GTK_SIGNAL_FUNC(gtk_widget_destroyed),
! &widget);
! handleWindowDismiss(widget);
! return (widget == NULL);
}
|
|
From: <kr_...@us...> - 2003-03-03 12:32:08
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK
In directory sc8-pr-cvs1:/tmp/cvs-serv1714/src/cbits/GTK
Modified Files:
Window.c
Log Message:
bugfixes
Index: Window.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Window.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Window.c 3 Mar 2003 00:45:14 -0000 1.5
--- Window.c 3 Mar 2003 12:32:05 -0000 1.6
***************
*** 77,81 ****
{
handleWindowResize(window,event->width-4,event->height-4);
! handleWindowReLayout(window);
return gtk_false();
};
--- 77,81 ----
{
handleWindowResize(window,event->width-4,event->height-4);
! handleWindowReLayout(window);
return gtk_false();
};
***************
*** 146,150 ****
--- 146,153 ----
handleWindowMouse(window,evMouseDoubleClick,x,y,modifiers);
break;
+ default:
}
+
+ return gtk_true();
}
***************
*** 369,373 ****
/* Create a toplevel */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
! gtk_window_set_title(GTK_WINDOW(window), txt);
/* Create a VBox */
--- 372,376 ----
/* Create a toplevel */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
! gtk_window_set_title(GTK_WINDOW(window), gAppName);
/* Create a VBox */
|
|
From: <kr_...@us...> - 2003-03-03 11:20:30
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv6489/src/cbits/Win32 Modified Files: Window.c Log Message: Use gAppName as title for MDI child windows Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Window.c 3 Mar 2003 00:45:14 -0000 1.7 --- Window.c 3 Mar 2003 11:20:21 -0000 1.8 *************** *** 805,809 **** /* fill the MDICREATESTRUCT record */ mdicreate.szClass = "HMDIWINDOW"; ! mdicreate.szTitle = ""; mdicreate.hOwner = ghModule; mdicreate.x = 0; --- 805,809 ---- /* fill the MDICREATESTRUCT record */ mdicreate.szClass = "HMDIWINDOW"; ! mdicreate.szTitle = gAppName; mdicreate.hOwner = ghModule; mdicreate.x = 0; |
|
From: <kr_...@us...> - 2003-03-03 00:45:18
|
Update of /cvsroot/htoolkit/port/src/examples
In directory sc8-pr-cvs1:/tmp/cvs-serv3404/src/examples
Modified Files:
ByeDemo.hs
Log Message:
set AppName as default title for toplevel windows.
Index: ByeDemo.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/examples/ByeDemo.hs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ByeDemo.hs 3 Mar 2003 00:17:14 -0000 1.5
--- ByeDemo.hs 3 Mar 2003 00:45:15 -0000 1.6
***************
*** 11,15 ****
import Graphics.UI.Port
! main = start "ByeDemo" SDI demo
demo :: IO ()
--- 11,15 ----
import Graphics.UI.Port
! main = start "Bye!" SDI demo
demo :: IO ()
***************
*** 18,22 ****
setWindowDomainSize w (sz 0 0) -- no scroll bars needed
setWindowViewSize w (sz 80 40) -- guess some size as Port has no layout manager
- setWindowTitle w "Bye!" -- set the title bar text
l <- createLabel w
--- 18,21 ----
|
|
From: <kr_...@us...> - 2003-03-03 00:45:18
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv3404/src/cbits/Win32 Modified Files: Window.c Log Message: set AppName as default title for toplevel windows. Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Window.c 10 Feb 2003 22:42:10 -0000 1.6 --- Window.c 3 Mar 2003 00:45:14 -0000 1.7 *************** *** 790,794 **** hWnd = CreateWindow( "HWINDOW", ! NULL, WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, CW_USEDEFAULT,0,0,0, --- 790,794 ---- hWnd = CreateWindow( "HWINDOW", ! gAppName, WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, CW_USEDEFAULT,0,0,0, |
|
From: <kr_...@us...> - 2003-03-03 00:45:17
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv3404/src/cbits/GTK Modified Files: Window.c Log Message: set AppName as default title for toplevel windows. Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Window.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Window.c 3 Mar 2003 00:23:51 -0000 1.4 --- Window.c 3 Mar 2003 00:45:14 -0000 1.5 *************** *** 369,372 **** --- 369,373 ---- /* Create a toplevel */ window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), txt); /* Create a VBox */ |
|
From: <kr_...@us...> - 2003-03-03 00:23:55
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK
In directory sc8-pr-cvs1:/tmp/cvs-serv28903/src/cbits/GTK
Modified Files:
Window.c
Log Message:
Update GTK backend to make it compatible with Win32 backend after development of MDI for Win32
Index: Window.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Window.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Window.c 10 Feb 2003 22:42:09 -0000 1.3
--- Window.c 3 Mar 2003 00:23:51 -0000 1.4
***************
*** 1,679 ****
! #include "Window.h"
! #include "Internals.h"
! #include "Handlers_stub.h"
! #include <gdk/gdkkeysyms.h>
!
!
! static void getWindowClipRect(GtkWidget *window, GdkRegion *region)
! {
! GtkFixed *fixed = GTK_FIXED(GTK_BIN(GetSW(window)->child)->child);
! GList *childrens = gtk_container_get_children(GTK_CONTAINER(fixed));
[...1335 lines suppressed...]
! {
! int x = 0;
! int y = 0;
! int w = 0;
!
! int h = 0;
!
! gtk_window_get_position( GTK_WINDOW(window), &x, &y );
! gtk_window_get_size( GTK_WINDOW(window), &w, &h );
!
! res[0] = x;
! res[1] = y;
! res[2] = x+w;
! res[3] = y+h;
! }
!
! void osSetWindowResizeable(WindowHandle window, int resizeable )
! {
! gtk_window_set_resizable(GTK_WINDOW(window), resizeable != 0);
! }
|
|
From: <kr_...@us...> - 2003-03-03 00:21:54
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv28341/src/cbits/Win32 Modified Files: Util.c Log Message: Make gActiveObjects, gDocumentInterface and gAppName variables common to Win32 and GTK Index: Util.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Util.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Util.c 10 Feb 2003 22:42:10 -0000 1.3 --- Util.c 3 Mar 2003 00:21:51 -0000 1.4 *************** *** 8,16 **** HMODULE ghModule = NULL; HFONT ghControlFont = NULL; - int gDocumentInterface; HWND ghWndFrame; HWND ghWndClient; ! DWORD gActiveObjects; ! LPCSTR gAppName; void *rmalloc (DWORD bytes) --- 8,16 ---- HMODULE ghModule = NULL; HFONT ghControlFont = NULL; HWND ghWndFrame; HWND ghWndClient; ! int gActiveObjects; ! int gDocumentInterface; ! char *gAppName; void *rmalloc (DWORD bytes) |
|
From: <kr_...@us...> - 2003-03-03 00:21:54
|
Update of /cvsroot/htoolkit/port/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv28341/src/include Modified Files: Internals.h Log Message: Make gActiveObjects, gDocumentInterface and gAppName variables common to Win32 and GTK Index: Internals.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/Internals.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Internals.h 10 Feb 2003 22:42:11 -0000 1.4 --- Internals.h 3 Mar 2003 00:21:51 -0000 1.5 *************** *** 4,7 **** --- 4,11 ---- #include <config.h> + extern int gActiveObjects; + extern int gDocumentInterface; + extern char *gAppName; + #ifdef WIN32_TARGET *************** *** 12,20 **** extern HMODULE ghModule; extern HFONT ghControlFont; - extern int gDocumentInterface; extern HWND ghWndFrame; extern HWND ghWndClient; - extern DWORD gActiveObjects; - extern LPCSTR gAppName; extern WindowHandle checkWindow(HWND hWnd, char *className); --- 16,21 ---- |
|
From: <kr_...@us...> - 2003-03-03 00:21:53
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK
In directory sc8-pr-cvs1:/tmp/cvs-serv28341/src/cbits/GTK
Modified Files:
Util.c
Log Message:
Make gActiveObjects, gDocumentInterface and gAppName variables common to Win32 and GTK
Index: Util.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Util.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Util.c 10 Feb 2003 22:42:09 -0000 1.3
--- Util.c 3 Mar 2003 00:21:50 -0000 1.4
***************
*** 3,8 ****
--- 3,12 ----
#include "Types.h"
#include "Internals.h"
+ #include "Handlers_stub.h"
BOOL bInitialized = FALSE;
+ int gActiveObjects;
+ int gDocumentInterface;
+ char *gAppName;
void *rmalloc (unsigned long bytes)
***************
*** 28,53 ****
if (!bInitialized)
{
! int margc;
! char **margv;
! gtk_set_locale();
! getProgArgv(&margc, &margv);
! gtk_init(&margc,&margv);
! setProgArgv(margc, margv);
! bInitialized = TRUE;
}
};
- static gboolean running = 0;
-
void osStart()
{
! running = gtk_true();
! while (running)
{
handleMenusUpdate();
while (gtk_events_pending())
{
! if (!running)
return;
--- 32,58 ----
if (!bInitialized)
{
! int margc;
! char **margv;
! gtk_set_locale();
! getProgArgv(&margc, &margv);
! gtk_init(&margc,&margv);
! setProgArgv(margc, margv);
! bInitialized = TRUE;
!
! gActiveObjects = 0;
! gAppName = strdup(AppName);
! gDocumentInterface = DocumentInterface;
}
};
void osStart()
{
! while (gActiveObjects > 0)
{
handleMenusUpdate();
while (gtk_events_pending())
{
! if (gActiveObjects <= 0)
return;
***************
*** 55,59 ****
}
! if (!running)
return;
--- 60,64 ----
}
! if (gActiveObjects <= 0)
return;
***************
*** 66,70 ****
void osQuit()
{
! running = gtk_false();
}
--- 71,80 ----
void osQuit()
{
! if (gActiveObjects > 0)
! {
! printf("WARNING: There are still have active objects\n");
! }
!
! free(gAppName);
}
|
|
From: <kr_...@us...> - 2003-03-03 00:17:20
|
Update of /cvsroot/htoolkit/port/src/examples
In directory sc8-pr-cvs1:/tmp/cvs-serv26918/src/examples
Modified Files:
ByeDemo.hs
Log Message:
Update example after last changes in the Port library
Index: ByeDemo.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/examples/ByeDemo.hs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ByeDemo.hs 10 Feb 2003 22:42:11 -0000 1.4
--- ByeDemo.hs 3 Mar 2003 00:17:14 -0000 1.5
***************
*** 11,15 ****
import Graphics.UI.Port
! main = start SDI demo
demo :: IO ()
--- 11,15 ----
import Graphics.UI.Port
! main = start "ByeDemo" SDI demo
demo :: IO ()
***************
*** 36,38 ****
bye w l b
= do setLabelText l "Goodbye"
! registerButtonClick b (closeWindow w) -- overwrite the old event handler
--- 36,38 ----
bye w l b
= do setLabelText l "Goodbye"
! registerButtonClick b (destroyWindow w) -- overwrite the old event handler
|
|
From: <kr_...@us...> - 2003-03-03 00:14:13
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK
In directory sc8-pr-cvs1:/tmp/cvs-serv26260/src/cbits/GTK
Modified Files:
Font.c
Log Message:
Remove unused variables
Index: Font.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Font.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Font.c 10 Feb 2003 22:42:09 -0000 1.3
--- Font.c 3 Mar 2003 00:14:10 -0000 1.4
***************
*** 1,256 ****
! #include "Font.h"
! #include "Internals.h"
!
! char *osGetAvailableFontNames()
! {
! int i, nCount, nBufferSize;
! Display *display;
! PangoFontMap *fontmap;
! PangoFontFamily **families;
! char *buffer, *p;
!
! display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
! fontmap = pango_x_font_map_for_display(display);
!
! pango_font_map_list_families(fontmap, &families, &nCount);
!
! nBufferSize = 0;
! for (i = 0; i < nCount; i++)
! {
! nBufferSize += strlen(pango_font_family_get_name(families[i]))+1;
! }
!
! buffer = rmalloc(nBufferSize+1); p = buffer;
! for (i = 0; i < nCount; i++)
! {
! strcpy(p, pango_font_family_get_name(families[i]));
! p += strlen(p)+1;
! }
! *p = 0;
!
! g_free(families);
!
! return buffer;
! }
!
! int *osGetAvailableFontVariants(char *szFontName, int nLow, int nHight)
! {
! int i, nCount, nBufferSize;
! Display *display;
! PangoFontMap *fontmap;
! PangoFontFamily **families, *family;
! PangoFontFace **faces;
! int *buffer, *p;
! gchar **xfontnames;
!
! display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
! fontmap = pango_x_font_map_for_display(display);
!
! pango_font_map_list_families(fontmap, &families, &nCount);
!
! family = NULL;
! for (i = 0; i < nCount; i++)
! {
! if (strcmp(pango_font_family_get_name(families[i]), szFontName) == 0)
! {
! family = families[i];
! break;
! }
! }
!
! g_free(families);
!
! if (family)
! {
! pango_font_family_list_faces(family, &faces, &nCount);
!
! buffer = rmalloc(sizeof(int)*(nCount*3+1)); p = buffer;
! for (i = 0; i < nCount; i++)
! {
! PangoFontDescription *desc = pango_font_face_describe(faces[i]);
!
! *(p++) = pango_font_description_get_weight(desc);
! switch (pango_font_description_get_style(desc))
! {
! case PANGO_STYLE_NORMAL: *(p++) = 0; break;
! case PANGO_STYLE_OBLIQUE: *(p++) = 1; break;
! case PANGO_STYLE_ITALIC: *(p++) = 2; break;
! default: *(p++) = -1; break;
! }
! *(p++) = 0;
!
! pango_font_description_free(desc);
! }
! *(p++) = 0;
!
! return buffer;
! }
!
! return NULL;
!
! }
!
! FontHandle osCreateFont(char *face, int size, int weight, int style, BOOL IsUnderlined, BOOL IsStriked)
! {
! FontHandle font;
! Display *display;
! PangoLayout *layout;
! PangoContext *pango_context;
! PangoFont *pango_font;
!
! font = rmalloc(sizeof(*font));
!
! display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
! pango_context = pango_x_get_context(display);
! font->layout = pango_layout_new(pango_context);
!
! font->font_descr = pango_font_description_new();
! pango_font_description_set_family(font->font_descr,face);
! pango_font_description_set_weight(font->font_descr,weight);
! pango_font_description_set_style(font->font_descr,style);
! pango_font_description_set_size(font->font_descr, size*PANGO_SCALE);
!
! pango_layout_set_font_description(font->layout, font->font_descr);
!
! pango_font = pango_font_map_load_font
! ( pango_x_font_map_for_display(display)
! , NULL
! , font->font_descr
! );
! font->metrics = pango_font_get_metrics(pango_font, pango_context_get_language(pango_context));
!
! font->IsUnderlined = IsUnderlined;
! font->IsStriked = IsStriked;
!
! if (font->IsUnderlined || font->IsStriked)
! pango_layout_set_attributes(font->layout, pango_attr_list_new());
!
! return font;
! }
!
! void osDeleteFont(FontHandle font)
! {
! pango_font_metrics_unref(font->metrics);
! pango_font_description_free(font->font_descr);
! g_object_unref(font->layout);
! rfree(font);
! } /* osDeleteFont */
!
! void osGetFontMetrics(FontHandle font, CanvasHandle canvas, int *ascent, int *descent, int *maxwidth, int *leading)
! {
! *ascent = pango_font_metrics_get_ascent(font->metrics)/PANGO_SCALE;
! *descent = pango_font_metrics_get_descent(font->metrics)/PANGO_SCALE;
! *maxwidth = pango_font_metrics_get_approximate_char_width(font->metrics)/PANGO_SCALE;
! *leading = 2; /* FIXME */
! } /* osGetFontMetrics */
!
!
! void osGetPenFontMetrics(CanvasHandle canvas, int *ascent, int *descent, int *maxwidth, int *leading)
! {
! *ascent = pango_font_metrics_get_ascent(canvas->theFont->metrics)/PANGO_SCALE;
! *descent = pango_font_metrics_get_descent(canvas->theFont->metrics)/PANGO_SCALE;
! *maxwidth = pango_font_metrics_get_approximate_char_width(canvas->theFont->metrics)/PANGO_SCALE;
! *leading = 2; /* FIXME */
! } /* osGetPenFontMetrics */
!
!
! int osGetStringWidth(char *string, CanvasHandle canvas)
! {
! int width;
!
! pango_layout_set_text(canvas->theFont->layout, string, -1);
! pango_layout_get_pixel_size(canvas->theFont->layout, &width, NULL);
! pango_layout_set_text(canvas->theFont->layout, NULL, 0);
!
!
! return width;
! } /* osGetStringWidth */
!
! int osGetCharWidth(char ch, CanvasHandle canvas)
! {
! int width;
!
! pango_layout_set_text(canvas->theFont->layout, &ch, 1);
! pango_layout_get_pixel_size(canvas->theFont->layout, &width, NULL);
! pango_layout_set_text(canvas->theFont->layout, NULL, 0);
!
! return width;
! } /* osGetCharWidth */
!
! int osGetFontStringWidth(char *string, FontHandle font, CanvasHandle canvas)
! {
! int width;
!
! pango_layout_set_text(font->layout, string, -1);
! pango_layout_get_pixel_size(font->layout, &width, NULL);
! pango_layout_set_text(font->layout, NULL, 0);
!
! return width;
! } /* osGetFontStringWidth */
!
! int osGetFontCharWidth(char ch, FontHandle font, CanvasHandle canvas)
! {
! int width;
!
! pango_layout_set_text(font->layout, &ch, 1);
! pango_layout_get_pixel_size(font->layout, &width, NULL);
! pango_layout_set_text(font->layout, NULL, 0);
!
! return width;
! } /* osGetFontCharWidth */
!
! void osDefaultFontDef(char **face, int *size, int *weight, int *style)
! {
! *face = "helvetica";
! *size = 12;
! *weight = 500;
! *style = 0;
! }
!
! void osDialogFontDef(char **face, int *size, int *weight, int *style)
! {
! *face = "helvetica";
! *size = 12;
! *weight = 500;
! *style = 0;
! }
!
! void osSerifFontDef(char **face, int *size, int *weight, int *style)
! {
! *face = "times";
! *size = 10;
! *weight = 400;
! *style = 0;
! };
!
! void osSansSerifFontDef(char **face, int *size, int *weight, int *style)
! {
! *face = "helvetica";
! *size = 10;
! *weight = 500;
! *style = 0;
! };
!
! void osSmallFontDef(char **face, int *size, int *weight, int *style)
! {
! *face = "helvetica";
! *size = 7;
! *weight = 500;
! *style = 0;
! };
!
! void osNonProportionalFontDef(char **face, int *size, int *weight, int *style)
! {
! *face = "fixed";
! *size = 10;
! *weight = 400;
! *style = 0;
! };
!
! void osSymbolFontDef(char **face, int *size, int *weight, int *style)
! {
! *face = "symbol";
! *size = 10;
! *weight = 400;
! *style = 0;
! };
--- 1,254 ----
! #include "Font.h"
! #include "Internals.h"
!
! char *osGetAvailableFontNames()
! {
! int i, nCount, nBufferSize;
! Display *display;
! PangoFontMap *fontmap;
! PangoFontFamily **families;
! char *buffer, *p;
!
! display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
! fontmap = pango_x_font_map_for_display(display);
!
! pango_font_map_list_families(fontmap, &families, &nCount);
!
! nBufferSize = 0;
! for (i = 0; i < nCount; i++)
! {
! nBufferSize += strlen(pango_font_family_get_name(families[i]))+1;
! }
!
! buffer = rmalloc(nBufferSize+1); p = buffer;
! for (i = 0; i < nCount; i++)
! {
! strcpy(p, pango_font_family_get_name(families[i]));
! p += strlen(p)+1;
! }
! *p = 0;
!
! g_free(families);
!
! return buffer;
! }
!
! int *osGetAvailableFontVariants(char *szFontName, int nLow, int nHight)
! {
! int i, nCount;
! Display *display;
! PangoFontMap *fontmap;
! PangoFontFamily **families, *family;
! PangoFontFace **faces;
! int *buffer, *p;
!
! display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
! fontmap = pango_x_font_map_for_display(display);
!
! pango_font_map_list_families(fontmap, &families, &nCount);
!
! family = NULL;
! for (i = 0; i < nCount; i++)
! {
! if (strcmp(pango_font_family_get_name(families[i]), szFontName) == 0)
! {
! family = families[i];
! break;
! }
! }
!
! g_free(families);
!
! if (family)
! {
! pango_font_family_list_faces(family, &faces, &nCount);
!
! buffer = rmalloc(sizeof(int)*(nCount*3+1)); p = buffer;
! for (i = 0; i < nCount; i++)
! {
! PangoFontDescription *desc = pango_font_face_describe(faces[i]);
!
! *(p++) = pango_font_description_get_weight(desc);
! switch (pango_font_description_get_style(desc))
! {
! case PANGO_STYLE_NORMAL: *(p++) = 0; break;
! case PANGO_STYLE_OBLIQUE: *(p++) = 1; break;
! case PANGO_STYLE_ITALIC: *(p++) = 2; break;
! default: *(p++) = -1; break;
! }
! *(p++) = 0;
!
! pango_font_description_free(desc);
! }
! *(p++) = 0;
!
! return buffer;
! }
!
! return NULL;
!
! }
!
! FontHandle osCreateFont(char *face, int size, int weight, int style, BOOL IsUnderlined, BOOL IsStriked)
! {
! FontHandle font;
! Display *display;
! PangoContext *pango_context;
! PangoFont *pango_font;
!
! font = rmalloc(sizeof(*font));
!
! display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
! pango_context = pango_x_get_context(display);
! font->layout = pango_layout_new(pango_context);
!
! font->font_descr = pango_font_description_new();
! pango_font_description_set_family(font->font_descr,face);
! pango_font_description_set_weight(font->font_descr,weight);
! pango_font_description_set_style(font->font_descr,style);
! pango_font_description_set_size(font->font_descr, size*PANGO_SCALE);
!
! pango_layout_set_font_description(font->layout, font->font_descr);
!
! pango_font = pango_font_map_load_font
! ( pango_x_font_map_for_display(display)
! , NULL
! , font->font_descr
! );
! font->metrics = pango_font_get_metrics(pango_font, pango_context_get_language(pango_context));
!
! font->IsUnderlined = IsUnderlined;
! font->IsStriked = IsStriked;
!
! if (font->IsUnderlined || font->IsStriked)
! pango_layout_set_attributes(font->layout, pango_attr_list_new());
!
! return font;
! }
!
! void osDeleteFont(FontHandle font)
! {
! pango_font_metrics_unref(font->metrics);
! pango_font_description_free(font->font_descr);
! g_object_unref(font->layout);
! rfree(font);
! } /* osDeleteFont */
!
! void osGetFontMetrics(FontHandle font, CanvasHandle canvas, int *ascent, int *descent, int *maxwidth, int *leading)
! {
! *ascent = pango_font_metrics_get_ascent(font->metrics)/PANGO_SCALE;
! *descent = pango_font_metrics_get_descent(font->metrics)/PANGO_SCALE;
! *maxwidth = pango_font_metrics_get_approximate_char_width(font->metrics)/PANGO_SCALE;
! *leading = 2; /* FIXME */
! } /* osGetFontMetrics */
!
!
! void osGetPenFontMetrics(CanvasHandle canvas, int *ascent, int *descent, int *maxwidth, int *leading)
! {
! *ascent = pango_font_metrics_get_ascent(canvas->theFont->metrics)/PANGO_SCALE;
! *descent = pango_font_metrics_get_descent(canvas->theFont->metrics)/PANGO_SCALE;
! *maxwidth = pango_font_metrics_get_approximate_char_width(canvas->theFont->metrics)/PANGO_SCALE;
! *leading = 2; /* FIXME */
! } /* osGetPenFontMetrics */
!
!
! int osGetStringWidth(char *string, CanvasHandle canvas)
! {
! int width;
!
! pango_layout_set_text(canvas->theFont->layout, string, -1);
! pango_layout_get_pixel_size(canvas->theFont->layout, &width, NULL);
! pango_layout_set_text(canvas->theFont->layout, NULL, 0);
!
!
! return width;
! } /* osGetStringWidth */
!
! int osGetCharWidth(char ch, CanvasHandle canvas)
! {
! int width;
!
! pango_layout_set_text(canvas->theFont->layout, &ch, 1);
! pango_layout_get_pixel_size(canvas->theFont->layout, &width, NULL);
! pango_layout_set_text(canvas->theFont->layout, NULL, 0);
!
! return width;
! } /* osGetCharWidth */
!
! int osGetFontStringWidth(char *string, FontHandle font, CanvasHandle canvas)
! {
! int width;
!
! pango_layout_set_text(font->layout, string, -1);
! pango_layout_get_pixel_size(font->layout, &width, NULL);
! pango_layout_set_text(font->layout, NULL, 0);
!
! return width;
! } /* osGetFontStringWidth */
!
! int osGetFontCharWidth(char ch, FontHandle font, CanvasHandle canvas)
! {
! int width;
!
! pango_layout_set_text(font->layout, &ch, 1);
! pango_layout_get_pixel_size(font->layout, &width, NULL);
! pango_layout_set_text(font->layout, NULL, 0);
!
! return width;
! } /* osGetFontCharWidth */
!
! void osDefaultFontDef(char **face, int *size, int *weight, int *style)
! {
! *face = "helvetica";
! *size = 12;
! *weight = 500;
! *style = 0;
! }
!
! void osDialogFontDef(char **face, int *size, int *weight, int *style)
! {
! *face = "helvetica";
! *size = 12;
! *weight = 500;
! *style = 0;
! }
!
! void osSerifFontDef(char **face, int *size, int *weight, int *style)
! {
! *face = "times";
! *size = 10;
! *weight = 400;
! *style = 0;
! };
!
! void osSansSerifFontDef(char **face, int *size, int *weight, int *style)
! {
! *face = "helvetica";
! *size = 10;
! *weight = 500;
! *style = 0;
! };
!
! void osSmallFontDef(char **face, int *size, int *weight, int *style)
! {
! *face = "helvetica";
! *size = 7;
! *weight = 500;
! *style = 0;
! };
!
! void osNonProportionalFontDef(char **face, int *size, int *weight, int *style)
! {
! *face = "fixed";
! *size = 10;
! *weight = 400;
! *style = 0;
! };
!
! void osSymbolFontDef(char **face, int *size, int *weight, int *style)
! {
! *face = "symbol";
! *size = 10;
! *weight = 400;
! *style = 0;
! };
|
|
From: <kr_...@us...> - 2003-02-17 23:08:21
|
Update of /cvsroot/htoolkit/port/src/Port
In directory sc8-pr-cvs1:/tmp/cvs-serv1886
Added Files:
Timer.hs
Log Message:
import
--- NEW FILE: Timer.hs ---
{-# OPTIONS -fglasgow-exts -#include Types.h -#include Timer.h #-}
-----------------------------------------------------------------------------------------
{-| Module : Handlers
Copyright : (c) Krasimir Angelov 2003
License : BSD-style
Maintainer : ka2...@ya...
Stability : provisional
Portability : portable
Timers
-}
-----------------------------------------------------------------------------------------
module Graphics.UI.Port.Timer
( createTimer, destroyTimer
, getAllTimerHandles, destroyAllTimers
) where
import Prelude hiding (lookup)
import Graphics.UI.Port.Types
import Graphics.UI.Port.PtrMap
import Graphics.UI.Port.Handlers(registerTimer, unregisterTimer, getAllTimerHandles)
import System.IO.Unsafe( unsafePerformIO )
import Control.Concurrent.MVar
-- | Create a timer with a handler that is called on a specified milli-second interval.
createTimer :: Int -> IO () -> IO TimerHandle
createTimer msecs handler = do
htimer <- osCreateTimer msecs
registerTimer htimer handler
return htimer
foreign import ccall osCreateTimer :: Int -> IO TimerHandle
-- | Destroy a timer and automatically unregister its event handler.
destroyTimer :: TimerHandle -> IO ()
destroyTimer htimer = do
unregisterTimer htimer
osDestroyTimer htimer
foreign import ccall osDestroyTimer :: TimerHandle -> IO ()
-- Destroy all timers (called by quit).
destroyAllTimers :: IO ()
destroyAllTimers = getAllTimerHandles >>= mapM_ osDestroyTimer
|
|
From: <kr_...@us...> - 2003-02-10 22:42:42
|
Update of /cvsroot/htoolkit/port/src/Port
In directory sc8-pr-cvs1:/tmp/cvs-serv30164a/src/Port
Modified Files:
Handlers.hs Types.hs Window.hs
Log Message:
MDI/SDI interface for Windows
Index: Handlers.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/Port/Handlers.hs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Handlers.hs 31 Jan 2003 21:06:13 -0000 1.7
--- Handlers.hs 10 Feb 2003 22:42:08 -0000 1.8
***************
*** 1,10 ****
! {-# OPTIONS -fglasgow-exts -#include Types.h -#include Timer.h #-}
-----------------------------------------------------------------------------------------
{-| Module : Handlers
! Copyright : (c) Daan Leijen 2003
License : BSD-style
! Maintainer : da...@cs...
Stability : provisional
Portability : portable
--- 1,10 ----
! {-# OPTIONS -fglasgow-exts -#include Types.h #-}
-----------------------------------------------------------------------------------------
{-| Module : Handlers
! Copyright : (c) Krasimir Angelov & Daan Leijen 2003
License : BSD-style
! Maintainer : ka2...@ya... da...@cs...
Stability : provisional
Portability : portable
***************
*** 23,44 ****
When 'quit' is called, it will close all windows, unregister all event handlers
and destroy all timers. 'quit' is called automatically when the last window
! is destroyed unless 'enableAutoQuit' is called with a 'False' argument.
-}
-----------------------------------------------------------------------------------------
module Graphics.UI.Port.Handlers
(
! -- * Quit
! quit, enableAutoQuit
!
! -- ** Clean up
! ,destroyAllTimers
! ,unregisterAllHandlers
! ,unregisterAllWindowHandlers
-- * Timers
! , createTimer, destroyTimer
!
-- * Windows
! ,registerWindow
-- ** Register events
--- 23,39 ----
When 'quit' is called, it will close all windows, unregister all event handlers
and destroy all timers. 'quit' is called automatically when the last window
! is destroyed.
-}
-----------------------------------------------------------------------------------------
module Graphics.UI.Port.Handlers
(
! -- * Clean up
! unregisterAllWindowHandlers
-- * Timers
! ,registerTimer, unregisterTimer, getAllTimerHandles
!
-- * Windows
! ,registerWindow, unregisterWindow, getAllWindowHandles
-- ** Register events
***************
*** 52,56 ****
,registerWindowKeyboard
,registerWindowDeactivate
! ,registerWindowActivate
-- ** Fire events
--- 47,51 ----
,registerWindowKeyboard
,registerWindowDeactivate
! ,registerWindowActivate
-- ** Fire events
***************
*** 67,71 ****
,unregisterWindowKeyboard
,unregisterWindowDeactivate
! ,unregisterWindowActivate
-- * Commands
--- 62,74 ----
,unregisterWindowKeyboard
,unregisterWindowDeactivate
! ,unregisterWindowActivate
!
! -- * Process
! -- ** Register events
! ,registerDismissProcess
! ,registerDestroyProcess
! -- ** Unregister events
! ,unregisterDismissProcess
! ,unregisterDestroyProcess
-- * Commands
***************
*** 99,103 ****
import Prelude hiding (lookup)
import Graphics.UI.Port.Types
! import Graphics.UI.Port.PtrMap
import Foreign.C
--- 102,106 ----
import Prelude hiding (lookup)
import Graphics.UI.Port.Types
! import Graphics.UI.Port.PtrMap
import Foreign.C
***************
*** 106,110 ****
import Control.Monad( when )
import System.IO.Unsafe( unsafePerformIO )
- import System.Mem( performGC )
{-----------------------------------------------------------------------------------------
--- 109,112 ----
***************
*** 112,117 ****
-----------------------------------------------------------------------------------------}
safeio :: IO () -> IO ()
! safeio io
! = io `catch` (\err -> do print err; return ())
invokeHandler :: Ptr a -> MVar (PtrMap a b) -> (b -> IO ()) -> IO ()
--- 114,118 ----
-----------------------------------------------------------------------------------------}
safeio :: IO () -> IO ()
! safeio io = io `catch` print
invokeHandler :: Ptr a -> MVar (PtrMap a b) -> (b -> IO ()) -> IO ()
***************
*** 137,183 ****
{-----------------------------------------------------------------------------------------
- quit
- -----------------------------------------------------------------------------------------}
- -- | 'quit' exits the main event loop, closes any windows and menus, destroys all timers
- -- and unregisters any event handlers. This function is automatically called when all
- -- windows are closed, unless 'enableAutoQuit' has been called with a 'False' argument.
- quit :: IO ()
- quit
- = do osQuit
- destroyAllTimers
- unregisterAllHandlers
- performGC -- to release any foreign objects
- return ()
- foreign import ccall osQuit :: IO ()
-
- {-----------------------------------------------------------------------------------------
Unregister many.
-----------------------------------------------------------------------------------------}
- -- | Unregister all current event handlers (including menu handlers). This function
- -- is called by 'quit' when the GUI event loop terminates.
- unregisterAllHandlers :: IO ()
- unregisterAllHandlers
- = do clear handlersWindowDestroy
- clear handlersWindowReLayout
- clear handlersWindowDismiss
- clear handlersWindowPaint
- clear handlersWindowResize
- clear handlersWindowScroll
- clear handlersWindowMouse
- clear handlersWindowKeyboard
- clear handlersWindowDeactivate
- clear handlersWindowActivate
- clear handlersPopUpClick
- clear handlersListBoxClick
- clear handlersRadioBoxClick
- clear handlersCheckBoxClick
- clear handlersButtonClick
- clear handlersMenuCommand -- menu commands
- clear handlersMenuUpdate -- menu updates
- return ()
- where
- clear mvar
- = do swapMVar mvar empty
-
-- | Unregister all event handlers and menu handlers associated with a specific window.
--- 138,143 ----
***************
*** 226,231 ****
mapM_ unregisterMenuCommand menus
-
-
{-----------------------------------------------------------------------------------------
Keep track of all windows
--- 186,189 ----
***************
*** 246,266 ****
-- returns True when this was the last open window.
! unregisterWindow :: WindowHandle -> IO Bool
unregisterWindow hwnd
= do set <- takeMVar windows
! let set' = delete hwnd set
! putMVar windows set'
! return (isEmpty set')
!
! {-# NOINLINE autoQuit #-}
! autoQuit :: MVar Bool
! autoQuit = unsafePerformIO (newMVar True)
!
! -- | If called with 'True', 'quit' is called automatically when all windows are
! -- closed. Returns the previous value.
! enableAutoQuit :: Bool -> IO Bool
! enableAutoQuit enable
! = swapMVar autoQuit enable
{-----------------------------------------------------------------------------------------
--- 204,214 ----
-- returns True when this was the last open window.
! unregisterWindow :: WindowHandle -> IO ()
unregisterWindow hwnd
= do set <- takeMVar windows
! putMVar windows (delete hwnd set)
+ getAllWindowHandles :: IO [WindowHandle]
+ getAllWindowHandles = fmap keys (readMVar windows)
{-----------------------------------------------------------------------------------------
***************
*** 291,298 ****
Nothing -> return ()
Just io -> safeio io
! last <- unregisterWindow hwnd
! aquit <- readMVar autoQuit
! when (last && aquit) quit -- call quit when last window is destroyed (and autoQuit is enabled).
!
{-----------------------------------------------------------------------------------------
--- 239,243 ----
Nothing -> return ()
Just io -> safeio io
! unregisterWindow hwnd
{-----------------------------------------------------------------------------------------
***************
*** 334,339 ****
= unregister hwnd handlersWindowDismiss
! handleWindowClose :: WindowHandle -> IO ()
! handleWindowClose hwnd
= invokeHandler hwnd handlersWindowDismiss id
--- 279,284 ----
= unregister hwnd handlersWindowDismiss
! handleWindowDismiss :: WindowHandle -> IO ()
! handleWindowDismiss hwnd
= invokeHandler hwnd handlersWindowDismiss id
***************
*** 595,598 ****
--- 540,581 ----
= invokeHandler hmenu handlersMenuCommand id
+ {-----------------------------------------------------------------------------------------
+ Process
+ -----------------------------------------------------------------------------------------}
+ {-# NOINLINE handlersDismissProcess #-}
+ handlersDismissProcess :: MVar (IO ())
+ handlersDismissProcess
+ = unsafePerformIO (newMVar (return ()))
+
+ registerDismissProcess :: IO () -> IO ()
+ registerDismissProcess handler = do
+ takeMVar handlersDismissProcess
+ putMVar handlersDismissProcess handler
+
+ unregisterDismissProcess :: IO ()
+ unregisterDismissProcess = do
+ takeMVar handlersDismissProcess
+ putMVar handlersDismissProcess (return ())
+
+ handleDismissProcess :: IO ()
+ handleDismissProcess = readMVar handlersDismissProcess >>= id
+
+ {-# NOINLINE handlersDestroyProcess #-}
+ handlersDestroyProcess :: MVar (IO ())
+ handlersDestroyProcess
+ = unsafePerformIO (newMVar (return ()))
+
+ registerDestroyProcess :: IO () -> IO ()
+ registerDestroyProcess handler = do
+ takeMVar handlersDestroyProcess
+ putMVar handlersDestroyProcess handler
+
+ unregisterDestroyProcess :: IO ()
+ unregisterDestroyProcess = do
+ takeMVar handlersDestroyProcess
+ putMVar handlersDestroyProcess (return ())
+
+ handleDestroyProcess :: IO ()
+ handleDestroyProcess = readMVar handlersDestroyProcess >>= id
{-----------------------------------------------------------------------------------------
***************
*** 608,639 ****
= invokeHandler htimer handlersTimer id
! -- | Create a timer with a handler that is called on a specified milli-second interval.
! createTimer :: Int -> IO () -> IO TimerHandle
! createTimer msecs handler
! = do htimer <- osCreateTimer msecs
! register htimer handler handlersTimer
! return htimer
! foreign import ccall osCreateTimer :: Int -> IO TimerHandle
!
! -- | Destroy a timer and automatically unregister its event handler.
! destroyTimer :: TimerHandle -> IO ()
! destroyTimer htimer
! = do unregister htimer handlersTimer
! osDestroyTimer htimer
! foreign import ccall osDestroyTimer :: TimerHandle -> IO ()
! -- Destroy all timers (called by quit).
! destroyAllTimers :: IO ()
! destroyAllTimers
! = do map <- readMVar handlersTimer
! mapM_ destroyTimer (keys map)
! swapMVar handlersTimer empty -- paranoia
! return ()
{-----------------------------------------------------------------------------------------
foreign exports
-----------------------------------------------------------------------------------------}
! foreign export ccall handleWindowClose :: WindowHandle -> IO ()
foreign export ccall handleWindowReLayout :: WindowHandle -> IO ()
foreign export ccall handleWindowDestroy :: WindowHandle -> IO ()
--- 591,609 ----
= invokeHandler htimer handlersTimer id
! registerTimer :: TimerHandle -> IO () -> IO ()
! registerTimer htimer handler
! = register htimer handler handlersTimer
! unregisterTimer :: TimerHandle -> IO ()
! unregisterTimer htimer
! = unregister htimer handlersTimer
+ getAllTimerHandles :: IO [TimerHandle]
+ getAllTimerHandles = fmap keys (readMVar handlersTimer)
{-----------------------------------------------------------------------------------------
foreign exports
-----------------------------------------------------------------------------------------}
! foreign export ccall handleWindowDismiss :: WindowHandle -> IO ()
foreign export ccall handleWindowReLayout :: WindowHandle -> IO ()
foreign export ccall handleWindowDestroy :: WindowHandle -> IO ()
***************
*** 653,654 ****
--- 623,626 ----
foreign export ccall handleMenusUpdate :: IO ()
foreign export ccall handleTimer :: TimerHandle -> IO ()
+ foreign export ccall handleDismissProcess :: IO ()
+ foreign export ccall handleDestroyProcess :: IO ()
\ No newline at end of file
Index: Types.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/Port/Types.hs,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** Types.hs 31 Jan 2003 01:01:43 -0000 1.12
--- Types.hs 10 Feb 2003 22:42:09 -0000 1.13
***************
*** 77,80 ****
--- 77,83 ----
, KeyboardEvent(..), Key(..), keyModifiers
, keyboardKey, keyboardRepeat
+
+ -- * Document interface
+ , DocumentInterface(..)
-- * Primitive Handles
***************
*** 106,109 ****
--- 109,114 ----
, fromCMouseEvent
, fromCKeyboardEvent
+
+ , toCDocumentInterface
, fromCInt, toCInt
***************
*** 778,781 ****
--- 783,800 ----
13 -> KeyLost key
+ {-----------------------------------------------------------------------------------------
+ Document interface
+ -----------------------------------------------------------------------------------------}
+ -- | The document interface type of interactive processes.
+ data DocumentInterface
+ = NDI -- ^ No document interface
+ | SDI -- ^ Single document interface
+ | MDI -- ^ Multiple document interface
+ deriving (Eq,Show)
+
+ toCDocumentInterface :: DocumentInterface -> CInt
+ toCDocumentInterface NDI = 0
+ toCDocumentInterface SDI = 1
+ toCDocumentInterface MDI = 2
{-----------------------------------------------------------------------------------------
Index: Window.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/Port/Window.hs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Window.hs 8 Feb 2003 08:38:08 -0000 1.4
--- Window.hs 10 Feb 2003 22:42:09 -0000 1.5
***************
*** 2,9 ****
-----------------------------------------------------------------------------------------
{-| Module : Window
! Copyright : (c) Daan Leijen 2003
License : BSD-style
! Maintainer : da...@cs...
Stability : provisional
Portability : portable
--- 2,9 ----
-----------------------------------------------------------------------------------------
{-| Module : Window
! Copyright : (c) Krasimir Angelov & Daan Leijen 2003
License : BSD-style
! Maintainer : ka2...@ya... & da...@cs...
Stability : provisional
Portability : portable
***************
*** 15,21 ****
(
-- * Creation
! createWindow, createDialog, createMDIWindow
-- * Operations
! , showWindow, runWindow, closeWindow
, scrollWindowTo
, invalidateWindowFrame
--- 15,23 ----
(
-- * Creation
! createWindow, createDialog
-- * Operations
! , showWindow, runWindow
! , dismissWindow, dismissAllWindows
! , destroyWindow, destroyAllWindows
, scrollWindowTo
, invalidateWindowFrame
***************
*** 38,44 ****
import Foreign.Ptr
import Foreign.Marshal.Alloc
import Graphics.UI.Port.Types
import Graphics.UI.Port.Canvas(initCanvas, doneCanvas, defaultPen, dialogPen)
! import Graphics.UI.Port.Handlers( registerWindow, registerWindowPaint )
{-----------------------------------------------------------------------------------------
--- 40,49 ----
import Foreign.Ptr
import Foreign.Marshal.Alloc
+ import System.IO.Unsafe( unsafePerformIO )
+ import Control.Concurrent.MVar
+ import Graphics.UI.Port.PtrMap
import Graphics.UI.Port.Types
import Graphics.UI.Port.Canvas(initCanvas, doneCanvas, defaultPen, dialogPen)
! import Graphics.UI.Port.Handlers( getAllWindowHandles, registerWindow, registerWindowDismiss, registerWindowPaint )
{-----------------------------------------------------------------------------------------
***************
*** 71,81 ****
-- | Create a new (invisible) window.
createWindow :: IO WindowHandle
! createWindow
! = do hwnd <- osCreateWindow
! registerWindow hwnd
! registerWindowPaint hwnd onpaint
! return hwnd
! where
! onpaint canvas rect = do
initCanvas defaultPen UnBuffered canvas
doneCanvas canvas
--- 76,87 ----
-- | Create a new (invisible) window.
createWindow :: IO WindowHandle
! createWindow = do
! hwnd <- osCreateWindow
! registerWindow hwnd
! registerWindowPaint hwnd onpaint
! registerWindowDismiss hwnd (destroyWindow hwnd)
! return hwnd
! where
! onpaint canvas rect = do
initCanvas defaultPen UnBuffered canvas
doneCanvas canvas
***************
*** 84,106 ****
-- | Create a new (invisible) dialog window.
createDialog :: WindowHandle -> IO WindowHandle
! createDialog hparent
! = do hwnd <- osCreateDialog hparent
! registerWindow hwnd
! registerWindowPaint hwnd onpaint
! return hwnd
! where
onpaint canvas rect = do
! initCanvas dialogPen UnBuffered canvas
doneCanvas canvas
foreign import ccall osCreateDialog :: WindowHandle -> IO WindowHandle
- -- | Create a new (invisible) MDI window.
- createMDIWindow :: WindowHandle -> IO WindowHandle
- createMDIWindow hparent
- = do hwnd <- osCreateMDIWindow hparent
- registerWindow hwnd
- return hwnd
- foreign import ccall osCreateMDIWindow :: WindowHandle -> IO WindowHandle
-
-- | Set the default foreground color, background color and hatch style.
setWindowColor :: WindowHandle -> Color -> Color -> HatchStyle -> IO ()
--- 90,105 ----
-- | Create a new (invisible) dialog window.
createDialog :: WindowHandle -> IO WindowHandle
! createDialog hparent = do
! hwnd <- osCreateDialog hparent
! registerWindow hwnd
! registerWindowPaint hwnd onpaint
! registerWindowDismiss hwnd (destroyWindow hwnd)
! return hwnd
! where
onpaint canvas rect = do
! initCanvas dialogPen UnBuffered canvas
doneCanvas canvas
foreign import ccall osCreateDialog :: WindowHandle -> IO WindowHandle
-- | Set the default foreground color, background color and hatch style.
setWindowColor :: WindowHandle -> Color -> Color -> HatchStyle -> IO ()
***************
*** 138,143 ****
foreign import ccall "osRunWindow" runWindow :: WindowHandle -> IO ()
! -- | Close a window.
! foreign import ccall "osCloseWindow" closeWindow :: WindowHandle -> IO ()
-- | Get the size of the view frame.
--- 137,158 ----
foreign import ccall "osRunWindow" runWindow :: WindowHandle -> IO ()
! -- | Dismiss a window.
! dismissWindow :: WindowHandle -> IO Bool
! dismissWindow hwnd = fmap fromCBool (osDismissWindow hwnd)
! foreign import ccall osDismissWindow :: WindowHandle -> IO CBool
!
! dismissAllWindows :: IO Bool
! dismissAllWindows = getAllWindowHandles >>= dismiss
! where
! dismiss [] = return True
! dismiss (h:hs) = do
! r <- dismissWindow h
! if r then dismiss hs else return False
!
! -- | Destroy a window.
! foreign import ccall "osDestroyWindow" destroyWindow :: WindowHandle -> IO ()
!
! destroyAllWindows :: IO ()
! destroyAllWindows = getAllWindowHandles >>= mapM_ destroyWindow
-- | Get the size of the view frame.
|
|
From: <kr_...@us...> - 2003-02-10 22:42:42
|
Update of /cvsroot/htoolkit/port/src
In directory sc8-pr-cvs1:/tmp/cvs-serv30164a/src
Modified Files:
Port.hs
Log Message:
MDI/SDI interface for Windows
Index: Port.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/Port.hs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Port.hs 31 Jan 2003 01:01:42 -0000 1.6
--- Port.hs 10 Feb 2003 22:42:08 -0000 1.7
***************
*** 27,30 ****
--- 27,33 ----
, module Graphics.UI.Port.Font
, module Graphics.UI.Port.Bitmap
+
+ -- ** Timers
+ , module Graphics.UI.Port.Timer
-- ** Fundamental
***************
*** 33,37 ****
-- * The main event loop
! , start
) where
--- 36,40 ----
-- * The main event loop
! , start, quit
) where
***************
*** 45,49 ****
import Graphics.UI.Port.FileDialog
import Graphics.UI.Port.Window
! import Graphics.UI.Port.Menu
import Graphics.UI.Port.Types hiding
--- 48,54 ----
import Graphics.UI.Port.FileDialog
import Graphics.UI.Port.Window
! import Graphics.UI.Port.Menu
!
! import Graphics.UI.Port.Timer
import Graphics.UI.Port.Types hiding
***************
*** 65,68 ****
)
-- | Start the event loop. Runs until 'quit' is called.
! foreign import ccall "osStart" start :: IO ();
--- 70,97 ----
)
+ import Foreign.C
+ import System.Mem( performGC )
+ import Control.Monad(when)
+
-- | Start the event loop. Runs until 'quit' is called.
! start :: String -> DocumentInterface -> IO a -> IO a
! start appName di io = do
! withCString appName (\s -> osInit s (toCDocumentInterface di))
! registerDismissProcess quit
! r <- io
! osStart
! return r
! foreign import ccall "osInit" osInit :: CString -> CInt -> IO ()
! foreign import ccall "osStart" osStart :: IO ()
!
! -- | 'quit' exits the main event loop, closes any windows and menus, destroys all timers
! -- and unregisters any event handlers. This function is automatically called when all
! -- windows are closed.
! quit :: IO ()
! quit = do
! r <- dismissAllWindows
! when r $ do
! destroyAllTimers
! osQuit
! performGC -- to release any foreign objects
! foreign import ccall osQuit :: IO ()
\ No newline at end of file
|
|
From: <kr_...@us...> - 2003-02-10 22:42:42
|
Update of /cvsroot/htoolkit/port In directory sc8-pr-cvs1:/tmp/cvs-serv30164a Modified Files: makefile Log Message: MDI/SDI interface for Windows Index: makefile =================================================================== RCS file: /cvsroot/htoolkit/port/makefile,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** makefile 31 Jan 2003 21:06:12 -0000 1.9 --- makefile 10 Feb 2003 22:42:07 -0000 1.10 *************** *** 38,41 **** --- 38,42 ---- Port/Controls.hs \ Port/FileDialog.hs Port/Menu.hs Port/Window.hs \ + Port/Timer.hs \ Port.hs *************** *** 44,48 **** CSRCS = Window.c Util.c Bitmap.c Button.c CheckBox.c EditBox.c \ FileDialog.c PopUp.c Canvas.c Menu.c ListBox.c Label.c \ ! Font.c RadioBox.c Timer.c # package description --- 45,49 ---- CSRCS = Window.c Util.c Bitmap.c Button.c CheckBox.c EditBox.c \ FileDialog.c PopUp.c Canvas.c Menu.c ListBox.c Label.c \ ! Font.c RadioBox.c Timer.c Frame.c # package description |
Update of /cvsroot/htoolkit/port/src/cbits/GTK
In directory sc8-pr-cvs1:/tmp/cvs-serv30164a/src/cbits/GTK
Modified Files:
Bitmap.c Button.c Canvas.c CheckBox.c EditBox.c Font.c Label.c
ListBox.c PopUp.c RadioBox.c Timer.c Util.c Window.c
Log Message:
MDI/SDI interface for Windows
Index: Bitmap.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Bitmap.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Bitmap.c 31 Jan 2003 23:25:37 -0000 1.3
--- Bitmap.c 10 Feb 2003 22:42:09 -0000 1.4
***************
*** 10,14 ****
GdkPixbuf *pixbuf;
- initGUI();
pixbuf = gdk_pixbuf_new_from_file(filename, &err);
--- 10,13 ----
***************
*** 104,109 ****
rectangle.width = bitmap->width;
rectangle.height = bitmap->height;
-
- initGUI();
sys_colormap = gdk_colormap_get_system();
--- 103,106 ----
Index: Button.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Button.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Button.c 23 Jan 2003 20:19:32 -0000 1.2
--- Button.c 10 Feb 2003 22:42:09 -0000 1.3
***************
*** 8,13 ****
GtkWidget *button;
- initGUI();
-
button = gtk_button_new_with_mnemonic("");
gtk_signal_connect (GTK_OBJECT(button), "clicked",
--- 8,11 ----
Index: Canvas.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Canvas.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Canvas.c 3 Feb 2003 16:53:40 -0000 1.8
--- Canvas.c 10 Feb 2003 22:42:09 -0000 1.9
***************
*** 6,10 ****
int osMMtoVPixels(double mm)
{
- initGUI();
return (int) ((mm*gdk_screen_height())/gdk_screen_height_mm());
}
--- 6,9 ----
***************
*** 12,16 ****
int osMMtoHPixels(double mm)
{
- initGUI();
return (int) ((mm*gdk_screen_width())/gdk_screen_width_mm());
}
--- 11,14 ----
***************
*** 650,654 ****
CanvasHandle canvas;
- initGUI();
canvas = rmalloc(sizeof(*canvas));
memset(canvas, 0, sizeof(*canvas));
--- 648,651 ----
Index: CheckBox.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/CheckBox.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CheckBox.c 23 Jan 2003 20:19:32 -0000 1.2
--- CheckBox.c 10 Feb 2003 22:42:09 -0000 1.3
***************
*** 8,13 ****
gchar *szText = toMnemonicString(title);
- initGUI();
-
check_btn = gtk_check_button_new_with_mnemonic(szText);
gtk_fixed_put(GTK_FIXED(GTK_BIN(GetSW(window)->child)->child), check_btn, 0, 0);
--- 8,11 ----
Index: EditBox.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/EditBox.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** EditBox.c 27 Jan 2003 22:02:44 -0000 1.3
--- EditBox.c 10 Feb 2003 22:42:09 -0000 1.4
***************
*** 7,12 ****
GtkWidget *entry;
- initGUI();
-
entry = gtk_entry_new();
gtk_fixed_put(GTK_FIXED(GTK_BIN(GetSW(window)->child)->child), entry, 0, 0);
--- 7,10 ----
Index: Font.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Font.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Font.c 23 Jan 2003 20:19:32 -0000 1.2
--- Font.c 10 Feb 2003 22:42:09 -0000 1.3
***************
*** 10,15 ****
char *buffer, *p;
- initGUI();
-
display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
fontmap = pango_x_font_map_for_display(display);
--- 10,13 ----
***************
*** 46,51 ****
gchar **xfontnames;
- initGUI();
-
display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
fontmap = pango_x_font_map_for_display(display);
--- 44,47 ----
***************
*** 102,107 ****
PangoContext *pango_context;
PangoFont *pango_font;
-
- initGUI();
font = rmalloc(sizeof(*font));
--- 98,101 ----
Index: Label.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Label.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Label.c 23 Jan 2003 20:19:32 -0000 1.2
--- Label.c 10 Feb 2003 22:42:09 -0000 1.3
***************
*** 9,14 ****
GtkWidget *text;
- initGUI();
-
text = gtk_label_new("");
gtk_label_set_line_wrap(GTK_LABEL(text), gtk_false());
--- 9,12 ----
Index: ListBox.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/ListBox.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ListBox.c 23 Jan 2003 20:19:32 -0000 1.2
--- ListBox.c 10 Feb 2003 22:42:09 -0000 1.3
***************
*** 25,30 ****
GtkWidget *lbox;
- initGUI();
-
lbox = gtk_list_new();
if (!multisel)
--- 25,28 ----
Index: PopUp.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/PopUp.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PopUp.c 23 Jan 2003 20:19:32 -0000 1.2
--- PopUp.c 10 Feb 2003 22:42:09 -0000 1.3
***************
*** 12,17 ****
GtkWidget *popup;
- initGUI();
-
popup = gtk_combo_new();
gtk_entry_set_editable (GTK_ENTRY(GTK_COMBO(popup)->entry), gtk_false());
--- 12,15 ----
Index: RadioBox.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/RadioBox.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RadioBox.c 23 Jan 2003 20:19:32 -0000 1.2
--- RadioBox.c 10 Feb 2003 22:42:09 -0000 1.3
***************
*** 10,15 ****
gchar *szText = toMnemonicString(title);
- initGUI();
-
if (isFirst)
{
--- 10,13 ----
Index: Timer.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Timer.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Timer.c 23 Jan 2003 20:19:32 -0000 1.2
--- Timer.c 10 Feb 2003 22:42:09 -0000 1.3
***************
*** 1,5 ****
#include "Timer.h"
- #include "Internals.h"
#include "Handlers_stub.h"
static gboolean osTimerProc( gpointer data )
--- 1,5 ----
#include "Timer.h"
#include "Handlers_stub.h"
+ #include "Internals.h"
static gboolean osTimerProc( gpointer data )
***************
*** 18,21 ****
--- 18,22 ----
*timer = timerid;
+ gActiveObjects++;
return timer;
}
***************
*** 27,30 ****
--- 28,32 ----
gtk_timeout_remove( *timer );
rfree(timer);
+ gActiveObjects--;
}
}
Index: Util.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Util.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Util.c 23 Jan 2003 20:19:32 -0000 1.2
--- Util.c 10 Feb 2003 22:42:09 -0000 1.3
***************
*** 24,28 ****
}
! void initGUI()
{
if (!bInitialized)
--- 24,28 ----
}
! void osInit(char *AppName, int DocumentInterface)
{
if (!bInitialized)
***************
*** 60,63 ****
--- 60,65 ----
gtk_main_iteration();
}
+
+ handleDestroyProcess();
}
Index: Window.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Window.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Window.c 23 Jan 2003 20:19:32 -0000 1.2
--- Window.c 10 Feb 2003 22:42:09 -0000 1.3
***************
*** 272,276 ****
static gboolean frame_delete_handler(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
! handleWindowClose(widget);
return gtk_true();
}
--- 272,276 ----
static gboolean frame_delete_handler(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
! handleWindowDismiss(widget);
return gtk_true();
}
***************
*** 367,372 ****
GtkWidget *window, *vbox, *fixed, *sw, *viewport;
- initGUI();
-
/* Create a toplevel */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
--- 367,370 ----
***************
*** 453,461 ****
}
- WindowHandle osCreateMDIWindow(WindowHandle mdiWindow)
- {
- return NULL;
- }
-
void osSetWindowColor(WindowHandle window, int foreColor, int backColor, int hatchStyle, BitmapHandle hatchBitmap)
{
--- 451,454 ----
***************
*** 570,574 ****
void osShowWindow(WindowHandle window)
{
- initGUI();
gtk_widget_show(window);
};
--- 563,566 ----
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv30164a/src/cbits/Win32
Modified Files:
Button.c CheckBox.c EditBox.c Label.c ListBox.c PopUp.c
RadioBox.c Timer.c Util.c Window.c
Added Files:
Frame.c
Log Message:
MDI/SDI interface for Windows
--- NEW FILE: Frame.c ---
#include "Types.h"
#include "Internals.h"
#include "Handlers_stub.h"
#define OSMenuIDEnd 500
LRESULT CALLBACK HMDIFrameFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_CLOSE:
handleDismissProcess();
return 0;
case WM_CREATE:
{
HMENU hMenuBar, hMenuWindow;
CLIENTCREATESTRUCT clientcreate;
hMenuBar = CreateMenu (); // Create the menu bar
SetMenu (hWnd,hMenuBar); // and associate it with the frame window
hMenuWindow = CreatePopupMenu(); // Create the "Window" menu
InsertMenu (hMenuBar, // add it to the menuBar
0xFFFFFFFF, // at the end
MF_BYPOSITION | MF_POPUP, // Flags
(UINT) hMenuWindow, // the "Window" menu
"&Window" // and set its title
);
InsertMenu (hMenuWindow,0,MF_BYPOSITION | MF_STRING,OSMenuIDEnd+1,"Arrange &Icons"); // Add "Arrange Icons" command
InsertMenu (hMenuWindow,0,MF_BYPOSITION | MF_STRING,OSMenuIDEnd+2,"&Tile Vertically"); // Add "Tile Vertically" command
InsertMenu (hMenuWindow,0,MF_BYPOSITION | MF_STRING,OSMenuIDEnd+3,"Tile &Horizontally"); // Add "Tile Horizontally" command
InsertMenu (hMenuWindow,0,MF_BYPOSITION | MF_STRING,OSMenuIDEnd+4,"&Cascade"); // Add "Cascade" command
clientcreate.hWindowMenu = hMenuWindow;
clientcreate.idFirstChild = OSMenuIDEnd+5; // Window ids must be generated from OSMenuIDEnd+5
ghWndClient = CreateWindow ("MDICLIENT", // The MDICLIENT window class
NULL, // The window name
MDIS_ALLCHILDSTYLES | WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE,
0,0, // position (x,y)
0,0, // size (w,h)
hWnd, // The frame window is the parent
NULL, // The menu (none at the moment)
(HANDLE) ghModule, // Instance that owns the window
(LPVOID) &clientcreate // The CLIENTCREATESTRUCT
);
if (!ghWndClient)
return -1;
gActiveObjects++;
}
break;
case WM_SIZE:
{
int nWidth = LOWORD(lParam);
int nHeight = HIWORD(lParam);
SetWindowPos(GetWindow(hWnd,GW_CHILD),NULL,0,0,nWidth,nHeight,SWP_NOZORDER);
}
break;
case WM_COMMAND:
if (HIWORD (wParam)==0 && lParam!=0)
{
}
else
switch (wParam)
{
case (OSMenuIDEnd+1):
SendMessage (GetWindow(hWnd,GW_CHILD),WM_MDIICONARRANGE,0,0);
break;
case (OSMenuIDEnd+2):
SendMessage (GetWindow(hWnd,GW_CHILD),WM_MDITILE,(WPARAM) MDITILE_VERTICAL,0);
break;
case (OSMenuIDEnd+3):
SendMessage (GetWindow(hWnd,GW_CHILD),WM_MDITILE,(WPARAM) MDITILE_HORIZONTAL,0);
break;
case (OSMenuIDEnd+4):
SendMessage (GetWindow(hWnd,GW_CHILD),WM_MDICASCADE,0,0);
break;
}
break;
case WM_DESTROY:
gActiveObjects--;
break;
}
return DefFrameProc (hWnd, GetWindow(hWnd,GW_CHILD), uMsg, wParam, lParam);
};
Index: Button.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Button.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Button.c 23 Jan 2003 20:19:32 -0000 1.2
--- Button.c 10 Feb 2003 22:42:10 -0000 1.3
***************
*** 7,12 ****
HWND hButton;
- initGUI();
-
hButton = CreateWindow(
"BUTTON",
--- 7,10 ----
Index: CheckBox.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/CheckBox.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CheckBox.c 23 Jan 2003 20:19:32 -0000 1.2
--- CheckBox.c 10 Feb 2003 22:42:10 -0000 1.3
***************
*** 6,11 ****
HWND hCheckBox;
- initGUI();
-
hCheckBox = CreateWindow(
"BUTTON",
--- 6,9 ----
Index: EditBox.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/EditBox.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** EditBox.c 27 Jan 2003 22:02:44 -0000 1.3
--- EditBox.c 10 Feb 2003 22:42:10 -0000 1.4
***************
*** 7,12 ****
HWND hEdit;
- initGUI();
-
hEdit = CreateWindowEx(
WS_EX_CLIENTEDGE,
--- 7,10 ----
***************
*** 31,35 ****
int nLen = 1;
char *buffer = "m"; /* pretend a single letter as a minimal size */
!
if (hFont) SelectObject(hDC, hFont);
GetTextExtentPoint32(hDC, buffer, nLen, &sz);
--- 29,33 ----
int nLen = 1;
char *buffer = "m"; /* pretend a single letter as a minimal size */
!
if (hFont) SelectObject(hDC, hFont);
GetTextExtentPoint32(hDC, buffer, nLen, &sz);
Index: Label.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Label.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Label.c 23 Jan 2003 20:19:32 -0000 1.2
--- Label.c 10 Feb 2003 22:42:10 -0000 1.3
***************
*** 7,12 ****
HWND hText;
- initGUI();
-
hText = CreateWindow(
"STATIC",
--- 7,10 ----
Index: ListBox.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/ListBox.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ListBox.c 23 Jan 2003 20:19:32 -0000 1.2
--- ListBox.c 10 Feb 2003 22:42:10 -0000 1.3
***************
*** 7,12 ****
HWND hListBox;
- initGUI();
-
hListBox = CreateWindowEx(
WS_EX_CLIENTEDGE,
--- 7,10 ----
Index: PopUp.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/PopUp.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PopUp.c 23 Jan 2003 20:19:32 -0000 1.2
--- PopUp.c 10 Feb 2003 22:42:10 -0000 1.3
***************
*** 7,12 ****
HWND hPopUp;
- initGUI();
-
hPopUp = CreateWindow(
"COMBOBOX",
--- 7,10 ----
Index: RadioBox.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/RadioBox.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RadioBox.c 23 Jan 2003 20:19:32 -0000 1.2
--- RadioBox.c 10 Feb 2003 22:42:10 -0000 1.3
***************
*** 6,11 ****
HWND hCheckBox;
- initGUI();
-
hCheckBox = CreateWindow(
"BUTTON",
--- 6,9 ----
Index: Timer.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Timer.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Timer.c 21 Jan 2003 22:01:13 -0000 1.1
--- Timer.c 10 Feb 2003 22:42:10 -0000 1.2
***************
*** 1,4 ****
--- 1,5 ----
#include "Timer.h"
#include "Handlers_stub.h"
+ #include "Internals.h"
static VOID CALLBACK osTimerProc(HWND hwnd, UINT msg, UINT_PTR timer, DWORD time)
***************
*** 10,14 ****
{
TimerHandle r = (TimerHandle)SetTimer( NULL, 0, msecs, osTimerProc );
! if (r==NULL) { printf( "Timer: failed to create timer\n" ); }
return r;
}
--- 11,21 ----
{
TimerHandle r = (TimerHandle)SetTimer( NULL, 0, msecs, osTimerProc );
! if (!r)
! {
! printf( "Timer: failed to create timer\n" );
! return NULL;
! }
!
! gActiveObjects++;
return r;
}
***************
*** 17,21 ****
--- 24,31 ----
{
if (timer!=NULL)
+ {
KillTimer(NULL,(UINT_PTR)timer);
+ gActiveObjects--;
+ }
}
Index: Util.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Util.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Util.c 23 Jan 2003 20:19:32 -0000 1.2
--- Util.c 10 Feb 2003 22:42:10 -0000 1.3
***************
*** 8,12 ****
HMODULE ghModule = NULL;
HFONT ghControlFont = NULL;
! static BOOL bIsRunning = FALSE;
void *rmalloc (DWORD bytes)
--- 8,16 ----
HMODULE ghModule = NULL;
HFONT ghControlFont = NULL;
! int gDocumentInterface;
! HWND ghWndFrame;
! HWND ghWndClient;
! DWORD gActiveObjects;
! LPCSTR gAppName;
void *rmalloc (DWORD bytes)
***************
*** 30,33 ****
--- 34,39 ----
extern LRESULT CALLBACK HWindowFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern LRESULT CALLBACK HDialogFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ extern LRESULT CALLBACK HMDIFrameFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ extern LRESULT CALLBACK HMDIWindowFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static ATOM classDialog = 0;
***************
*** 45,49 ****
*/
! void initGUI()
{
if (!ghModule)
--- 51,55 ----
*/
! void osInit(char *AppName, int DocumentInterface)
{
if (!ghModule)
***************
*** 65,69 ****
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
! wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);;
wc.lpszMenuName = NULL;
wc.lpszClassName = "HWINDOW";
--- 71,75 ----
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
! wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
wc.lpszMenuName = NULL;
wc.lpszClassName = "HWINDOW";
***************
*** 77,86 ****
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
! wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);;
wc.lpszMenuName = NULL;
wc.lpszClassName = "HDIALOG";
classDialog = RegisterClass(&wc);
// Globally, we create a logical font that is used in all controls.
--- 83,116 ----
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
! wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
wc.lpszMenuName = NULL;
wc.lpszClassName = "HDIALOG";
classDialog = RegisterClass(&wc);
+ // Window class for MDIFrame
+ wc.style = CS_DBLCLKS;
+ wc.lpfnWndProc = HMDIFrameFunction;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = ghModule;
+ wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
+ wc.hCursor = LoadCursor (NULL, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE+1); // For best results (Petzold)
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = "HFRAME";
+ RegisterClass(&wc);
+ // Window class for MDIWindow
+ wc.style = CS_DBLCLKS;
+ wc.lpfnWndProc = HMDIWindowFunction;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = ghModule;
+ wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
+ wc.hCursor = LoadCursor (NULL, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE+1); // For best results (Petzold)
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = "HMDIWINDOW";
+ RegisterClass(&wc);
// Globally, we create a logical font that is used in all controls.
***************
*** 104,107 ****
--- 134,158 ----
icc.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&icc);
+
+ gActiveObjects = 0;
+ gAppName = strdup(AppName);
+ gDocumentInterface = DocumentInterface;
+
+ if (gDocumentInterface == 2)
+ {
+ ghWndClient = NULL;
+ ghWndFrame = CreateWindow ( "HFRAME",
+ AppName,
+ WS_OVERLAPPEDWINDOW,
+ CW_USEDEFAULT,CW_USEDEFAULT,
+ CW_USEDEFAULT,CW_USEDEFAULT,
+ NULL,
+ NULL,
+ (HANDLE) ghModule,
+ NULL
+ );
+ ShowWindow(ghWndFrame,SW_MAXIMIZE);
+ UpdateWindow(ghWndFrame);
+ }
}
};
***************
*** 123,128 ****
MSG msg;
! bIsRunning = TRUE;
! while (bIsRunning)
{
handleMenusUpdate();
--- 174,178 ----
MSG msg;
! while (gActiveObjects > 0)
{
handleMenusUpdate();
***************
*** 133,141 ****
DispatchMessage(&msg);
! if (!bIsRunning)
return;
};
! if (!bIsRunning)
return;
--- 183,191 ----
DispatchMessage(&msg);
! if (gActiveObjects <= 0)
return;
};
! if (gActiveObjects <= 0)
return;
***************
*** 146,162 ****
}
}
- };
-
- static BOOL CALLBACK fn(HWND hWnd,LPARAM lParam)
- {
- char buffer[20];
-
- GetClassName(hWnd,buffer,sizeof(buffer));
- if ((_stricmp(buffer, "HDIALOG") == 0) || (_stricmp(buffer, "HWINDOW") == 0))
- {
- DestroyWindow(hWnd);
- }
! return TRUE;
};
--- 196,201 ----
}
}
! handleDestroyProcess();
};
***************
*** 165,170 ****
void osQuit()
{
! EnumThreadWindows(GetCurrentThreadId(),fn,0);
doneGdiPlus();
! bIsRunning = FALSE;
}
--- 204,219 ----
void osQuit()
{
! if (gDocumentInterface == 2)
! {
! DestroyWindow(ghWndFrame);
! }
!
! if (gActiveObjects > 0)
! {
! printf("WARNING: There are still have active objects\n");
! }
!
doneGdiPlus();
!
! free(gAppName);
}
Index: Window.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Window.c 31 Jan 2003 22:50:04 -0000 1.5
--- Window.c 10 Feb 2003 22:42:10 -0000 1.6
***************
*** 139,143 ****
}
! LRESULT CALLBACK HWindowSharedFunction( BOOL isDialog, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
WindowData *pData = (WindowData *) GetWindowLong(hWnd,GWL_USERDATA);
--- 139,143 ----
}
! LRESULT CALLBACK HWindowSharedFunction(WNDPROC pDefWindowProc, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
WindowData *pData = (WindowData *) GetWindowLong(hWnd,GWL_USERDATA);
***************
*** 167,174 ****
pData->nWindowKind = ((int) lpcs->lpCreateParams);
SetWindowLong(hWnd,GWL_USERDATA,(LONG) pData);
}
break;
case WM_CLOSE:
! handleWindowClose(hWnd);
return 0;
case WM_DESTROY:
--- 167,176 ----
pData->nWindowKind = ((int) lpcs->lpCreateParams);
SetWindowLong(hWnd,GWL_USERDATA,(LONG) pData);
+
+ gActiveObjects++;
}
break;
case WM_CLOSE:
! handleWindowDismiss(hWnd);
return 0;
case WM_DESTROY:
***************
*** 180,183 ****
--- 182,186 ----
handleWindowDestroy(hWnd);
+ gActiveObjects--;
break;
case WM_COMMAND:
***************
*** 498,502 ****
if (!pData->bInMouseMoveMode) SetCapture(hWnd);
handleWindowMouse(hWnd,evMouseLeftDown,pos.x,pos.y,GetModifiers());
- SetActiveWindow(hWnd);
}
}
--- 501,504 ----
***************
*** 688,695 ****
}
! /* DAAN: Call the appropiate default window handler based on the window class.
! this enables proper handling of system keys for menu bars for example. */
! if (isDialog) return DefDlgProc(hWnd, uMsg, wParam, lParam);
! else return DefWindowProc(hWnd, uMsg, wParam, lParam);
};
--- 690,694 ----
}
! return pDefWindowProc(hWnd, uMsg, wParam, lParam);
};
***************
*** 697,708 ****
LRESULT CALLBACK HWindowFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
! return HWindowSharedFunction( FALSE, hWnd, uMsg, wParam, lParam );
}
LRESULT CALLBACK HDialogFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
! return HWindowSharedFunction( TRUE, hWnd, uMsg, wParam, lParam );
}
void osInvalidateWindow(WindowHandle window)
--- 696,768 ----
LRESULT CALLBACK HWindowFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
! switch (uMsg)
! {
! case WM_LBUTTONDOWN:
! SetActiveWindow(hWnd);
! break;
! }
!
! return HWindowSharedFunction(DefWindowProc, hWnd, uMsg, wParam, lParam );
}
LRESULT CALLBACK HDialogFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
! switch (uMsg)
! {
! case WM_LBUTTONDOWN:
! SetActiveWindow(hWnd);
! break;
! }
!
! return HWindowSharedFunction(DefDlgProc, hWnd, uMsg, wParam, lParam );
}
+ LRESULT CALLBACK HMDIWindowFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+ {
+ switch (uMsg)
+ {
+ case WM_SETTEXT:
+ {
+ char *title, *s;
+ int nTextLen;
+
+ s = (char *) lParam;
+ nTextLen = strlen(s);
+ title = rmalloc(strlen(gAppName)+nTextLen+6);
+
+ strcpy(title, gAppName);
+ strcat(title, " - [");
+ strcat(title, s);
+ strcat(title, "]");
+ SetWindowText(ghWndFrame, title);
+ }
+ break;
+ case WM_MDIACTIVATE:
+ {
+ char *title;
+ int nTextLen;
+
+ nTextLen = GetWindowTextLength(hWnd);
+ title = rmalloc(strlen(gAppName)+nTextLen+6);
+
+ strcpy(title, gAppName);
+ strcat(title, " - [");
+ GetWindowText(hWnd, title+strlen(title), nTextLen+1);
+ strcat(title, "]");
+ SetWindowText(ghWndFrame, title);
+ }
+ break;
+ case WM_DESTROY:
+ SetWindowText(ghWndFrame, gAppName);
+ SendMessage(ghWndClient, WM_MDIREFRESHMENU, 0, 0);
+ DrawMenuBar(ghWndFrame);
+ break;
+ case WM_LBUTTONDOWN:
+ SendMessage(ghWndClient,WM_MDIACTIVATE,(WPARAM) hWnd,0);
+ break;
+ };
+
+ return HWindowSharedFunction(DefMDIChildProc, hWnd, uMsg, wParam, lParam );
+ }
void osInvalidateWindow(WindowHandle window)
***************
*** 725,740 ****
HWND hWnd;
! initGUI();
! hWnd = CreateWindow(
! "HWINDOW",
! NULL,
! WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL,
! CW_USEDEFAULT,0,0,0,
! NULL,
! NULL,
! ghModule,
! NULL
! );
return checkWindow(hWnd, "HWINDOW");
--- 785,822 ----
HWND hWnd;
! switch (gDocumentInterface)
! {
! case 1: // SDI
! hWnd = CreateWindow(
! "HWINDOW",
! NULL,
! WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL,
! CW_USEDEFAULT,0,0,0,
! NULL,
! NULL,
! ghModule,
! NULL
! );
! break;
! case 2: // MDI
! {
! MDICREATESTRUCT mdicreate; // The structure sent to the client window
! /* fill the MDICREATESTRUCT record */
! mdicreate.szClass = "HMDIWINDOW";
! mdicreate.szTitle = "";
! mdicreate.hOwner = ghModule;
! mdicreate.x = 0;
! mdicreate.y = 0;
! mdicreate.cx = 0;
! mdicreate.cy = 0;
! mdicreate.style = WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL;
! mdicreate.lParam = 0;
!
! /* create the window */
! hWnd = (HWND) SendMessage (ghWndClient,WM_MDICREATE,0,(LPARAM) &mdicreate);
! }
! break;
! }
return checkWindow(hWnd, "HWINDOW");
***************
*** 749,754 ****
HWND hDlg;
- initGUI();
-
// start to fill in the dlgtemplate information. Addressing by WORDs
lStyle = WS_CAPTION | DS_SETFONT | WS_SYSMENU | WS_OVERLAPPEDWINDOW;
--- 831,834 ----
***************
*** 776,799 ****
};
- WindowHandle osCreateMDIWindow(WindowHandle mdiWindow)
- {
- HWND hWnd;
-
- initGUI();
-
- hWnd = CreateWindow(
- "HWINDOW",
- NULL,
- WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL,
- CW_USEDEFAULT,0,0,0,
- mdiWindow,
- NULL,
- ghModule,
- NULL
- );
-
- return checkWindow(hWnd, "HWINDOW");
- };
-
void osSetWindowColor(WindowHandle window, int foreColor, int backColor, int hatchStyle, BitmapHandle patBmp)
{
--- 856,859 ----
***************
*** 841,846 ****
RECT crect, wrect;
- initGUI();
-
GetClientRect(window,&crect);
GetWindowRect(window,&wrect);
--- 901,904 ----
***************
*** 950,956 ****
}
! void osCloseWindow(WindowHandle window)
{
! DestroyWindow(window);
}
--- 1008,1020 ----
}
! BOOL osDismissWindow(WindowHandle window)
{
! SendMessage(window, WM_CLOSE, 0, 0);
! return !IsWindow(window);
! }
!
! void osDestroyWindow(WindowHandle window)
! {
! DestroyWindow(window);
}
|