Mercurial > dwindows
comparison win/dw.c @ 643:9ab89d89e6b4
Add dw_listview_insert()
Default to using webkit for Gtk+ HTML widget
Add option to build with libgtkhtml2 - incomplete
Initial attempt to use customdraw for Win32 container - not working
Added dw_window_get_font() for Gtk+ - not implemented in other ports yet
Change package name from dw to dwindows for Linux ports - use dwindows-config now
Add debian package build target
author | mhessling@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 03 Oct 2010 00:34:36 +0000 |
parents | 6cec85b90635 |
children | 2b260f4309bb |
comparison
equal
deleted
inserted
replaced
642:fda03b13ebda | 643:9ab89d89e6b4 |
---|---|
1548 is_checked = (int)dw_window_get_data(DW_HWND_OBJECT, buffer); | 1548 is_checked = (int)dw_window_get_data(DW_HWND_OBJECT, buffer); |
1549 is_checked = (is_checked) ? 0 : 1; | 1549 is_checked = (is_checked) ? 0 : 1; |
1550 dw_menu_item_set_check( window, id, is_checked ); | 1550 dw_menu_item_set_check( window, id, is_checked ); |
1551 } | 1551 } |
1552 } | 1552 } |
1553 | |
1554 #ifdef DEBUG | |
1555 long ProcessCustomDraw (LPARAM lParam) | |
1556 { | |
1557 LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)lParam; | |
1558 | |
1559 switch(lplvcd->nmcd.dwDrawStage) | |
1560 { | |
1561 case CDDS_PREPAINT : //Before the paint cycle begins | |
1562 //request notifications for individual listview items | |
1563 dw_messagebox("LISTVIEW", DW_MB_OK|DW_MB_ERROR, "PREPAINT"); | |
1564 // return CDRF_NOTIFYITEMDRAW; | |
1565 return (CDRF_NOTIFYPOSTPAINT | CDRF_NOTIFYITEMDRAW); | |
1566 | |
1567 case CDDS_ITEMPREPAINT: //Before an item is drawn | |
1568 { | |
1569 dw_messagebox("LISTVIEW", DW_MB_OK|DW_MB_ERROR, "ITEMPREPAINT"); | |
1570 return CDRF_NOTIFYSUBITEMDRAW; | |
1571 } | |
1572 break; | |
1573 | |
1574 case CDDS_SUBITEM | CDDS_ITEMPREPAINT: //Before a subitem is drawn | |
1575 { | |
1576 dw_messagebox("LISTVIEW", DW_MB_OK|DW_MB_ERROR, "SUBITEM ITEMPREPAINT %d",lplvcd->iSubItem); | |
1577 switch(lplvcd->iSubItem) | |
1578 { | |
1579 case 0: | |
1580 { | |
1581 lplvcd->clrText = RGB(255,255,255); | |
1582 lplvcd->clrTextBk = RGB(240,55,23); | |
1583 return CDRF_NEWFONT; | |
1584 } | |
1585 break; | |
1586 | |
1587 case 1: | |
1588 { | |
1589 lplvcd->clrText = RGB(255,255,0); | |
1590 lplvcd->clrTextBk = RGB(0,0,0); | |
1591 return CDRF_NEWFONT; | |
1592 } | |
1593 break; | |
1594 | |
1595 case 2: | |
1596 { | |
1597 lplvcd->clrText = RGB(20,26,158); | |
1598 lplvcd->clrTextBk = RGB(200,200,10); | |
1599 return CDRF_NEWFONT; | |
1600 } | |
1601 break; | |
1602 | |
1603 case 3: | |
1604 { | |
1605 lplvcd->clrText = RGB(12,15,46); | |
1606 lplvcd->clrTextBk = RGB(200,200,200); | |
1607 return CDRF_NEWFONT; | |
1608 } | |
1609 break; | |
1610 | |
1611 case 4: | |
1612 { | |
1613 lplvcd->clrText = RGB(120,0,128); | |
1614 lplvcd->clrTextBk = RGB(20,200,200); | |
1615 return CDRF_NEWFONT; | |
1616 } | |
1617 break; | |
1618 | |
1619 case 5: | |
1620 { | |
1621 lplvcd->clrText = RGB(255,255,255); | |
1622 lplvcd->clrTextBk = RGB(0,0,150); | |
1623 return CDRF_NEWFONT; | |
1624 } | |
1625 break; | |
1626 | |
1627 } | |
1628 | |
1629 } | |
1630 } | |
1631 return CDRF_DODEFAULT; | |
1632 } | |
1633 #endif | |
1553 | 1634 |
1554 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */ | 1635 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */ |
1555 BOOL CALLBACK _wndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) | 1636 BOOL CALLBACK _wndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) |
1556 { | 1637 { |
1557 int result = -1, taskbar = FALSE; | 1638 int result = -1, taskbar = FALSE; |
1778 NMTREEVIEW FAR *tem=(NMTREEVIEW FAR *)mp2; | 1859 NMTREEVIEW FAR *tem=(NMTREEVIEW FAR *)mp2; |
1779 NMLISTVIEW FAR *lem=(NMLISTVIEW FAR *)mp2; | 1860 NMLISTVIEW FAR *lem=(NMLISTVIEW FAR *)mp2; |
1780 char tmpbuf[100]; | 1861 char tmpbuf[100]; |
1781 | 1862 |
1782 GetClassName(tem->hdr.hwndFrom, tmpbuf, 99); | 1863 GetClassName(tem->hdr.hwndFrom, tmpbuf, 99); |
1864 #ifdef DEBUG_NOTUSED | |
1865 if ( lem->hdr.code == NM_CUSTOMDRAW ) | |
1866 dw_messagebox("NM_CUSTOMDRAW for (WM_NOTIFY)", DW_MB_OK|DW_MB_ERROR, "%s %d: Classname:%s",__FILE__,__LINE__,tmpbuf); | |
1867 #endif | |
1783 | 1868 |
1784 if(strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW))==0) | 1869 if(strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW))==0) |
1785 { | 1870 { |
1786 if(tem->hdr.code == TVN_SELCHANGED && tmp->message == TVN_SELCHANGED) | 1871 if(tem->hdr.code == TVN_SELCHANGED && tmp->message == TVN_SELCHANGED) |
1787 { | 1872 { |
1878 treeselectfunc(tmp->window, 0, (char *)lvi.lParam, tmp->data, 0); | 1963 treeselectfunc(tmp->window, 0, (char *)lvi.lParam, tmp->data, 0); |
1879 tmp = NULL; | 1964 tmp = NULL; |
1880 } | 1965 } |
1881 } | 1966 } |
1882 } | 1967 } |
1968 #ifdef DEBUG | |
1969 else if ( lem->hdr.code == NM_CUSTOMDRAW ) | |
1970 { | |
1971 dw_messagebox("NM_CUSTOMDRAW for WC_LISTVIEW from _wndproc (WM_NOTIFY)", DW_MB_OK|DW_MB_ERROR, "Hello"); | |
1972 SetWindowLong( hWnd, DWL_MSGRESULT, (LONG)ProcessCustomDraw(mp2) ); | |
1973 return TRUE; | |
1974 } | |
1975 #endif | |
1883 } | 1976 } |
1884 } | 1977 } |
1885 else if(tmp->message == TCN_SELCHANGE) | 1978 else if(tmp->message == TCN_SELCHANGE) |
1886 { | 1979 { |
1887 NMHDR FAR *tem=(NMHDR FAR *)mp2; | 1980 NMHDR FAR *tem=(NMHDR FAR *)mp2; |
1901 int (*columnclickfunc)(HWND, int, void *) = tmp->signalfunction; | 1994 int (*columnclickfunc)(HWND, int, void *) = tmp->signalfunction; |
1902 result = columnclickfunc(tem->hdr.hwndFrom, tem->iSubItem, tmp->data); | 1995 result = columnclickfunc(tem->hdr.hwndFrom, tem->iSubItem, tmp->data); |
1903 tmp = NULL; | 1996 tmp = NULL; |
1904 } | 1997 } |
1905 } | 1998 } |
1999 #ifdef DEBUG_NOTUSED | |
2000 else | |
2001 { | |
2002 NMLISTVIEW FAR *lem=(NMLISTVIEW FAR *)mp2; | |
2003 char tmpbuf[100]; | |
2004 GetClassName(lem->hdr.hwndFrom, tmpbuf, 99); | |
2005 if ( strnicmp( tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1 ) == 0 && lem->hdr.code == NM_CUSTOMDRAW ) | |
2006 { | |
2007 dw_messagebox("NM_CUSTOMDRAW for WC_LISTVIEW(mp2) from _wndproc (WM_NOTIFY)", DW_MB_OK|DW_MB_ERROR, "Hello"); | |
2008 SetWindowLong( hWnd, DWL_MSGRESULT, (LONG)ProcessCustomDraw(mp2) ); | |
2009 tmp = NULL; //return TRUE; | |
2010 } | |
2011 } | |
2012 #endif | |
1906 } | 2013 } |
1907 break; | 2014 break; |
1908 case WM_COMMAND: | 2015 case WM_COMMAND: |
1909 { | 2016 { |
1910 int (*clickfunc)(HWND, void *) = tmp->signalfunction; | 2017 int (*clickfunc)(HWND, void *) = tmp->signalfunction; |
2079 if(num > -1 && array && array[num]) | 2186 if(num > -1 && array && array[num]) |
2080 SetParent(array[num]->hwnd, tem->hwndFrom); | 2187 SetParent(array[num]->hwnd, tem->hwndFrom); |
2081 | 2188 |
2082 _resize_notebook_page(tem->hwndFrom, num); | 2189 _resize_notebook_page(tem->hwndFrom, num); |
2083 } | 2190 } |
2191 #ifdef DEBUG | |
2192 else | |
2193 { | |
2194 /* | |
2195 * Check if we have a click_default for this window | |
2196 */ | |
2197 NMLISTVIEW FAR *lem=(NMLISTVIEW FAR *)mp2; | |
2198 char tmpbuf[100]; | |
2199 GetClassName(lem->hdr.hwndFrom, tmpbuf, 99); | |
2200 if ( lem->hdr.code == NM_CUSTOMDRAW ) | |
2201 dw_messagebox("NM_CUSTOMDRAW for (WM_NOTIFY)", DW_MB_OK|DW_MB_ERROR, "%s %d: Classname:%s is it %s",__FILE__,__LINE__,tmpbuf,WC_LISTVIEW); | |
2202 if ( strnicmp( tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1 ) == 0 && lem->hdr.code == NM_CUSTOMDRAW ) | |
2203 { | |
2204 dw_messagebox("NM_CUSTOMDRAW for WC_LISTVIEW(mp2) from _wndproc (WM_NOTIFY) - normal processing", DW_MB_OK|DW_MB_ERROR, "Hello"); | |
2205 SetWindowLong( hWnd, DWL_MSGRESULT, (long)ProcessCustomDraw(mp2) ); | |
2206 return TRUE; | |
2207 } | |
2208 } | |
2209 #endif | |
2084 } | 2210 } |
2085 break; | 2211 break; |
2086 case WM_HSCROLL: | 2212 case WM_HSCROLL: |
2087 case WM_VSCROLL: | 2213 case WM_VSCROLL: |
2088 { | 2214 { |
2499 /* Find any callbacks for this function */ | 2625 /* Find any callbacks for this function */ |
2500 while (tmp) | 2626 while (tmp) |
2501 { | 2627 { |
2502 if (tmp->message == WM_COMMAND) | 2628 if (tmp->message == WM_COMMAND) |
2503 { | 2629 { |
2504 int (*clickfunc)(HWND, void *) = tmp->signalfunction; | |
2505 | |
2506 /* Make sure it's the right window, and the right ID */ | 2630 /* Make sure it's the right window, and the right ID */ |
2507 if (tmp->window == handle) | 2631 if (tmp->window == handle) |
2508 { | 2632 { |
2633 int (*clickfunc)(HWND, void *) = tmp->signalfunction; | |
2509 clickfunc(tmp->window, tmp->data); | 2634 clickfunc(tmp->window, tmp->data); |
2510 tmp = NULL; | 2635 tmp = NULL; |
2511 } | 2636 } |
2512 } | 2637 } |
2513 if (tmp) | 2638 if (tmp) |
2632 * Find the toplevel window for the current window and check if it | 2757 * Find the toplevel window for the current window and check if it |
2633 * has a default click set | 2758 * has a default click set |
2634 */ | 2759 */ |
2635 HWND tl = _toplevel_window( hWnd ); | 2760 HWND tl = _toplevel_window( hWnd ); |
2636 ColorInfo *mycinfo = (ColorInfo *)GetWindowLongPtr( tl, GWLP_USERDATA ); | 2761 ColorInfo *mycinfo = (ColorInfo *)GetWindowLongPtr( tl, GWLP_USERDATA ); |
2637 if ( mycinfo && cinfo->clickdefault ) | 2762 if ( mycinfo && mycinfo->clickdefault ) |
2638 { | 2763 { |
2639 _click_default( mycinfo->clickdefault ); | 2764 _click_default( mycinfo->clickdefault ); |
2640 } | 2765 } |
2641 } | 2766 } |
2642 } | 2767 } |
6227 for(i=0;i<count;i++) | 6352 for(i=0;i<count;i++) |
6228 SendMessage(handle,(WPARAM)listbox_type,0,(LPARAM)text[i]); | 6353 SendMessage(handle,(WPARAM)listbox_type,0,(LPARAM)text[i]); |
6229 } | 6354 } |
6230 | 6355 |
6231 /* | 6356 /* |
6357 * Inserts the specified text to the listbox's (or combobox) entry list. | |
6358 * Parameters: | |
6359 * handle: Handle to the listbox to be appended to. | |
6360 * text: Text to append into listbox. | |
6361 * pos: 0 based position to insert text | |
6362 */ | |
6363 void API dw_listbox_insert(HWND handle, char *text, int pos) | |
6364 { | |
6365 char tmpbuf[100]; | |
6366 | |
6367 GetClassName(handle, tmpbuf, 99); | |
6368 | |
6369 if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) | |
6370 SendMessage(handle, | |
6371 CB_INSERTSTRING, | |
6372 pos, (LPARAM)text); | |
6373 else | |
6374 SendMessage(handle, | |
6375 LB_INSERTSTRING, | |
6376 pos, (LPARAM)text); | |
6377 } | |
6378 | |
6379 /* | |
6232 * Clears the listbox's (or combobox) list of all entries. | 6380 * Clears the listbox's (or combobox) list of all entries. |
6233 * Parameters: | 6381 * Parameters: |
6234 * handle: Handle to the listbox to be cleared. | 6382 * handle: Handle to the listbox to be cleared. |
6235 */ | 6383 */ |
6236 void API dw_listbox_clear(HWND handle) | 6384 void API dw_listbox_clear(HWND handle) |