Changeset 12
- Timestamp:
- 11/19/07 10:41:47 (10 months ago)
- Files:
-
- trunk/win32/dfl/base.d (modified) (1 diff)
- trunk/win32/dfl/control.d (modified) (7 diffs)
- trunk/win32/dfl/form.d (modified) (12 diffs)
- trunk/win32/dfl/imagelist.d (modified) (4 diffs)
- trunk/win32/dfl/internal/winapi.d (modified) (2 diffs)
- trunk/win32/dfl/listview.d (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/win32/dfl/base.d
r7 r12 689 689 enum ColorDepth: ubyte 690 690 { 691 DEPTH_4BIT = 1, ///692 DEPTH_8BIT , /// ditto693 DEPTH_16BIT , /// ditto694 DEPTH_24BIT , /// ditto695 DEPTH_32BIT , /// ditto691 DEPTH_4BIT = 0x04, /// 692 DEPTH_8BIT = 0x08, /// ditto 693 DEPTH_16BIT = 0x10, /// ditto 694 DEPTH_24BIT = 0x18, /// ditto 695 DEPTH_32BIT = 0x20, /// ditto 696 696 } 697 697 trunk/win32/dfl/control.d
r11 r12 162 162 163 163 WANT_TAB_KEY = 0x01000000, 164 WANT_ALL_KEYS = 0x02000000, 164 165 } 165 166 … … 4538 4539 scope MouseEventArgs mea = new MouseEventArgs(MouseButtons.LEFT, 1, cast(short)LOWORD(msg.lParam), cast(short)HIWORD(msg.lParam), 0); 4539 4540 onMouseDown(mea); 4541 4542 if(ctrlStyle & ControlStyles.SELECTABLE) 4543 SetFocus(hwnd); 4540 4544 } 4541 4545 break; … … 5046 5050 } 5047 5051 5052 /+ 5053 if(msg.lParam) 5054 { 5055 Message m; 5056 m._winMsg = *cast(MSG*)msg.lParam; 5057 if(processKeyEventArgs(m)) 5058 return; 5059 } 5060 +/ 5061 5048 5062 defWndProc(msg); 5063 5064 if(ctrlStyle & ControlStyles.WANT_ALL_KEYS) 5065 msg.result |= DLGC_WANTALLKEYS; 5066 5049 5067 // Only want chars if ALT isn't down, because it would break mnemonics. 5050 5068 if(!(GetAsyncKeyState(VK_MENU) & 0x8000)) 5051 5069 msg.result |= DLGC_WANTCHARS; 5070 5052 5071 return; 5053 5072 } 5054 5055 5073 break; 5056 5074 … … 5138 5156 debug 5139 5157 { 5140 // If overriding onHandleCreated(), be sure to call super.onHandleCreated()! 5141 assert(_handlecreated); 5158 assert(_handlecreated, "If overriding onHandleCreated(), be sure to call super.onHandleCreated()!"); 5142 5159 } 5143 5160 handleCreated(this, ea); … … 6394 6411 6395 6412 /// 6396 protected bool processKeyEventArgs(inout Message msg) // package6413 protected bool processKeyEventArgs(inout Message msg) 6397 6414 { 6398 6415 switch(msg.msg) … … 6455 6472 } 6456 6473 6474 /+ 6457 6475 if(Application._compat & DflCompat.CONTROL_KEYEVENT_096) 6458 6476 goto def_action; … … 6477 6495 6478 6496 return false; 6497 +/ 6498 defWndProc(msg); 6499 //return true; 6500 return !msg.result; 6479 6501 } 6480 6502 trunk/win32/dfl/form.d
r11 r12 170 170 171 171 _shortcuts[shortcut] = pressed; 172 } 173 174 /// ditto 175 // Delegate parameter contravariance. 176 final void addShortcut(Keys shortcut, void delegate(Object sender, EventArgs ea) pressed) 177 { 178 return addShortcut(shortcut, cast(void delegate(Object sender, FormShortcutEventArgs ea))pressed); 172 179 } 173 180 … … 884 891 885 892 893 /// 894 protected MdiClient createMdiClient() 895 { 896 version(NO_MDI) 897 { 898 assert(0, "MDI disabled"); 899 return null; 900 } 901 else 902 { 903 return new MdiClient(); 904 } 905 } 906 907 886 908 version(NO_MDI) {} else 887 909 { … … 895 917 // Remove MDI client. 896 918 mdiClient.dispose(); 897 mdiClient = null; 919 //mdiClient = null; 920 _mdiClient = null; 898 921 } 899 922 } … … 903 926 { 904 927 // Create MDI client. 905 mdiClient = new MdiClient; 928 //mdiClient = new MdiClient; 929 //_mdiClient = new MdiClient; 930 //mdiClient = createMdiClient(); 931 _mdiClient = createMdiClient(); 906 932 mdiClient.parent = this; 907 933 } … … 912 938 final bool isMdiContainer() // getter 913 939 { 914 return !(mdiClient is null); 940 version(NO_MDI) 941 { 942 return false; 943 } 944 else 945 { 946 return !(mdiClient is null); 947 } 915 948 } 916 949 … … 919 952 final Form[] mdiChildren() // getter 920 953 { 921 /+922 if(!mdiClient)954 version(NO_MDI) 955 { 923 956 return null; 924 +/ 925 926 return _mdiChildren; 957 } 958 else 959 { 960 /+ 961 if(!mdiClient) 962 return null; 963 +/ 964 965 return _mdiChildren; 966 } 927 967 } 928 968 … … 931 971 932 972 933 ///934 final void mdiParent(Form frm) // setter935 in936 {937 i f(frm)938 { 939 assert(frm.isMdiContainer);940 assert(!(frm.mdiClient is null));941 }942 }943 /+out944 {945 if(frm)946 { 947 bool found = false;948 foreach(Form elem; frm._mdiChildren)949 {950 if(elem is this)973 version(NO_MDI) {} else 974 { 975 /// 976 final void mdiParent(Form frm) // setter 977 in 978 { 979 if(frm) 980 { 981 assert(frm.isMdiContainer); 982 assert(!(frm.mdiClient is null)); 983 } 984 } 985 /+out 986 { 987 if(frm) 988 { 989 bool found = false; 990 foreach(Form elem; frm._mdiChildren) 951 991 { 952 found = true; 953 break; 992 if(elem is this) 993 { 994 found = true; 995 break; 996 } 954 997 } 955 } 956 assert(found); 957 } 958 }+/ 959 body 960 { 961 if(wmdiparent is frm) 962 return; 963 964 _removeFromOldOwner(); 965 wowner = null; 966 wmdiparent = null; // Safety in case of exception. 967 968 if(frm) 969 { 970 if(isHandleCreated) 971 { 972 frm.createControl(); // ? 973 frm.mdiClient.createControl(); // Should already be done from frm.createControl(). 974 } 998 assert(found); 999 } 1000 }+/ 1001 body 1002 { 1003 if(wmdiparent is frm) 1004 return; 975 1005 976 // Copy so that old mdiChildren arrays won't get overwritten. 977 Form[] _thisa = new Form[1]; // DMD 0.123: this can't be a static array or the append screws up. 978 _thisa[0] = this; 979 frm._mdiChildren = frm._mdiChildren ~ _thisa; 1006 _removeFromOldOwner(); 1007 wowner = null; 1008 wmdiparent = null; // Safety in case of exception. 980 1009 981 _style((_style() | WS_CHILD) & ~WS_POPUP); 982 _exStyle(_exStyle() | WS_EX_MDICHILD); 983 984 wparent = frm.mdiClient; 985 wmdiparent = frm; 986 if(isHandleCreated) 987 SetParent(hwnd, frm.mdiClient.hwnd); 988 } 989 else 990 { 991 _exStyle(_exStyle() & ~WS_EX_MDICHILD); 992 _style((_style() | WS_POPUP) & ~WS_CHILD); 993 994 if(isHandleCreated) 995 SetParent(hwnd, HWND.init); 996 wparent = null; 997 998 //wmdiparent = null; 1010 if(frm) 1011 { 1012 if(isHandleCreated) 1013 { 1014 frm.createControl(); // ? 1015 frm.mdiClient.createControl(); // Should already be done from frm.createControl(). 1016 } 1017 1018 // Copy so that old mdiChildren arrays won't get overwritten. 1019 Form[] _thisa = new Form[1]; // DMD 0.123: this can't be a static array or the append screws up. 1020 _thisa[0] = this; 1021 frm._mdiChildren = frm._mdiChildren ~ _thisa; 1022 1023 _style((_style() | WS_CHILD) & ~WS_POPUP); 1024 _exStyle(_exStyle() | WS_EX_MDICHILD); 1025 1026 wparent = frm.mdiClient; 1027 wmdiparent = frm; 1028 if(isHandleCreated) 1029 SetParent(hwnd, frm.mdiClient.hwnd); 1030 } 1031 else 1032 { 1033 _exStyle(_exStyle() & ~WS_EX_MDICHILD); 1034 _style((_style() | WS_POPUP) & ~WS_CHILD); 1035 1036 if(isHandleCreated) 1037 SetParent(hwnd, HWND.init); 1038 wparent = null; 1039 1040 //wmdiparent = null; 1041 } 999 1042 } 1000 1043 } … … 1003 1046 final Form mdiParent() // getter 1004 1047 { 1005 //if(isMdiChild) 1006 return wmdiparent; 1048 version(NO_MDI) 1049 { 1050 } 1051 else 1052 { 1053 //if(isMdiChild) 1054 return wmdiparent; 1055 } 1007 1056 return null; 1008 1057 } … … 2593 2642 2594 2643 2644 version(NO_MDI) {} else 2645 { 2646 protected final MdiClient mdiClient() // getter 2647 { return _mdiClient; } 2648 } 2649 2650 2595 2651 private: 2596 2652 IButtonControl acceptBtn, cancelBtn; … … 2619 2675 version(NO_MDI) {} else 2620 2676 { 2621 MdiClient mdiClient = null; // null == not MDI container.2677 MdiClient _mdiClient = null; // null == not MDI container. 2622 2678 } 2623 2679 … … 2827 2883 version(NO_MDI) {} else 2828 2884 { 2829 // ///2885 /// 2830 2886 class MdiClient: ControlSuperClass 2831 2887 { … … 2839 2895 2840 2896 dock = DockStyle.FILL; 2897 } 2898 2899 2900 /// 2901 void borderStyle(BorderStyle bs) // setter 2902 { 2903 switch(bs) 2904 { 2905 case BorderStyle.FIXED_3D: 2906 _style(_style() & ~WS_BORDER); 2907 _exStyle(_exStyle() | WS_EX_CLIENTEDGE); 2908 break; 2909 2910 case BorderStyle.FIXED_SINGLE: 2911 _exStyle(_exStyle() & ~WS_EX_CLIENTEDGE); 2912 _style(_style() | WS_BORDER); 2913 break; 2914 2915 case BorderStyle.NONE: 2916 _style(_style() & ~WS_BORDER); 2917 _exStyle(_exStyle() & ~WS_EX_CLIENTEDGE); 2918 break; 2919 } 2920 2921 if(isHandleCreated) 2922 { 2923 redrawEntire(); 2924 } 2925 } 2926 2927 /// ditto 2928 BorderStyle borderStyle() // getter 2929 { 2930 if(_exStyle() & WS_EX_CLIENTEDGE) 2931 return BorderStyle.FIXED_3D; 2932 else if(_style() & WS_BORDER) 2933 return BorderStyle.FIXED_SINGLE; 2934 return BorderStyle.NONE; 2935 } 2936 2937 2938 /// 2939 final void hScroll(bool byes) // setter 2940 { 2941 LONG wl = _style(); 2942 if(byes) 2943 wl |= WS_HSCROLL; 2944 else 2945 wl &= ~WS_HSCROLL; 2946 _style(wl); 2947 2948 if(isHandleCreated) 2949 redrawEntire(); 2950 } 2951 2952 2953 /// ditto 2954 final bool hScroll() // getter 2955 { 2956 return (_style() & WS_HSCROLL) != 0; 2957 } 2958 2959 2960 /// 2961 final void vScroll(bool byes) // setter 2962 { 2963 LONG wl = _style(); 2964 if(byes) 2965 wl |= WS_VSCROLL; 2966 else 2967 wl &= ~WS_VSCROLL; 2968 _style(wl); 2969 2970 if(isHandleCreated) 2971 redrawEntire(); 2841 2972 } 2842 2973 trunk/win32/dfl/imagelist.d
r7 r12 61 61 62 62 /// 63 final void imageSize(Size sz) // setter 64 { 65 assert(!isHandleCreated); 66 67 _w = sz.width; 68 _h = sz.height; 69 } 70 71 /// ditto 72 final Size imageSize() // getter 73 { 74 return Size(_w, _h); 75 } 76 77 78 /// 63 79 final ImageCollection images() // getter 64 80 { … … 81 97 82 98 /// 99 final void draw(Graphics g, Point pt, int index) 100 { 101 return draw(g, pt.x, pt.y, index); 102 } 103 104 /// ditto 105 final void draw(Graphics g, int x, int y, int index) 106 { 107 ImageList_Draw(handle, index, g.handle, x, y, ILD_NORMAL); 108 } 109 110 /+ 111 /// ditto 112 // stretch 113 final void draw(Graphics g, int x, int y, int width, int height, int index) 114 { 115 } 116 +/ 117 118 119 /// 83 120 final bool isHandleCreated() // getter 84 121 { … … 86 123 } 87 124 88 deprecated isHandleCreated handleCreated;125 deprecated alias isHandleCreated handleCreated; 89 126 90 127 91 128 final HIMAGELIST handle() // getter 92 129 { 93 if( isHandleCreated)130 if(!isHandleCreated) 94 131 _createimagelist(); 95 132 return _hil; … … 123 160 124 161 UINT flags = 0; 162 /+ 125 163 switch(_depth) 126 164 { 127 case DEPTH_4BIT: flags = ILC_COLOR4; break;165 case ColorDepth.DEPTH_4BIT: flags = ILC_COLOR4; break; 128 166 default: case DEPTH_8BIT: flags = ILC_COLOR8; break; 129 case DEPTH_16BIT: flags = ILC_COLOR16; break;130 case DEPTH_24BIT: flags = ILC_COLOR24; break;131 case DEPTH_32BIT: flags = ILC_COLOR32; break;167 case ColorDepth.DEPTH_16BIT: flags = ILC_COLOR16; break; 168 case ColorDepth.DEPTH_24BIT: flags = ILC_COLOR24; break; 169 case ColorDepth.DEPTH_32BIT: flags = ILC_COLOR32; break; 132 170 } 171 +/ 172 flags |= _depth; 133 173 flags |= ILC_MASK; // ? 134 174 135 _hil = ImageList_Create(_w, _h, flags, _cimages._images.length );175 _hil = ImageList_Create(_w, _h, flags, _cimages._images.length, 65535); // ? 136 176 } 137 177 } trunk/win32/dfl/internal/winapi.d
r7 r12 1629 1629 1630 1630 1631 typedef HANDLE HIMAGELIST; 1632 1633 1634 enum: UINT 1635 { 1636 ILD_NORMAL = 0, 1637 } 1638 1639 1640 enum: UINT 1641 { 1642 //ILC_COLOR = , 1643 ILC_COLOR4 = 0x0004, 1644 ILC_COLOR8 = 0x0008, 1645 ILC_COLOR16 = 0x0010, 1646 ILC_COLOR24 = 0x0018, 1647 ILC_COLOR32 = 0x0020, 1648 1649 ILC_MASK = 0x0001, 1650 } 1651 1652 1631 1653 // Rich edit. 1632 typedefDWORD function(/+ DWORD_PTR +/ DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG* pcb) EDITSTREAMCALLBACK;1654 alias DWORD function(/+ DWORD_PTR +/ DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG* pcb) EDITSTREAMCALLBACK; 1633 1655 1634 1656 … … 2751 2773 DWORD GetThemeAppProperties(); 2752 2774 BOOL IsAppThemed(); 2775 HIMAGELIST ImageList_Create(int cx, int cy, UINT flags, int cInitial, int cGrow); 2776 BOOL ImageList_Destroy(HIMAGELIST himl); 2777 BOOL ImageList_Draw(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, UINT fStyle); 2778 BOOL ImageList_DrawEx(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, int dx, int dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle); 2753 2779 2754 2780 //} // Temporary. trunk/win32/dfl/listview.d
r7 r12 1634 1634 } 1635 1635 1636 /+1637 1636 if(created) 1638 invalidate(false); 1639 +/ 1637 redrawEntire(); 1640 1638 } 1641 1639 … … 2004 2002 switch(m.msg) 2005 2003 { 2004 /+ 2006 2005 case WM_PAINT: 2007 2006 // This seems to be the only way to display columns correctly. 2008 2007 prevWndProc(m); 2009 2008 return; 2009 +/ 2010 2010 2011 2011 case LVM_ARRANGE: … … 2095 2095 //SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, wlvexstyle, wlvexstyle); 2096 2096 prevwproc(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, wlvexstyle); // wparam=0 sets all. 2097 //redrawEntire(); // Need to recalc the frame ?2098 2097 2099 2098 Color color; … … 2114 2113 cols.doListHeaders(); 2115 2114 litems.doListItems(); 2115 2116 recalcEntire(); // Fix frame. 2116 2117 } 2117 2118
