changeset 2226:2de088fb5dd4

Added some missing APIs from the template, and changes so it builds dwtest. Needed to make the key codes unique values so it would compile.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 26 Dec 2020 05:24:00 +0000
parents 1ec6300a627b
children d9e1865fcba9
files dw.h dwcompat.h template/dw.c
diffstat 3 files changed, 169 insertions(+), 117 deletions(-) [+]
line wrap: on
line diff
--- a/dw.h	Sat Dec 26 03:42:38 2020 +0000
+++ b/dw.h	Sat Dec 26 05:24:00 2020 +0000
@@ -849,83 +849,83 @@
 
 /* Virtual Key Codes */
 #define VK_LBUTTON               0
-#define VK_RBUTTON               0
-#define VK_CANCEL                0
-#define VK_MBUTTON               0
-#define VK_BACK                  0
-#define VK_TAB                   0
-#define VK_CLEAR                 0
-#define VK_RETURN                0
-#define VK_MENU                  0
-#define VK_PAUSE                 0
-#define VK_CAPITAL               0
-#define VK_ESCAPE                0
-#define VK_SPACE                 0
-#define VK_PRIOR                 0
-#define VK_NEXT                  0
-#define VK_END                   0
-#define VK_HOME                  0
-#define VK_LEFT                  0
-#define VK_UP                    0
-#define VK_RIGHT                 0
-#define VK_DOWN                  0
-#define VK_SELECT                0
-#define VK_PRINT                 0
-#define VK_EXECUTE               0
-#define VK_SNAPSHOT              0
-#define VK_INSERT                0
-#define VK_DELETE                0
-#define VK_HELP                  0
-#define VK_LWIN                  0
-#define VK_RWIN                  0
-#define VK_NUMPAD0               0
-#define VK_NUMPAD1               0
-#define VK_NUMPAD2               0
-#define VK_NUMPAD3               0
-#define VK_NUMPAD4               0
-#define VK_NUMPAD5               0
-#define VK_NUMPAD6               0
-#define VK_NUMPAD7               0
-#define VK_NUMPAD8               0
-#define VK_NUMPAD9               0
-#define VK_MULTIPLY              0
-#define VK_ADD                   0
-#define VK_SEPARATOR             0
-#define VK_SUBTRACT              0
-#define VK_DECIMAL               0
-#define VK_DIVIDE                0
-#define VK_F1                    0
-#define VK_F2                    0
-#define VK_F3                    0
-#define VK_F4                    0
-#define VK_F5                    0
-#define VK_F6                    0
-#define VK_F7                    0
-#define VK_F8                    0
-#define VK_F9                    0
-#define VK_F10                   0
-#define VK_F11                   0
-#define VK_F12                   0
-#define VK_F13                   0
-#define VK_F14                   0
-#define VK_F15                   0
-#define VK_F16                   0
-#define VK_F17                   0
-#define VK_F18                   0
-#define VK_F19                   0
-#define VK_F20                   0
-#define VK_F21                   0
-#define VK_F22                   0
-#define VK_F23                   0
-#define VK_F24                   0
-#define VK_NUMLOCK               0
-#define VK_SCROLL                0
-#define VK_LSHIFT                0
-#define VK_RSHIFT                0
-#define VK_LCONTROL              0
-#define VK_RCONTROL              0
-#define VK_LMENU                 0
-#define VK_RMENU                 0
+#define VK_RBUTTON               1
+#define VK_CANCEL                2
+#define VK_MBUTTON               3
+#define VK_BACK                  4
+#define VK_TAB                   5
+#define VK_CLEAR                 6
+#define VK_RETURN                7
+#define VK_MENU                  8
+#define VK_PAUSE                 9
+#define VK_CAPITAL               10
+#define VK_ESCAPE                11
+#define VK_SPACE                 12
+#define VK_PRIOR                 13
+#define VK_NEXT                  14
+#define VK_END                   15
+#define VK_HOME                  16
+#define VK_LEFT                  17
+#define VK_UP                    18
+#define VK_RIGHT                 19
+#define VK_DOWN                  20
+#define VK_SELECT                21
+#define VK_PRINT                 22
+#define VK_EXECUTE               23
+#define VK_SNAPSHOT              24
+#define VK_INSERT                25
+#define VK_DELETE                26
+#define VK_HELP                  27
+#define VK_LWIN                  28
+#define VK_RWIN                  29
+#define VK_NUMPAD0               30
+#define VK_NUMPAD1               31
+#define VK_NUMPAD2               32
+#define VK_NUMPAD3               33
+#define VK_NUMPAD4               34
+#define VK_NUMPAD5               35
+#define VK_NUMPAD6               36
+#define VK_NUMPAD7               37
+#define VK_NUMPAD8               38
+#define VK_NUMPAD9               39
+#define VK_MULTIPLY              40
+#define VK_ADD                   41
+#define VK_SEPARATOR             42
+#define VK_SUBTRACT              43
+#define VK_DECIMAL               44
+#define VK_DIVIDE                45
+#define VK_F1                    46
+#define VK_F2                    47
+#define VK_F3                    48
+#define VK_F4                    49
+#define VK_F5                    50
+#define VK_F6                    51
+#define VK_F7                    52
+#define VK_F8                    53
+#define VK_F9                    54
+#define VK_F10                   55
+#define VK_F11                   56
+#define VK_F12                   57
+#define VK_F13                   58
+#define VK_F14                   59
+#define VK_F15                   60
+#define VK_F16                   61
+#define VK_F17                   62
+#define VK_F18                   63
+#define VK_F19                   64
+#define VK_F20                   65
+#define VK_F21                   66
+#define VK_F22                   67
+#define VK_F23                   68
+#define VK_F24                   69
+#define VK_NUMLOCK               70
+#define VK_SCROLL                71
+#define VK_LSHIFT                72
+#define VK_RSHIFT                73
+#define VK_LCONTROL              74
+#define VK_RCONTROL              75
+#define VK_LMENU                 76
+#define VK_RMENU                 77
 
 /* Key Modifiers */
 #define KC_CTRL                  (1)
--- a/dwcompat.h	Sat Dec 26 03:42:38 2020 +0000
+++ b/dwcompat.h	Sat Dec 26 05:24:00 2020 +0000
@@ -265,7 +265,7 @@
 #include <signal.h>
 #include <fcntl.h>
 
-#if !defined(__WIN32__) && !defined(WINNT)
+#if !defined(_MSC_VER)
 #ifndef __WATCOMC__
 #include <sys/time.h>
 #endif
@@ -281,7 +281,7 @@
 #endif
 #include <stdarg.h>
 #include <string.h>
-#endif /* !WIN32 */
+#endif /* !_MSC_VER */
 #include <ctype.h>
 
 #ifndef _MAX_PATH
--- a/template/dw.c	Sat Dec 26 03:42:38 2020 +0000
+++ b/template/dw.c	Sat Dec 26 05:24:00 2020 +0000
@@ -14,12 +14,12 @@
 #include <string.h>
 
 /* Implement these to get and set the Box* pointer on the widget handle */
-void *_dw_get_window_pointer(HWND handle)
+void *_dw_window_pointer_get(HWND handle)
 {
     return NULL;
 }
 
-void _dw_set_window_pointer(HWND handle, Box *box)
+void _dw_window_pointer_set(HWND handle, Box *box)
 {
 }
 
@@ -77,7 +77,7 @@
         
       if(thisbox->items[z].type == TYPEBOX)
       {
-         Box *tmp = (Box *)_dw_get_window_pointer(thisbox->items[z].hwnd);
+         Box *tmp = (Box *)_dw_window_pointer_get(thisbox->items[z].hwnd);
 
          if(tmp)
          {
@@ -252,6 +252,13 @@
 }
 
 /*
+ * Causes running dw_main() to return.
+ */
+void API dw_main_quit(void)
+{
+}
+
+/*
  * Runs a message loop for Dynamic Windows, for a period of milliseconds.
  * Parameters:
  *           milliseconds: Number of milliseconds to run the loop for.
@@ -406,7 +413,7 @@
  *       Pointer to an allocated string of text or NULL if clipboard empty or contents could not
  *       be converted to text.
  */
-char *dw_clipboard_get_text()
+char * API dw_clipboard_get_text()
 {
     return NULL;
 }
@@ -417,7 +424,7 @@
  *       str: Text to put on the clipboard.
  *       len: Length of the text.
  */
-void dw_clipboard_set_text(const char *str, int len)
+void API dw_clipboard_set_text(const char *str, int len)
 {
 }
 
@@ -563,7 +570,7 @@
     int z, x = 0;
     Item *tmpitem, *thisitem;
 
-    thisbox = _dw_get_window_pointer(box);
+    thisbox = _dw_window_pointer_get(box);
     thisitem = thisbox->items;
 
     /* Do some sanity bounds checking */
@@ -1769,6 +1776,28 @@
 }
 
 /*
+ * Sets the data of a row in the container.
+ * Parameters:
+ *          pointer: Pointer to the allocated memory in dw_container_alloc().
+ *          row: Zero based row of data being set.
+ *          data: Data pointer.
+ */
+void API dw_container_set_row_data(void *pointer, int row, void *data)
+{
+}
+
+/*
+ * Changes the data of a row already inserted in the container.
+ * Parameters:
+ *          handle: Handle to the container window (widget).
+ *          row: Zero based row of data being set.
+ *          data: Data pointer.
+ */
+void API dw_container_change_row_data(HWND handle, int row, void *data)
+{
+}
+
+/*
  * Gets column type for a container column.
  * Parameters:
  *          handle: Handle to the container window (widget).
@@ -2191,6 +2220,29 @@
 }
 
 /*
+ * Copies from one surface to another allowing for stretching.
+ * Parameters:
+ *       dest: Destination window handle.
+ *       destp: Destination pixmap. (choose only one).
+ *       xdest: X coordinate of destination.
+ *       ydest: Y coordinate of destination.
+ *       width: Width of the target area.
+ *       height: Height of the target area.
+ *       src: Source window handle.
+ *       srcp: Source pixmap. (choose only one).
+ *       xsrc: X coordinate of source.
+ *       ysrc: Y coordinate of source.
+ *       srcwidth: Width of area to copy.
+ *       srcheight: Height of area to copy.
+ * Returns:
+ *       DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure.
+ */
+int API dw_pixmap_stretch_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc, int srcwidth, int srcheight)
+{
+    return DW_ERROR_GENERAL;
+}
+
+/*
  * Create a new calendar window (widget) to be packed.
  * Parameters:
  *       id: An ID to be used with dw_window_from_id() or 0L.
@@ -2208,7 +2260,7 @@
  *       handle: The handle to the calendar returned by dw_calendar_new().
  *       year, month, day: To set the calendar to display.
  */
-void dw_calendar_set_date(HWND handle, unsigned int year, unsigned int month, unsigned int day)
+void API dw_calendar_set_date(HWND handle, unsigned int year, unsigned int month, unsigned int day)
 {
 }
 
@@ -2220,7 +2272,7 @@
  *       month: Variable to store the month or NULL.
  *       day: Variable to store the day or NULL.
  */
-void dw_calendar_get_date(HWND handle, unsigned int *year, unsigned int *month, unsigned int *day)
+void API dw_calendar_get_date(HWND handle, unsigned int *year, unsigned int *month, unsigned int *day)
 {
 }
 
@@ -2272,7 +2324,7 @@
  * Returns:
  *       DW_ERROR_NONE (0) on success.
  */
-int dw_html_javascript_run(HWND handle, const char *script, void *scriptdata)
+int API dw_html_javascript_run(HWND handle, const char *script, void *scriptdata)
 {
    return DW_ERROR_UNKNOWN;
 }
@@ -2959,7 +3011,7 @@
  * Parameters:
  *       env: Pointer to a DWEnv struct.
  */
-void dw_environment_query(DWEnv *env)
+void API dw_environment_query(DWEnv *env)
 {
     strcpy(env->osName, "Unknown");
 
@@ -2999,7 +3051,7 @@
  *       dataname: A string pointer identifying which data to be saved.
  *       data: User data to be saved to the window handle.
  */
-void dw_window_set_data(HWND window, const char *dataname, void *data)
+void API dw_window_set_data(HWND window, const char *dataname, void *data)
 {
 }
 
@@ -3011,7 +3063,7 @@
  * Returns:
  *       Pointer to data or NULL if no data is available.
  */
-void *dw_window_get_data(HWND window, const char *dataname)
+void * API dw_window_get_data(HWND window, const char *dataname)
 {
     return NULL;
 }
@@ -3088,7 +3140,7 @@
  * Returns:
  *       DW_ERROR_NONE (0) on success.
 */
-int dw_module_load(const char *name, HMOD *handle)
+int API dw_module_load(const char *name, HMOD *handle)
 {
    return DW_ERROR_UNKNOWN;
 }
@@ -3102,7 +3154,7 @@
  * Returns:
  *       DW_ERROR_NONE (0) on success.
  */
-int dw_module_symbol(HMOD handle, const char *name, void**func)
+int API dw_module_symbol(HMOD handle, const char *name, void**func)
 {
    return DW_ERROR_UNKNOWN;
 }
@@ -3113,7 +3165,7 @@
  * Returns:
  *       DW_ERROR_NONE (0) on success.
  */
-int dw_module_close(HMOD handle)
+int API dw_module_close(HMOD handle)
 {
    return DW_ERROR_GENERAL;
 }
@@ -3121,7 +3173,7 @@
 /*
  * Returns the handle to an unnamed mutex semaphore or NULL on error.
  */
-HMTX dw_mutex_new(void)
+HMTX API dw_mutex_new(void)
 {
     return NULL;
 }
@@ -3131,7 +3183,7 @@
  * Parameters:
  *       mutex: The handle to the mutex returned by dw_mutex_new().
  */
-void dw_mutex_close(HMTX mutex)
+void API dw_mutex_close(HMTX mutex)
 {
 }
 
@@ -3140,7 +3192,7 @@
  * Parameters:
  *       mutex: The handle to the mutex returned by dw_mutex_new().
  */
-void dw_mutex_lock(HMTX mutex)
+void API dw_mutex_lock(HMTX mutex)
 {
 #if 0
     /* We need to handle locks from the main thread differently...
@@ -3183,14 +3235,14 @@
  * Parameters:
  *       mutex: The handle to the mutex returned by dw_mutex_new().
  */
-void dw_mutex_unlock(HMTX mutex)
+void API dw_mutex_unlock(HMTX mutex)
 {
 }
 
 /*
  * Returns the handle to an unnamed event semaphore or NULL on error.
  */
-HEV dw_event_new(void)
+HEV API dw_event_new(void)
 {
    return NULL;
 }
@@ -3202,7 +3254,7 @@
  * Returns:
  *       DW_ERROR_NONE (0) on success.
  */
-int dw_event_reset (HEV eve)
+int API dw_event_reset (HEV eve)
 {
    return DW_ERROR_GENERAL;
 }
@@ -3215,7 +3267,7 @@
  * Returns:
  *       DW_ERROR_NONE (0) on success.
  */
-int dw_event_post (HEV eve)
+int API dw_event_post (HEV eve)
 {
    return DW_ERROR_GENERAL;
 }
@@ -3232,7 +3284,7 @@
  *       DW_ERROR_TIMEOUT (2) if the timeout has expired.
  *       Other values on other error.
  */
-int dw_event_wait(HEV eve, unsigned long timeout)
+int API dw_event_wait(HEV eve, unsigned long timeout)
 {
    return DW_ERROR_GENERAL;
 }
@@ -3244,7 +3296,7 @@
  * Returns:
  *       DW_ERROR_NONE (0) on success.
  */
-int dw_event_close(HEV *eve)
+int API dw_event_close(HEV *eve)
 {
    return DW_ERROR_GENERAL;
 }
@@ -3257,7 +3309,7 @@
  * Returns:
  *       Handle to event semaphore or NULL on error.
  */
-HEV dw_named_event_new(const char *name)
+HEV API dw_named_event_new(const char *name)
 {
     return NULL;
 }
@@ -3269,7 +3321,7 @@
  * Returns:
  *       Handle to event semaphore or NULL on error.
  */
-HEV dw_named_event_get(const char *name)
+HEV API dw_named_event_get(const char *name)
 {
     return NULL;
 }
@@ -3282,7 +3334,7 @@
  * Returns:
  *       DW_ERROR_NONE (0) on success.
  */
-int dw_named_event_reset(HEV eve)
+int API dw_named_event_reset(HEV eve)
 {
    return DW_ERROR_GENERAL;
 }
@@ -3295,7 +3347,7 @@
  * Returns:
  *       DW_ERROR_NONE (0) on success.
  */
-int dw_named_event_post(HEV eve)
+int API dw_named_event_post(HEV eve)
 {
    return DW_ERROR_GENERAL;
 }
@@ -3310,7 +3362,7 @@
  * Returns:
  *       DW_ERROR_NONE (0) on success.
  */
-int dw_named_event_wait(HEV eve, unsigned long timeout)
+int API dw_named_event_wait(HEV eve, unsigned long timeout)
 {
    return DW_ERROR_UNKNOWN;
 }
@@ -3323,7 +3375,7 @@
  * Returns:
  *       DW_ERROR_NONE (0) on success.
  */
-int dw_named_event_close(HEV eve)
+int API dw_named_event_close(HEV eve)
 {
     return DW_ERROR_UNKNOWN;
 }
@@ -3352,7 +3404,7 @@
  * Returns:
  *       Handle to shared memory or NULL on error.
  */
-HSHM dw_named_memory_new(void **dest, int size, const char *name)
+HSHM API dw_named_memory_new(void **dest, int size, const char *name)
 {
    return NULL;
 }
@@ -3366,7 +3418,7 @@
  * Returns:
  *       Handle to shared memory or NULL on error.
  */
-HSHM dw_named_memory_get(void **dest, int size, const char *name)
+HSHM API dw_named_memory_get(void **dest, int size, const char *name)
 {
    return NULL;
 }
@@ -3379,7 +3431,7 @@
  * Returns:
  *       DW_ERROR_NONE (0) on success or DW_ERROR_UNKNOWN (-1) on error.
  */
-int dw_named_memory_free(HSHM handle, void *ptr)
+int API dw_named_memory_free(HSHM handle, void *ptr)
 {
    int rc = DW_ERROR_UNKNOWN;
 
@@ -3395,7 +3447,7 @@
  * Returns:
  *       Thread ID on success or DW_ERROR_UNKNOWN (-1) on error.
  */
-DWTID dw_thread_new(void *func, void *data, int stack)
+DWTID API dw_thread_new(void *func, void *data, int stack)
 {
    return (DWTID)DW_ERROR_UNKNOWN;
 }
@@ -3403,14 +3455,14 @@
 /*
  * Ends execution of current thread immediately.
  */
-void dw_thread_end(void)
+void API dw_thread_end(void)
 {
 }
 
 /*
  * Returns the current thread's ID.
  */
-DWTID dw_thread_id(void)
+DWTID API dw_thread_id(void)
 {
    return (DWTID)0;
 }
@@ -3424,7 +3476,7 @@
  * Returns:
  *       Process ID on success or DW_ERROR_UNKNOWN (-1) on error.
  */
-int dw_exec(const char *program, int type, char **params)
+int API dw_exec(const char *program, int type, char **params)
 {
     int ret = DW_ERROR_UNKNOWN;
 
@@ -3438,7 +3490,7 @@
  * Returns:
  *       DW_ERROR_UNKNOWN (-1) on error; DW_ERROR_NONE (0) or a positive Process ID on success.
  */
-int dw_browse(const char *url)
+int API dw_browse(const char *url)
 {
     return DW_ERROR_UNKNOWN;
 }