Mercurial > dwindows
comparison dw.h @ 2225:1ec6300a627b
Updated the platform template for the new 3.1 APIs.
Removed lingering Photon support, replace it with __TEMPLATE__.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 26 Dec 2020 03:42:38 +0000 |
parents | 7677e1083d07 |
children | 2de088fb5dd4 |
comparison
equal
deleted
inserted
replaced
2224:d3974aa8ad64 | 2225:1ec6300a627b |
---|---|
57 #define DW_UNUSED(x) x __attribute__((__unused__)) | 57 #define DW_UNUSED(x) x __attribute__((__unused__)) |
58 #else | 58 #else |
59 #define DW_UNUSED(x) x | 59 #define DW_UNUSED(x) x |
60 #endif | 60 #endif |
61 | 61 |
62 #if !defined(__PHOTON__) | |
63 /* These corespond to the entries in the color | 62 /* These corespond to the entries in the color |
64 * arrays in the Win32 dw.c, they are also the | 63 * arrays in the Win32 dw.c, they are also the |
65 * same as DOS ANSI colors. | 64 * same as DOS ANSI colors. |
66 */ | 65 */ |
67 #define DW_CLR_BLACK 0 | 66 #define DW_CLR_BLACK 0 |
79 #define DW_CLR_BLUE 12 | 78 #define DW_CLR_BLUE 12 |
80 #define DW_CLR_PINK 13 | 79 #define DW_CLR_PINK 13 |
81 #define DW_CLR_CYAN 14 | 80 #define DW_CLR_CYAN 14 |
82 #define DW_CLR_WHITE 15 | 81 #define DW_CLR_WHITE 15 |
83 #define DW_CLR_DEFAULT 16 | 82 #define DW_CLR_DEFAULT 16 |
84 #endif | |
85 | 83 |
86 /* Signal handler defines */ | 84 /* Signal handler defines */ |
87 #define DW_SIGNAL_CONFIGURE "configure_event" | 85 #define DW_SIGNAL_CONFIGURE "configure_event" |
88 #define DW_SIGNAL_KEY_PRESS "key_press_event" | 86 #define DW_SIGNAL_KEY_PRESS "key_press_event" |
89 #define DW_SIGNAL_BUTTON_PRESS "button_press_event" | 87 #define DW_SIGNAL_BUTTON_PRESS "button_press_event" |
123 # ifndef GDK_WINDOWING_WIN32 | 121 # ifndef GDK_WINDOWING_WIN32 |
124 # define GDK_WINDOWING_WIN32 | 122 # define GDK_WINDOWING_WIN32 |
125 # endif | 123 # endif |
126 #endif | 124 #endif |
127 | 125 |
128 #if defined(__OS2__) || (defined(__WIN32__) && !defined(GDK_WINDOWING_WIN32)) || defined(__MAC__) || (defined(WINNT) && !defined(GDK_WINDOWING_WIN32)) || defined(__EMX__) | 126 #if defined(__OS2__) || (defined(__WIN32__) && !defined(GDK_WINDOWING_WIN32)) || defined(__MAC__) || defined(__EMX__) || defined(__TEMPLATE__) |
129 /* OS/2, Windows or MacOS */ | 127 /* OS/2, Windows or MacOS */ |
130 | 128 |
131 #ifdef __OS2__ | 129 #ifdef __OS2__ |
132 # if (defined(__IBMC__) || defined(__WATCOMC__) || defined(_System)) && !defined(API) | 130 # if (defined(__IBMC__) || defined(__WATCOMC__) || defined(_System)) && !defined(API) |
133 # define API _System | 131 # define API _System |
571 #define KC_SHIFT (1 << 17) /* NSShiftKeyMask */ | 569 #define KC_SHIFT (1 << 17) /* NSShiftKeyMask */ |
572 #define KC_ALT (1 << 19) /* NSAlternateKeyMask */ | 570 #define KC_ALT (1 << 19) /* NSAlternateKeyMask */ |
573 #endif | 571 #endif |
574 | 572 |
575 /* Windows specific section */ | 573 /* Windows specific section */ |
576 #if defined(__WIN32__) || defined(WINNT) | 574 #if defined(__WIN32__) |
577 #include <winsock2.h> | 575 #include <winsock2.h> |
578 #include <windows.h> | 576 #include <windows.h> |
579 #include <commctrl.h> | 577 #include <commctrl.h> |
580 | 578 |
581 #if defined(MSVC) && !defined(API) | 579 #if defined(MSVC) && !defined(API) |
718 } *HPIXMAP; | 716 } *HPIXMAP; |
719 | 717 |
720 typedef HWND HMENUI; | 718 typedef HWND HMENUI; |
721 #endif | 719 #endif |
722 | 720 |
723 typedef struct _item { | 721 /* Template section, framework for new platform ports */ |
724 /* Item type - Box or Item */ | 722 #if defined(__TEMPLATE__) |
725 int type; | |
726 /* Handle to Frame or Window */ | |
727 HWND hwnd; | |
728 /* Width and Height of static size */ | |
729 int width, height, origwidth, origheight; | |
730 /* Size Type - Static or Expand */ | |
731 int hsize, vsize; | |
732 /* Padding */ | |
733 int pad; | |
734 } Item; | |
735 | |
736 typedef struct _box { | |
737 #if defined(__WIN32__) || defined(WINNT) | |
738 ColorInfo cinfo; | |
739 int fullscreen; | |
740 #elif defined(__OS2__) || defined(__EMX__) | |
741 PFNWP oldproc; | |
742 UserData *root; | |
743 HWND hwndtitle, hwnd; | |
744 int titlebar; | |
745 #endif | |
746 /* Number of items in the box */ | |
747 int count; | |
748 /* Box type - horizontal or vertical */ | |
749 int type; | |
750 /* Keep track of how box is packed */ | |
751 int hsize, vsize; | |
752 /* Padding */ | |
753 int pad, grouppadx, grouppady; | |
754 /* Groupbox */ | |
755 HWND grouphwnd; | |
756 /* Default item */ | |
757 HWND defaultitem; | |
758 /* Used as temporary storage in the calculation stage */ | |
759 int usedpadx, usedpady, minheight, minwidth; | |
760 /* Used for calculating individual item ratios */ | |
761 int width, height; | |
762 /* Any combinations of flags describing the box */ | |
763 unsigned long flags; | |
764 /* Array of item structures */ | |
765 struct _item *items; | |
766 } Box; | |
767 | |
768 #elif defined(__PHOTON__) | |
769 #include <stdio.h> | 723 #include <stdio.h> |
770 #include <stdlib.h> | 724 #include <stdlib.h> |
771 #include <unistd.h> | 725 #include <stdarg.h> |
772 #include <sys/utsname.h> | 726 #include <limits.h> |
773 /* Photon specific section */ | 727 |
774 #include <Pt.h> | 728 /* Can remove this for your port when you know where MAX_PATH is */ |
775 #include <Ph.h> | 729 #ifndef MAX_PATH |
776 /* which image formats supported */ | 730 #define MAX_PATH 260 |
777 #define PX_IMAGE_MODULES | 731 #endif |
778 #define PX_GIF_SUPPORT | |
779 #define PX_JPG_SUPPORT | |
780 #define PX_BMP_SUPPORT | |
781 #define PX_PND_SUPPORT | |
782 #include <photon/PxImage.h> | |
783 | 732 |
784 #define TRUE 1 | 733 #define TRUE 1 |
785 #define FALSE 0 | 734 #define FALSE 0 |
786 | 735 |
787 typedef PtWidget_t *pPtWidget_t; | 736 typedef void *HWND; |
788 typedef pPtWidget_t HWND; | |
789 | 737 |
790 typedef unsigned long ULONG; | 738 typedef unsigned long ULONG; |
791 typedef long LONG; | 739 typedef long LONG; |
792 typedef unsigned short USHORT; | 740 typedef unsigned short USHORT; |
793 typedef short SHORT; | 741 typedef short SHORT; |
799 typedef int INT; | 747 typedef int INT; |
800 typedef void *HMTX; | 748 typedef void *HMTX; |
801 typedef void *HEV; | 749 typedef void *HEV; |
802 typedef void *HSHM; | 750 typedef void *HSHM; |
803 typedef void *HMOD; | 751 typedef void *HMOD; |
804 typedef PtTreeItem_t *HTREEITEM; | 752 typedef void *HTREEITEM; |
805 typedef HWND HMENUI; | 753 typedef HWND HMENUI; |
806 typedef int DWTID; | 754 typedef int DWTID; |
807 typedef unsigned long HICN; | 755 typedef unsigned long HICN; |
808 | |
809 typedef struct _user_data | |
810 { | |
811 struct _user_data *next; | |
812 void *data; | |
813 char *varname; | |
814 } UserData; | |
815 | 756 |
816 typedef struct _window_data { | 757 typedef struct _window_data { |
817 UserData *root; | 758 UserData *root; |
818 HWND clickdefault; | 759 HWND clickdefault; |
819 ULONG flags; | 760 ULONG flags; |
823 typedef struct _hpixmap { | 764 typedef struct _hpixmap { |
824 unsigned long width, height; | 765 unsigned long width, height; |
825 /* ?? *pixmap; */ | 766 /* ?? *pixmap; */ |
826 HWND handle; | 767 HWND handle; |
827 } *HPIXMAP; | 768 } *HPIXMAP; |
828 | |
829 /* colors matching Photon Graphics colors */ | |
830 #define DW_CLR_BLACK Pg_BLACK | |
831 #define DW_CLR_DARKRED Pg_DRED | |
832 #define DW_CLR_DARKGREEN Pg_DGREEN | |
833 #define DW_CLR_BROWN Pg_BROWN | |
834 #define DW_CLR_DARKBLUE Pg_DBLUE | |
835 #define DW_CLR_DARKPINK Pg_PURPLE | |
836 #define DW_CLR_DARKCYAN Pg_DCYAN | |
837 #define DW_CLR_PALEGRAY Pg_GRAY | |
838 #define DW_CLR_DARKGRAY Pg_MGRAY | |
839 #define DW_CLR_RED Pg_RED | |
840 #define DW_CLR_GREEN Pg_GREEN | |
841 #define DW_CLR_YELLOW Pg_YELLOW | |
842 #define DW_CLR_BLUE Pg_BLUE | |
843 #define DW_CLR_PINK Pg_MAGENTA | |
844 #define DW_CLR_CYAN Pg_CYAN | |
845 #define DW_CLR_WHITE Pg_WHITE | |
846 #define DW_CLR_DEFAULT Pg_GRAY | |
847 /* color manipulation macros */ | |
848 #define DW_RGB_COLOR (0xF0000000) | |
849 #define DW_RGB_TRANSPARENT (0x0F000000) | |
850 #define DW_RGB_MASK (0x00FFFFFF) | |
851 #define DW_RED_MASK (0x00FF0000) | |
852 #define DW_GREEN_MASK (0x0000FF00) | |
853 #define DW_BLUE_MASK (0x000000FF) | |
854 #define DW_RED_VALUE(a) PgRedValue(a) | |
855 #define DW_GREEN_VALUE(a) PgGreenValue(a) | |
856 #define DW_BLUE_VALUE(a) PgBluValue(a) | |
857 #define DW_RGB(a, b, c) PgRGB( a, b, c ) | |
858 | 769 |
859 #define DW_DT_LEFT 0 | 770 #define DW_DT_LEFT 0 |
860 #define DW_DT_QUERYEXTENT 0 | 771 #define DW_DT_QUERYEXTENT 0 |
861 #define DW_DT_UNDERSCORE 0 | 772 #define DW_DT_UNDERSCORE 0 |
862 #define DW_DT_STRIKEOUT 0 | 773 #define DW_DT_STRIKEOUT 0 |
870 #define DW_DT_HALFTONE 0 | 781 #define DW_DT_HALFTONE 0 |
871 #define DW_DT_MNEMONIC 0 | 782 #define DW_DT_MNEMONIC 0 |
872 #define DW_DT_WORDBREAK 0 | 783 #define DW_DT_WORDBREAK 0 |
873 #define DW_DT_ERASERECT 0 | 784 #define DW_DT_ERASERECT 0 |
874 | 785 |
875 #define DW_FCF_CLOSEBUTTON Ph_WM_RENDER_CLOSE | 786 #define DW_FCF_CLOSEBUTTON 0 |
876 #define DW_FCF_TITLEBAR Ph_WM_RENDER_TITLE | 787 #define DW_FCF_TITLEBAR 0 |
877 #define DW_FCF_SYSMENU 0 | 788 #define DW_FCF_SYSMENU 0 |
878 #define DW_FCF_MENU Ph_WM_RENDER_MENU | 789 #define DW_FCF_MENU 0 |
879 #define DW_FCF_SIZEBORDER Ph_WM_RENDER_RESIZE | 790 #define DW_FCF_SIZEBORDER 0 |
880 #define DW_FCF_MINBUTTON Ph_WM_RENDER_MIN | 791 #define DW_FCF_MINBUTTON 0 |
881 #define DW_FCF_MAXBUTTON Ph_WM_RENDER_MAX | 792 #define DW_FCF_MAXBUTTON 0 |
882 #define DW_FCF_MINMAX (Ph_WM_RENDER_MIN|Ph_WM_RENDER_MAX) | 793 #define DW_FCF_MINMAX (DW_FCF_MINBUTTON|DW_FCF_MAXBUTTON) |
883 #define DW_FCF_DLGBORDER 0 | 794 #define DW_FCF_DLGBORDER 0 |
884 #define DW_FCF_BORDER Ph_WM_RENDER_BORDER | 795 #define DW_FCF_BORDER 0 |
885 #define DW_FCF_TASKLIST 0 | 796 #define DW_FCF_TASKLIST 0 |
886 #define DW_FCF_NOMOVEWITHOWNER 0 | 797 #define DW_FCF_NOMOVEWITHOWNER 0 |
887 #define DW_FCF_SYSMODAL 0 | 798 #define DW_FCF_SYSMODAL 0 |
888 #define DW_FCF_HIDEBUTTON 0 | 799 #define DW_FCF_HIDEBUTTON 0 |
889 #define DW_FCF_HIDEMAX 0 | 800 #define DW_FCF_HIDEMAX 0 |
890 #define DW_FCF_AUTOICON (Ph_WM_RENDER_ASICON | ~Ph_WM_RENDER_ASAPP) | 801 #define DW_FCF_AUTOICON 0 |
891 #define DW_FCF_MAXIMIZE 0 | 802 #define DW_FCF_MAXIMIZE 0 |
892 #define DW_FCF_MINIMIZE 0 | 803 #define DW_FCF_MINIMIZE 0 |
893 #define DW_FCF_TEXTURED 0 | 804 #define DW_FCF_TEXTURED 0 |
894 #define DW_FCF_FULLSCREEN 0 | 805 #define DW_FCF_FULLSCREEN 0 |
895 | 806 |
912 | 823 |
913 #define DW_LS_MULTIPLESEL 1 | 824 #define DW_LS_MULTIPLESEL 1 |
914 | 825 |
915 #define DW_LIT_NONE -1 | 826 #define DW_LIT_NONE -1 |
916 | 827 |
917 #ifdef MLFSEARCH_CASESENSITIVE | 828 #define DW_MLE_CASESENSITIVE 0 |
918 # define DW_MLE_CASESENSITIVE MLFSEARCH_CASESENSITIVE | 829 |
919 #else | 830 #define DW_BS_NOBORDER 0 |
920 # define DW_MLE_CASESENSITIVE 0 | |
921 #endif | |
922 | |
923 #define DW_BS_NOBORDER 1 | |
924 | 831 |
925 #define DW_POINTER_DEFAULT 0 | 832 #define DW_POINTER_DEFAULT 0 |
926 #define DW_POINTER_ARROW 0 | 833 #define DW_POINTER_ARROW 0 |
927 #define DW_POINTER_CLOCK 0 | 834 #define DW_POINTER_CLOCK 0 |
928 #define DW_POINTER_QUESTION 0 | 835 #define DW_POINTER_QUESTION 0 |
1022 | 929 |
1023 /* Key Modifiers */ | 930 /* Key Modifiers */ |
1024 #define KC_CTRL (1) | 931 #define KC_CTRL (1) |
1025 #define KC_SHIFT (1 << 1) | 932 #define KC_SHIFT (1 << 1) |
1026 #define KC_ALT (1 << 2) | 933 #define KC_ALT (1 << 2) |
934 #endif | |
935 | |
936 typedef struct _item { | |
937 /* Item type - Box or Item */ | |
938 int type; | |
939 /* Handle to Frame or Window */ | |
940 HWND hwnd; | |
941 /* Width and Height of static size */ | |
942 int width, height, origwidth, origheight; | |
943 /* Size Type - Static or Expand */ | |
944 int hsize, vsize; | |
945 /* Padding */ | |
946 int pad; | |
947 } Item; | |
948 | |
949 typedef struct _box { | |
950 #if defined(__WIN32__) | |
951 ColorInfo cinfo; | |
952 int fullscreen; | |
953 #elif defined(__OS2__) || defined(__EMX__) | |
954 PFNWP oldproc; | |
955 UserData *root; | |
956 HWND hwndtitle, hwnd; | |
957 int titlebar; | |
958 #endif | |
959 /* Number of items in the box */ | |
960 int count; | |
961 /* Box type - horizontal or vertical */ | |
962 int type; | |
963 /* Keep track of how box is packed */ | |
964 int hsize, vsize; | |
965 /* Padding */ | |
966 int pad, grouppadx, grouppady; | |
967 /* Groupbox */ | |
968 HWND grouphwnd; | |
969 /* Default item */ | |
970 HWND defaultitem; | |
971 /* Used as temporary storage in the calculation stage */ | |
972 int usedpadx, usedpady, minheight, minwidth; | |
973 /* Used for calculating individual item ratios */ | |
974 int width, height; | |
975 /* Any combinations of flags describing the box */ | |
976 unsigned long flags; | |
977 /* Array of item structures */ | |
978 struct _item *items; | |
979 } Box; | |
1027 | 980 |
1028 #else | 981 #else |
1029 /* GTK Specific section */ | 982 /* GTK Specific section */ |
1030 #define _GNU_SOURCE | 983 #define _GNU_SOURCE |
1031 #include <gtk/gtk.h> | 984 #include <gtk/gtk.h> |
1473 #define DW_MB_RETURN_CANCEL 2 | 1426 #define DW_MB_RETURN_CANCEL 2 |
1474 | 1427 |
1475 #define DW_PIXMAP_WIDTH(x) (x ? x->width : 0) | 1428 #define DW_PIXMAP_WIDTH(x) (x ? x->width : 0) |
1476 #define DW_PIXMAP_HEIGHT(x) (x ? x->height : 0) | 1429 #define DW_PIXMAP_HEIGHT(x) (x ? x->height : 0) |
1477 | 1430 |
1478 #if !defined(__PHOTON__) | |
1479 #define DW_RGB_COLOR (0xF0000000) | 1431 #define DW_RGB_COLOR (0xF0000000) |
1480 #define DW_RGB_TRANSPARENT (0x0F000000) | 1432 #define DW_RGB_TRANSPARENT (0x0F000000) |
1481 #define DW_RGB_MASK (0x00FFFFFF) | 1433 #define DW_RGB_MASK (0x00FFFFFF) |
1482 #define DW_RED_MASK (0x000000FF) | 1434 #define DW_RED_MASK (0x000000FF) |
1483 #define DW_GREEN_MASK (0x0000FF00) | 1435 #define DW_GREEN_MASK (0x0000FF00) |
1484 #define DW_BLUE_MASK (0x00FF0000) | 1436 #define DW_BLUE_MASK (0x00FF0000) |
1485 #define DW_RED_VALUE(a) (a & DW_RED_MASK) | 1437 #define DW_RED_VALUE(a) (a & DW_RED_MASK) |
1486 #define DW_GREEN_VALUE(a) ((a & DW_GREEN_MASK) >> 8) | 1438 #define DW_GREEN_VALUE(a) ((a & DW_GREEN_MASK) >> 8) |
1487 #define DW_BLUE_VALUE(a) ((a & DW_BLUE_MASK) >> 16) | 1439 #define DW_BLUE_VALUE(a) ((a & DW_BLUE_MASK) >> 16) |
1488 #define DW_RGB(a, b, c) (0xF0000000 | (a) | (b) << 8 | (c) << 16) | 1440 #define DW_RGB(a, b, c) (0xF0000000 | (a) | (b) << 8 | (c) << 16) |
1489 #endif | |
1490 | 1441 |
1491 /* Menu convenience paramaters */ | 1442 /* Menu convenience paramaters */ |
1492 #define DW_MENU_SEPARATOR "" | 1443 #define DW_MENU_SEPARATOR "" |
1493 #define DW_NOMENU 0 | 1444 #define DW_NOMENU 0 |
1494 #define DW_MENU_AUTO 0 | 1445 #define DW_MENU_AUTO 0 |