Changeset 2852 for trunk/src/user32/uitools.cpp
- Timestamp:
- Feb 21, 2000, 6:25:33 PM (26 years ago)
- File:
-
- 1 edited
-
trunk/src/user32/uitools.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/uitools.cpp
r2804 r2852 1 /* $Id: uitools.cpp,v 1.2 3 2000-02-16 14:34:37 sandervlExp $ */1 /* $Id: uitools.cpp,v 1.24 2000-02-21 17:25:29 cbratschi Exp $ */ 2 2 /* 3 3 * User Interface Functions … … 16 16 #include "win32wbase.h" 17 17 18 #define DBG_LOCALLOG DBG_uitools18 #define DBG_LOCALLOG DBG_uitools 19 19 #include "dbglocal.h" 20 20 … … 1826 1826 return (TRUE); 1827 1827 } 1828 1829 1830 /*****************************************************************************1831 * Name : VOID WIN32API DrawCaption1832 * Purpose : The DrawCaption function draws a window caption.1833 * Parameters: HDC hdc handle of device context1834 * LPRECT lprc address of bounding rectangle coordinates1835 * HFONT hfont handle of font for caption1836 * HICON hicon handle of icon in caption1837 * LPSTR lpszText address of caption string1838 * WORD wFlags drawing options1839 * Variables :1840 * Result :1841 * Remark :1842 * Status : UNTESTED STUB1843 *1844 * Author : Patrick Haller [Thu, 1998/02/26 11:55]1845 *****************************************************************************/1846 1847 BOOL WIN32API DrawCaption (HWND hwnd,1848 HDC hdc,1849 const RECT *lprc,1850 UINT wFlags)1851 {1852 dprintf(("USER32:DrawCaption (%08xh,%08xh,%08xh,%08xh) not implemented.\n",1853 hwnd,1854 hdc,1855 lprc,1856 wFlags));1857 1858 return FALSE;1859 }1860 /***********************************************************************1861 * DrawCaptionTemp32A [USER32.599]1862 *1863 * PARAMS1864 *1865 * RETURNS1866 * Success:1867 * Failure:1868 */1869 1870 BOOL WIN32API DrawCaptionTempA(HWND hwnd,1871 HDC hdc,1872 const RECT *rect,1873 HFONT hFont,1874 HICON hIcon,1875 LPCSTR str,1876 UINT uFlags)1877 {1878 RECT rc = *rect;1879 1880 dprintf(("USER32: DrawCaptionTempA(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",1881 hwnd,1882 hdc,1883 rect,1884 hFont,1885 hIcon,1886 str,1887 uFlags));1888 1889 /* drawing background */1890 if (uFlags & DC_INBUTTON)1891 {1892 O32_FillRect (hdc,1893 &rc,1894 GetSysColorBrush (COLOR_3DFACE));1895 1896 if (uFlags & DC_ACTIVE)1897 {1898 HBRUSH hbr = O32_SelectObject (hdc,1899 GetSysColorBrush (COLOR_ACTIVECAPTION));1900 O32_PatBlt (hdc,1901 rc.left,1902 rc.top,1903 rc.right - rc.left,1904 rc.bottom - rc.top,1905 0xFA0089);1906 1907 O32_SelectObject (hdc,1908 hbr);1909 }1910 }1911 else1912 {1913 O32_FillRect (hdc,1914 &rc,1915 GetSysColorBrush ((uFlags & DC_ACTIVE) ?1916 COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION));1917 }1918 1919 1920 /* drawing icon */1921 if ((uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP))1922 {1923 POINT pt;1924 1925 pt.x = rc.left + 2;1926 pt.y = (rc.bottom + rc.top - O32_GetSystemMetrics(SM_CYSMICON)) / 2;1927 1928 if (hIcon)1929 {1930 DrawIconEx (hdc,1931 pt.x,1932 pt.y,1933 hIcon,1934 O32_GetSystemMetrics(SM_CXSMICON),1935 O32_GetSystemMetrics(SM_CYSMICON),1936 0,1937 0,1938 DI_NORMAL);1939 }1940 else1941 {1942 /* @@@PH 1999/06/08 not ported yet, just don't draw any icon1943 WND *wndPtr = WIN_FindWndPtr(hwnd);1944 HICON hAppIcon = 0;1945 1946 if (wndPtr->class->hIconSm)1947 hAppIcon = wndPtr->class->hIconSm;1948 else1949 if (wndPtr->class->hIcon)1950 hAppIcon = wndPtr->class->hIcon;1951 1952 DrawIconEx (hdc,1953 pt.x,1954 pt.y,1955 hAppIcon,1956 GetSystemMetrics(SM_CXSMICON),1957 GetSystemMetrics(SM_CYSMICON),1958 0,1959 0,1960 DI_NORMAL);1961 1962 WIN_ReleaseWndPtr(wndPtr);1963 */1964 }1965 1966 rc.left += (rc.bottom - rc.top);1967 }1968 1969 /* drawing text */1970 if (uFlags & DC_TEXT)1971 {1972 HFONT hOldFont;1973 1974 if (uFlags & DC_INBUTTON)1975 O32_SetTextColor (hdc,1976 O32_GetSysColor (COLOR_BTNTEXT));1977 else1978 if (uFlags & DC_ACTIVE)1979 O32_SetTextColor (hdc,1980 O32_GetSysColor (COLOR_CAPTIONTEXT));1981 else1982 O32_SetTextColor (hdc,1983 O32_GetSysColor (COLOR_INACTIVECAPTIONTEXT));1984 1985 O32_SetBkMode (hdc,1986 TRANSPARENT);1987 1988 if (hFont)1989 hOldFont = O32_SelectObject (hdc,1990 hFont);1991 else1992 {1993 NONCLIENTMETRICSA nclm;1994 HFONT hNewFont;1995 1996 nclm.cbSize = sizeof(NONCLIENTMETRICSA);1997 O32_SystemParametersInfo (SPI_GETNONCLIENTMETRICS,1998 0,1999 &nclm,2000 0);2001 hNewFont = O32_CreateFontIndirect ((uFlags & DC_SMALLCAP) ?2002 &nclm.lfSmCaptionFont : &nclm.lfCaptionFont);2003 hOldFont = O32_SelectObject (hdc,2004 hNewFont);2005 }2006 2007 if (str)2008 DrawTextA (hdc,2009 str,2010 -1,2011 &rc,2012 DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);2013 else2014 {2015 CHAR szText[128];2016 INT nLen;2017 2018 nLen = O32_GetWindowText (Win32BaseWindow::Win32ToOS2FrameHandle(hwnd),2019 szText,2020 128);2021 2022 DrawTextA (hdc,2023 szText,2024 nLen,2025 &rc,2026 DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);2027 }2028 2029 if (hFont)2030 O32_SelectObject (hdc,2031 hOldFont);2032 else2033 O32_DeleteObject (O32_SelectObject (hdc,2034 hOldFont));2035 }2036 2037 /* drawing focus ??? */2038 if (uFlags & 0x2000)2039 {2040 dprintf(("USER32: DrawCaptionTempA undocumented flag (0x2000)!\n"));2041 }2042 2043 return 0;2044 }2045 2046 2047 /***********************************************************************2048 * DrawCaptionTemp32W [USER32.602]2049 *2050 * PARAMS2051 *2052 * RETURNS2053 * Success:2054 * Failure:2055 */2056 2057 BOOL WIN32API DrawCaptionTempW (HWND hwnd,2058 HDC hdc,2059 const RECT *rect,2060 HFONT hFont,2061 HICON hIcon,2062 LPCWSTR str,2063 UINT uFlags)2064 {2065 LPSTR strAscii = UnicodeToAsciiString((LPWSTR)str);2066 2067 BOOL res = DrawCaptionTempA (hwnd,2068 hdc,2069 rect,2070 hFont,2071 hIcon,2072 strAscii,2073 uFlags);2074 2075 FreeAsciiString(strAscii);2076 2077 return res;2078 }2079 2080 1828 //****************************************************************************** 2081 1829 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.
