- Load 16x16 and 32x32 icons.
authorEric Kohl <eric.kohl@reactos.org>
Tue, 29 Jun 2004 12:03:56 +0000 (12:03 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Tue, 29 Jun 2004 12:03:56 +0000 (12:03 +0000)
- Use masked image lists.
- Clean-up menu IDs.

svn path=/trunk/; revision=9924

reactos/lib/cpl/control/Makefile
reactos/lib/cpl/control/control.c
reactos/lib/cpl/control/control.rc
reactos/lib/cpl/control/resource.h

index e804c38..7a70cb4 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.1 2004/06/18 20:43:44 kuehng Exp $
+# $Id: Makefile,v 1.2 2004/06/29 12:03:56 ekohl Exp $
 
 PATH_TO_TOP = ../../..
 
@@ -10,9 +10,7 @@ TARGET_INSTALLDIR = system32
 
 TARGET_APPTYPE = windows
 
-MK_CFLAGS = -D_UNICODE -DUNICODE
-MK_CPPFLAGS = -D_UNICODE -DUNICODE
-MK_RCFLAGS = -D_UNICODE -DUNICODE
+TARGET_CFLAGS = -D_UNICODE -DUNICODE
 
 TARGET_SDKLIBS = kernel32.a user32.a comctl32.a
 
index a123954..3b35fd6 100644 (file)
@@ -17,7 +17,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: control.c,v 1.2 2004/06/28 12:05:16 ekohl Exp $
+/* $Id: control.c,v 1.3 2004/06/29 12:03:56 ekohl Exp $
  *
  * PROJECT:         ReactOS System Control Panel
  * FILE:            lib/cpl/system/control.c
@@ -86,8 +86,8 @@ void PopulateCPLList(HWND hLisCtrl)
        GetSystemDirectory(pszSearchPath,MAX_PATH);
        _tcscat(pszSearchPath,_T("\\*.cpl"));
        hFind = FindFirstFile(pszSearchPath,&fd);
-       hImgListSmall = ImageList_Create(16,16,ILC_COLOR,256,1000);
-       hImgListLarge = ImageList_Create(32,32,ILC_COLOR,256,1000);
+       hImgListSmall = ImageList_Create(16,16,ILC_COLOR | ILC_MASK,256,1000);
+       hImgListLarge = ImageList_Create(32,32,ILC_COLOR | ILC_MASK,256,1000);
        while(hFind != INVALID_HANDLE_VALUE)
        {
                CPLLISTENTRY *pEntry;
@@ -114,11 +114,13 @@ void PopulateCPLList(HWND hLisCtrl)
                                int index;
                                pEntry->pFunc(hLisCtrl,CPL_INQUIRE,0,(LPARAM)&pEntry->CPLInfo);
 
-                               hIcon = LoadIcon(pEntry->hDLL,MAKEINTRESOURCE(pEntry->CPLInfo.idIcon));
+                               hIcon = LoadImage(pEntry->hDLL,MAKEINTRESOURCE(pEntry->CPLInfo.idIcon),IMAGE_ICON,16,16,LR_DEFAULTCOLOR);
                                index = ImageList_AddIcon(hImgListSmall,hIcon);
+                               DestroyIcon(hIcon);
+                               hIcon = LoadImage(pEntry->hDLL,MAKEINTRESOURCE(pEntry->CPLInfo.idIcon),IMAGE_ICON,32,32,LR_DEFAULTCOLOR);
                                ImageList_AddIcon(hImgListLarge,hIcon);
+                               DestroyIcon(hIcon);
 
-                               
                                LoadString(pEntry->hDLL,pEntry->CPLInfo.idName,Name,MAX_PATH);
                                if(_tcslen(Name))
                                {
@@ -221,22 +223,22 @@ LRESULT CALLBACK MyWindowProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
        case WM_COMMAND:
                switch(LOWORD(wParam))
                {
-               case CM_LARGEICONS:
+               case IDM_LARGEICONS:
                        SetWindowLong(hListView,GWL_STYLE,LVS_ICON | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL   | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP);
                        break;
-               case CM_SMALLICONS:
+               case IDM_SMALLICONS:
                        SetWindowLong(hListView,GWL_STYLE,LVS_SMALLICON | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL   | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP);
                        break;
-               case CM_LIST:
+               case IDM_LIST:
                        SetWindowLong(hListView,GWL_STYLE,LVS_LIST | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL   | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP);
                        break;
-               case CM_DETAILS:
+               case IDM_DETAILS:
                        SetWindowLong(hListView,GWL_STYLE,LVS_REPORT | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL   | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP);
                        break;
-               case CM_CLOSE:
+               case IDM_CLOSE:
                        DestroyWindow(hWnd);
                        break;
-               case CM_ABOUT:
+               case IDM_ABOUT:
                        MessageBox(hWnd,_T("Simple Control Panel (not Shell-namespace based)\rCopyright 2004 GkWare e.K.\rhttp://www.gkware.com\rReleased under the GPL"),_T("About the Control Panel"),MB_OK | MB_ICONINFORMATION);
                        break;
                }
index 292af96..bc7d94e 100644 (file)
@@ -21,18 +21,18 @@ IDM_MAINMENU MENU DISCARDABLE
 BEGIN
     POPUP "&File"
     BEGIN
-        MENUITEM "&Close",                      CM_CLOSE
+        MENUITEM "&Close",                      IDM_CLOSE
     END
     POPUP "&View"
     BEGIN
-        MENUITEM "Large Icons",                 CM_LARGEICONS
-        MENUITEM "Small Icons",                 CM_SMALLICONS
-        MENUITEM "List",                        CM_LIST
-        MENUITEM "Details",                     CM_DETAILS
+        MENUITEM "Large Icons",                 IDM_LARGEICONS
+        MENUITEM "Small Icons",                 IDM_SMALLICONS
+        MENUITEM "List",                        IDM_LIST
+        MENUITEM "Details",                     IDM_DETAILS
     END
     POPUP "Help"
     BEGIN
-        MENUITEM "About",                       CM_ABOUT
+        MENUITEM "About",                       IDM_ABOUT
     END
 END
 
index 053c1da..8cce795 100644 (file)
@@ -2,25 +2,21 @@
 // Microsoft Developer Studio generated include file.
 // Used by control.rc
 //
-#define IDR_MENU1                       101
+#define IDI_MAINICON                    100
 #define IDM_MAINMENU                    101
-#define IDI_MAINICON                    104
-#define ID_VIEW_LARGEICONS              40002
-#define CM_LARGEICONS                   40002
-#define ID_VIEW_SMALLICONS              40003
-#define CM_SMALLICONS                   40003
-#define ID_HELP_ABOUT                   40007
-#define CM_ABOUT                        40007
-#define CM_CLOSE                        40008
-#define CM_LIST                         40009
-#define CM_DETAILS                      40010
+#define IDM_LARGEICONS                  40000
+#define IDM_SMALLICONS                  40001
+#define IDM_LIST                        40002
+#define IDM_DETAILS                     40003
+#define IDM_ABOUT                       40004
+#define IDM_CLOSE                       40005
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        105
-#define _APS_NEXT_COMMAND_VALUE         40011
+#define _APS_NEXT_RESOURCE_VALUE        102
+#define _APS_NEXT_COMMAND_VALUE         40006
 #define _APS_NEXT_CONTROL_VALUE         1000
 #define _APS_NEXT_SYMED_VALUE           101
 #endif