comparison win/dw.c @ 1810:c110191e3775

Added tab handling to the toolbar control on Windows... Fixing tab handling for bitmap buttons after the control change in 2.4.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 08 Oct 2012 20:21:10 +0000
parents 83b2bd4ca2a3
children e7ed7bbea3a4
comparison
equal deleted inserted replaced
1809:5efaea897310 1810:c110191e3775
915 /* These are the window classes which can 915 /* These are the window classes which can
916 * obtain input focus. 916 * obtain input focus.
917 */ 917 */
918 if(_tcsnicmp(tmpbuf, EDITCLASSNAME, _tcslen(EDITCLASSNAME)+1)==0 || /* Entryfield */ 918 if(_tcsnicmp(tmpbuf, EDITCLASSNAME, _tcslen(EDITCLASSNAME)+1)==0 || /* Entryfield */
919 _tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1)==0 || /* Button */ 919 _tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1)==0 || /* Button */
920 #ifdef TOOLBAR
921 _tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0 || /* Toolbar */
922 #endif
920 _tcsnicmp(tmpbuf, COMBOBOXCLASSNAME, _tcslen(COMBOBOXCLASSNAME)+1)==0 || /* Combobox */ 923 _tcsnicmp(tmpbuf, COMBOBOXCLASSNAME, _tcslen(COMBOBOXCLASSNAME)+1)==0 || /* Combobox */
921 _tcsnicmp(tmpbuf, LISTBOXCLASSNAME, _tcslen(LISTBOXCLASSNAME)+1)==0 || /* List box */ 924 _tcsnicmp(tmpbuf, LISTBOXCLASSNAME, _tcslen(LISTBOXCLASSNAME)+1)==0 || /* List box */
922 _tcsnicmp(tmpbuf, UPDOWN_CLASS, _tcslen(UPDOWN_CLASS)+1)==0 || /* Spinbutton */ 925 _tcsnicmp(tmpbuf, UPDOWN_CLASS, _tcslen(UPDOWN_CLASS)+1)==0 || /* Spinbutton */
923 _tcsnicmp(tmpbuf, TRACKBAR_CLASS, _tcslen(TRACKBAR_CLASS)+1)==0 || /* Slider */ 926 _tcsnicmp(tmpbuf, TRACKBAR_CLASS, _tcslen(TRACKBAR_CLASS)+1)==0 || /* Slider */
924 _tcsnicmp(tmpbuf, WC_LISTVIEW, _tcslen(WC_LISTVIEW)+1)== 0 || /* Container */ 927 _tcsnicmp(tmpbuf, WC_LISTVIEW, _tcslen(WC_LISTVIEW)+1)== 0 || /* Container */
2728 GetClassName(handle, tmpbuf, 99); 2731 GetClassName(handle, tmpbuf, 99);
2729 2732
2730 /* These are the window classes which can 2733 /* These are the window classes which can
2731 * obtain input focus. 2734 * obtain input focus.
2732 */ 2735 */
2733 if (_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1)==0) 2736 if (_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1)==0
2737 #ifdef TOOLBAR
2738 || _tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0
2739 #endif
2740 )
2734 { 2741 {
2735 /* Generate click on default item */ 2742 /* Generate click on default item */
2736 SignalHandler *tmp = Root; 2743 SignalHandler *tmp = Root;
2737 2744
2738 /* Find any callbacks for this function */ 2745 /* Find any callbacks for this function */
3144 if(!continfo || !continfo->cinfo.pOldProc) 3151 if(!continfo || !continfo->cinfo.pOldProc)
3145 return DefWindowProc(hWnd, msg, mp1, mp2); 3152 return DefWindowProc(hWnd, msg, mp1, mp2);
3146 return CallWindowProc(continfo->cinfo.pOldProc, hWnd, msg, mp1, mp2); 3153 return CallWindowProc(continfo->cinfo.pOldProc, hWnd, msg, mp1, mp2);
3147 } 3154 }
3148 3155
3149 LRESULT CALLBACK _treewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) 3156 LRESULT CALLBACK _simplewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2)
3150 { 3157 {
3151 ContainerInfo *cinfo; 3158 ContainerInfo *cinfo;
3152 LRESULT ret = -1; 3159 LRESULT ret = -1;
3153 3160
3154 cinfo = (ContainerInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); 3161 cinfo = (ContainerInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
5938 { 5945 {
5939 DestroyWindow(tmp); 5946 DestroyWindow(tmp);
5940 return NULL; 5947 return NULL;
5941 } 5948 }
5942 5949
5943 cinfo->cinfo.pOldProc = SubclassWindow(tmp, _treewndproc); 5950 cinfo->cinfo.pOldProc = SubclassWindow(tmp, _simplewndproc);
5944 cinfo->cinfo.fore = cinfo->cinfo.back = -1; 5951 cinfo->cinfo.fore = cinfo->cinfo.back = -1;
5945 cinfo->odd = cinfo->even = DW_RGB_TRANSPARENT; 5952 cinfo->odd = cinfo->even = DW_RGB_TRANSPARENT;
5946 5953
5947 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); 5954 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo);
5948 dw_window_set_font(tmp, DefaultFont); 5955 dw_window_set_font(tmp, DefaultFont);
6054 { 6061 {
6055 DestroyWindow(tmp); 6062 DestroyWindow(tmp);
6056 return NULL; 6063 return NULL;
6057 } 6064 }
6058 6065
6059 cinfo->cinfo.pOldProc = SubclassWindow(tmp, _treewndproc); 6066 cinfo->cinfo.pOldProc = SubclassWindow(tmp, _simplewndproc);
6060 cinfo->cinfo.fore = cinfo->cinfo.back = -1; 6067 cinfo->cinfo.fore = cinfo->cinfo.back = -1;
6061 cinfo->odd = cinfo->even = DW_RGB_TRANSPARENT; 6068 cinfo->odd = cinfo->even = DW_RGB_TRANSPARENT;
6062 6069
6063 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); 6070 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo);
6064 dw_window_set_font(tmp, DefaultFont); 6071 dw_window_set_font(tmp, DefaultFont);
6305 HBITMAP hbitmap = icon ? 0 : LoadBitmap(DWInstance, MAKEINTRESOURCE(id)); 6312 HBITMAP hbitmap = icon ? 0 : LoadBitmap(DWInstance, MAKEINTRESOURCE(id));
6306 #ifdef TOOLBAR 6313 #ifdef TOOLBAR
6307 if(tmp = _create_toolbar(text, id, icon, hbitmap)) 6314 if(tmp = _create_toolbar(text, id, icon, hbitmap))
6308 { 6315 {
6309 cinfo->fore = cinfo->back = -1; 6316 cinfo->fore = cinfo->back = -1;
6317 cinfo->pOldProc = SubclassWindow(tmp, _simplewndproc);
6310 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); 6318 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo);
6311 return tmp; 6319 return tmp;
6312 } 6320 }
6313 #endif 6321 #endif
6314 6322
6375 6383
6376 #ifdef TOOLBAR 6384 #ifdef TOOLBAR
6377 if(tmp = _create_toolbar(text, id, hicon, hbitmap)) 6385 if(tmp = _create_toolbar(text, id, hicon, hbitmap))
6378 { 6386 {
6379 cinfo->fore = cinfo->back = -1; 6387 cinfo->fore = cinfo->back = -1;
6388 cinfo->pOldProc = SubclassWindow(tmp, _simplewndproc);
6380 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); 6389 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo);
6381 return tmp; 6390 return tmp;
6382 } 6391 }
6383 #endif 6392 #endif
6384 tmp = CreateWindow( BUTTONCLASSNAME, 6393 tmp = CreateWindow( BUTTONCLASSNAME,
6465 6474
6466 #ifdef TOOLBAR 6475 #ifdef TOOLBAR
6467 if(tmp = _create_toolbar(text, id, hicon, hbitmap)) 6476 if(tmp = _create_toolbar(text, id, hicon, hbitmap))
6468 { 6477 {
6469 cinfo->fore = cinfo->back = -1; 6478 cinfo->fore = cinfo->back = -1;
6479 cinfo->pOldProc = SubclassWindow(tmp, _simplewndproc);
6470 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo); 6480 SetWindowLongPtr(tmp, GWLP_USERDATA, (LONG_PTR)cinfo);
6471 return tmp; 6481 return tmp;
6472 } 6482 }
6473 #endif 6483 #endif
6474 tmp = CreateWindow( BUTTONCLASSNAME, 6484 tmp = CreateWindow( BUTTONCLASSNAME,