changeset 672:388f2a48aaae

Missed one function to typedef. Fixed errors in the test program and switched to using the new HICN type after making sure the code built on the other platforms unmodified.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 27 Feb 2011 19:25:21 +0000
parents c60a4f6cfae8
children 6d0f0dc7ff7c
files dw.h dwtest.c gtk/dw.c mac/dw.m os2/dw.c win/dw.c
diffstat 6 files changed, 25 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/dw.h	Sun Feb 27 19:01:40 2011 +0000
+++ b/dw.h	Sun Feb 27 19:25:21 2011 +0000
@@ -1126,7 +1126,7 @@
 void API dw_window_set_pos_size(HWND handle, long x, long y, unsigned long width, unsigned long height);
 void API dw_window_get_pos_size(HWND handle, long *x, long *y, unsigned long *width, unsigned long *height);
 void API dw_window_set_style(HWND handle, unsigned long style, unsigned long mask);
-void API dw_window_set_icon(HWND handle, unsigned long id);
+void API dw_window_set_icon(HWND handle, HICN icon);
 void API dw_window_set_bitmap(HWND handle, unsigned long id, char *filename);
 void API dw_window_set_bitmap_from_data(HWND handle, unsigned long id, char *data, int len);
 char * API dw_window_get_text(HWND handle);
--- a/dwtest.c	Sun Feb 27 19:01:40 2011 +0000
+++ b/dwtest.c	Sun Feb 27 19:25:21 2011 +0000
@@ -32,26 +32,6 @@
 int iteration = 0;
    void create_button( int);
 
-#ifdef __MAC__
-int main(int argc, char *argv[])
-{
-   DWEnv env;
-   HWND window;
-
-   dw_init(TRUE, argc, argv);
-
-   window = dw_window_new(HWND_DESKTOP, "Test Window", flStyle);
-   dw_window_set_pos_size(window, 100, 100, 300, 200);
-   dw_window_show(window);
-
-   dw_environment_query(&env);
-   dw_messagebox("Title", DW_MB_OK | DW_MB_INFORMATION, "Operating System: %s %d.%d\nBuild: %d.%d\n",
-               env.osName, env.MajorVersion, env.MinorVersion, env.MajorBuild, env.MinorBuild);
-
-   return 0;
-}
-#else
-
 HWND mainwindow,
    entryfield,
    checkable_menuitem,
@@ -107,7 +87,8 @@
 int menu_enabled = 1;
 
 HPIXMAP text1pm,text2pm;
-unsigned long fileicon,foldericon,mle_point=-1;
+HICN fileicon,foldericon;
+int mle_point=-1;
 
 int font_width = 8;
 int font_height=12;
@@ -212,7 +193,7 @@
 
 char *resolve_keymodifiers( int mask )
 {
-   if ( (mask & KC_CTRL) && (mask & KC_SHIFT) && (mask && KC_ALT) )
+   if ( (mask & KC_CTRL) && (mask & KC_SHIFT) && (mask & KC_ALT) )
       return "KC_CTRL KC_SHIFT KC_ALT";
    else if ( (mask & KC_CTRL) && (mask & KC_SHIFT) )
       return "KC_CTRL KC_SHIFT";
@@ -233,7 +214,7 @@
 int DWSIGNAL text_expose(HWND hwnd, DWExpose *exp, void *data)
 {
    HPIXMAP hpm;
-   int width,height;
+   unsigned long width,height;
 
    if ( hwnd == textbox1 )
       hpm = text1pm;
@@ -245,7 +226,7 @@
    width = DW_PIXMAP_WIDTH(hpm);
    height = DW_PIXMAP_HEIGHT(hpm);
 
-   dw_pixmap_bitblt(hwnd, NULL, 0, 0, width, height, 0, hpm, 0, 0 );
+   dw_pixmap_bitblt(hwnd, NULL, 0, 0, (int)width, (int)height, 0, hpm, 0, 0 );
    dw_flush();
    return TRUE;
 }
@@ -285,8 +266,8 @@
    if ( current_file )
    {
       dw_color_foreground_set(DW_CLR_WHITE);
-      dw_draw_rect(0, text1pm, TRUE, 0, 0, DW_PIXMAP_WIDTH(text1pm), DW_PIXMAP_HEIGHT(text1pm));
-      dw_draw_rect(0, text2pm, TRUE, 0, 0, DW_PIXMAP_WIDTH(text2pm), DW_PIXMAP_HEIGHT(text2pm));
+      dw_draw_rect(0, text1pm, TRUE, 0, 0, (int)DW_PIXMAP_WIDTH(text1pm), (int)DW_PIXMAP_HEIGHT(text1pm));
+      dw_draw_rect(0, text2pm, TRUE, 0, 0, (int)DW_PIXMAP_WIDTH(text2pm), (int)DW_PIXMAP_HEIGHT(text2pm));
 
       for ( i = 0;(i < rows) && (i+row < num_lines); i++)
       {
@@ -510,14 +491,14 @@
 int DWSIGNAL configure_event(HWND hwnd, int width, int height, void *data)
 {
    HPIXMAP old1 = text1pm, old2 = text2pm;
-   int depth = dw_color_depth_get();
+   unsigned long depth = dw_color_depth_get();
 
    rows = height / font_height;
    cols = width / font_width;
 
    /* Create new pixmaps with the current sizes */
-   text1pm = dw_pixmap_new(textbox1, (font_width*(width1)), height, depth);
-   text2pm = dw_pixmap_new(textbox2, width, height, depth);
+   text1pm = dw_pixmap_new(textbox1, (unsigned long)(font_width*(width1)), (unsigned long)height, (int)depth);
+   text2pm = dw_pixmap_new(textbox2, (unsigned long)width, (unsigned long)height, (int)depth);
 
    /* Destroy the old pixmaps */
    dw_pixmap_destroy(old1);
@@ -709,7 +690,7 @@
 
 void text_add(void)
 {
-   int depth = dw_color_depth_get();
+   unsigned long depth = dw_color_depth_get();
    HWND vscrollbox;
 
    /* create a box to pack into the notebook page */
@@ -815,7 +796,8 @@
    int z;
    CTIME time;
    CDATE date;
-   unsigned long size, thisicon;
+   unsigned long size;
+   HICN thisicon;
 
    /* create a box to pack into the notebook page */
    containerbox = dw_box_new(BOXHORZ, 2);
@@ -887,9 +869,8 @@
 
 void buttons_add(void)
 {
-   HWND abutton1,abutton2,calbox,bw;
+   HWND abutton1,abutton2,calbox;
    int i;
-   char buf[20];
    char **text;
 
    /* create a box to pack into the notebook page */
@@ -1165,4 +1146,3 @@
 
    return 0;
 }
-#endif
--- a/gtk/dw.c	Sun Feb 27 19:01:40 2011 +0000
+++ b/gtk/dw.c	Sun Feb 27 19:25:21 2011 +0000
@@ -4326,14 +4326,14 @@
  *       handle: Handle to the window.
  *       id: An ID to be used to specify the icon.
  */
-void dw_window_set_icon(HWND handle, unsigned long id)
+void dw_window_set_icon(HWND handle, HICN icon)
 {
    GdkBitmap *bitmap = NULL;
    GdkPixmap *icon_pixmap;
    int _locked_by_me = FALSE;
 
    DW_MUTEX_LOCK;
-   icon_pixmap = _find_pixmap(&bitmap, id, handle, NULL, NULL);
+   icon_pixmap = _find_pixmap(&bitmap, icon, handle, NULL, NULL);
 
    if(handle->window && icon_pixmap)
       gdk_window_set_icon(handle->window, NULL, icon_pixmap, bitmap);
--- a/mac/dw.m	Sun Feb 27 19:01:40 2011 +0000
+++ b/mac/dw.m	Sun Feb 27 19:25:21 2011 +0000
@@ -4811,7 +4811,7 @@
  *       handle: Handle to the window.
  *       id: An ID to be used to specify the icon.
  */
-void API dw_window_set_icon(HWND handle, ULONG id)
+void API dw_window_set_icon(HWND handle, HICN icon)
 {
 	/* This isn't needed, it is loaded from the bundle */
 }
--- a/os2/dw.c	Sun Feb 27 19:01:40 2011 +0000
+++ b/os2/dw.c	Sun Feb 27 19:25:21 2011 +0000
@@ -5245,10 +5245,10 @@
  *       handle: Handle to the window.
  *       id: An ID to be used to specify the icon.
  */
-void API dw_window_set_icon(HWND handle, ULONG id)
-{
-   HPOINTER icon = id < 65536 ? WinLoadPointer(HWND_DESKTOP,NULLHANDLE,id) : (HPOINTER)id;
-   WinSendMsg(handle, WM_SETICON, (MPARAM)icon, 0);
+void API dw_window_set_icon(HWND handle, HICN icon)
+{
+   HPOINTER hptr = icon < 65536 ? WinLoadPointer(HWND_DESKTOP,NULLHANDLE,icon) : (HPOINTER)icon;
+   WinSendMsg(handle, WM_SETICON, (MPARAM)hptr, 0);
 }
 
 /* Internal function to load a bitmap from a file and return handles
--- a/win/dw.c	Sun Feb 27 19:01:40 2011 +0000
+++ b/win/dw.c	Sun Feb 27 19:25:21 2011 +0000
@@ -5561,9 +5561,9 @@
  *       handle: Handle to the window.
  *       id: An ID to be used to specify the icon.
  */
-void API dw_window_set_icon(HWND handle, ULONG id)
-{
-   HICON hicon = id < 65536 ? LoadIcon(DWInstance, MAKEINTRESOURCE(id)) : (HICON)id;
+void API dw_window_set_icon(HWND handle, HICN icon)
+{
+   HICON hicon = icon < 65536 ? LoadIcon(DWInstance, MAKEINTRESOURCE(icon)) : (HICON)icon;
 
    SendMessage(handle, WM_SETICON,
             (WPARAM) IMAGE_ICON,