ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

theme_listbox.c
Go to the documentation of this file.
00001 /*
00002  * Theming - List box control
00003  *
00004  * Copyright (c) 2005 by Frank Richter
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00019  *
00020  */
00021 
00022 #include <stdarg.h>
00023 #include <string.h>
00024 #include <stdlib.h>
00025 
00026 #include "windef.h"
00027 #include "winbase.h"
00028 #include "wingdi.h"
00029 #include "winuser.h"
00030 #include "uxtheme.h"
00031 #include "vssym32.h"
00032 #include "comctl32.h"
00033 #include "wine/debug.h"
00034 
00035 /* Draw themed border */
00036 static void nc_paint (HTHEME theme, HWND hwnd, HRGN region)
00037 {
00038     HRGN cliprgn = region;
00039     DWORD exStyle = GetWindowLongW (hwnd, GWL_EXSTYLE);
00040     if (exStyle & WS_EX_CLIENTEDGE)
00041     {
00042         HDC dc;
00043         RECT r;
00044         int cxEdge = GetSystemMetrics (SM_CXEDGE),
00045             cyEdge = GetSystemMetrics (SM_CYEDGE);
00046     
00047         GetWindowRect(hwnd, &r);
00048     
00049         /* New clipping region passed to default proc to exclude border */
00050         cliprgn = CreateRectRgn (r.left + cxEdge, r.top + cyEdge,
00051             r.right - cxEdge, r.bottom - cyEdge);
00052         if (region != (HRGN)1)
00053             CombineRgn (cliprgn, cliprgn, region, RGN_AND);
00054         OffsetRect(&r, -r.left, -r.top);
00055     
00056         dc = GetDCEx(hwnd, region, DCX_WINDOW|DCX_INTERSECTRGN);
00057         OffsetRect(&r, -r.left, -r.top);
00058     
00059         if (IsThemeBackgroundPartiallyTransparent (theme, 0, 0))
00060             DrawThemeParentBackground(hwnd, dc, &r);
00061         DrawThemeBackground (theme, dc, 0, 0, &r, 0);
00062         ReleaseDC(hwnd, dc);
00063     }
00064 
00065     /* Call default proc to get the scrollbars etc. painted */
00066     DefWindowProcW (hwnd, WM_NCPAINT, (WPARAM)cliprgn, 0);
00067 }
00068 
00069 /**********************************************************************
00070  * The list control subclass window proc.
00071  */
00072 LRESULT CALLBACK THEMING_ListBoxSubclassProc (HWND hwnd, UINT msg, 
00073                                               WPARAM wParam, LPARAM lParam, 
00074                                               ULONG_PTR dwRefData)
00075 {
00076     const WCHAR* themeClass = WC_LISTBOXW;
00077     HTHEME theme;
00078     LRESULT result;
00079       
00080     switch (msg)
00081     {
00082     case WM_CREATE:
00083         result = THEMING_CallOriginalClass  (hwnd, msg, wParam, lParam);
00084         OpenThemeData( hwnd, themeClass );
00085         return result;
00086     
00087     case WM_DESTROY:
00088         theme = GetWindowTheme( hwnd );
00089         CloseThemeData ( theme );
00090         return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
00091 
00092     case WM_THEMECHANGED:
00093         theme = GetWindowTheme( hwnd );
00094         CloseThemeData ( theme );
00095         OpenThemeData( hwnd, themeClass );
00096         break;
00097         
00098     case WM_SYSCOLORCHANGE:
00099         theme = GetWindowTheme( hwnd );
00100     if (!theme) return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
00101         /* Do nothing. When themed, a WM_THEMECHANGED will be received, too,
00102      * which will do the repaint. */
00103         break;
00104         
00105     case WM_NCPAINT:
00106         theme = GetWindowTheme( hwnd );
00107         if (!theme) return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
00108         nc_paint (theme, hwnd, (HRGN)wParam);
00109         break;
00110 
00111     default: 
00112     /* Call old proc */
00113     return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
00114     }
00115     return 0;
00116 }

Generated on Fri May 25 2012 04:21:01 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.