From 3bf7edc84974fecde55d2f24eaee26605f961a58 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Thu, 5 Feb 2004 19:17:11 +0000 Subject: [PATCH] added control panel template svn path=/trunk/; revision=8040 --- reactos/Makefile | 7 +- reactos/lib/cpl/Makefile | 45 ++++ reactos/lib/cpl/cplsample/.cvsignore | 8 + reactos/lib/cpl/cplsample/Makefile | 47 ++++ reactos/lib/cpl/cplsample/cplsample.c | 222 ++++++++++++++++++ reactos/lib/cpl/cplsample/cplsample.def | 6 + reactos/lib/cpl/cplsample/cplsample.edf | 6 + reactos/lib/cpl/cplsample/cplsample.h | 18 ++ reactos/lib/cpl/cplsample/cplsample.rc | 70 ++++++ reactos/lib/cpl/cplsample/resource.h | 15 ++ .../lib/cpl/cplsample/resources/cpl_icon1.ico | Bin 0 -> 1398 bytes 11 files changed, 442 insertions(+), 2 deletions(-) create mode 100644 reactos/lib/cpl/Makefile create mode 100644 reactos/lib/cpl/cplsample/.cvsignore create mode 100644 reactos/lib/cpl/cplsample/Makefile create mode 100644 reactos/lib/cpl/cplsample/cplsample.c create mode 100644 reactos/lib/cpl/cplsample/cplsample.def create mode 100644 reactos/lib/cpl/cplsample/cplsample.edf create mode 100644 reactos/lib/cpl/cplsample/cplsample.h create mode 100644 reactos/lib/cpl/cplsample/cplsample.rc create mode 100644 reactos/lib/cpl/cplsample/resource.h create mode 100644 reactos/lib/cpl/cplsample/resources/cpl_icon1.ico diff --git a/reactos/Makefile b/reactos/Makefile index 61fce00f58b..4e20a054aea 100644 --- a/reactos/Makefile +++ b/reactos/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.208 2004/02/01 21:40:59 gvg Exp $ +# $Id: Makefile,v 1.209 2004/02/05 19:17:11 weiden Exp $ # # Global makefile # @@ -37,6 +37,9 @@ LIB_STATIC = string rosrtl epsapi uuid libwine zlib # Keyboard layout libraries DLLS_KBD = kbdus kbdgr kbdfr kbduk +# Control Panels +DLLS_CPL = cpl + # User mode libraries # advapi32 cards crtdll comdlg32 fmifs gdi32 imagehlp kernel32 libpcap packet msafd msvcrt ntdll # epsapi psapi richedit rpcrt4 secur32 user32 version ws2help ws2_32 wsock32 wshirda mswsock @@ -45,7 +48,7 @@ DLLS = advapi32 cabinet cards comctl32 crtdll comdlg32 d3d8thk fmifs freetype gd imm32 iphlpapi kernel32 lzexpand mpr msafd msgina msimg32 msvcrt msvcrt20 mswsock \ ntdll ole32 oledlg packet psapi richedit rpcrt4 samlib secur32 shell32 shlwapi \ snmpapi syssetup twain unicode user32 userenv version wininet winmm winspool \ - ws2help ws2_32 wsock32 wshirda $(DLLS_KBD) + ws2help ws2_32 wsock32 wshirda $(DLLS_KBD) $(DLLS_CPL) SUBSYS = smss win32k csrss ntvdm diff --git a/reactos/lib/cpl/Makefile b/reactos/lib/cpl/Makefile new file mode 100644 index 00000000000..8974c104ca3 --- /dev/null +++ b/reactos/lib/cpl/Makefile @@ -0,0 +1,45 @@ +# +# ReactOS control panels makefile +# + +PATH_TO_TOP = ../.. + +include $(PATH_TO_TOP)/rules.mak + +CONTROL_PANELS = + +all: $(CONTROL_PANELS) + +depends: + +implib: $(CONTROL_PANELS:%=%_implib) + +clean: $(CONTROL_PANELS:%=%_clean) + +install: $(CONTROL_PANELS:%=%_install) + +.PHONY: all depends implib clean install + + +# +# Control Panels +# +$(CONTROL_PANELS): %: + $(MAKE) -C $* + +$(CONTROL_PANELS:%=%_implib): %_implib: + $(MAKE) -C $* implib + +$(CONTROL_PANELS:%=%_clean): %_clean: + $(MAKE) -C $* clean + +$(CONTROL_PANELS:%=%_install): %_install: + $(MAKE) -C $* install + +.PHONY: $(CONTROL_PANELS) $(CONTROL_PANELS:%=%_implib) $(CONTROL_PANELS:%=%_clean) $(CONTROL_PANELS:%=%_install) + + +etags: + find . -name "*.[ch]" -print | etags --language=c - + +# EOF diff --git a/reactos/lib/cpl/cplsample/.cvsignore b/reactos/lib/cpl/cplsample/.cvsignore new file mode 100644 index 00000000000..ee6046a948c --- /dev/null +++ b/reactos/lib/cpl/cplsample/.cvsignore @@ -0,0 +1,8 @@ +*.coff +*.cpl +*.d +*.a +*.o +*.sym +*.map +*.tmp diff --git a/reactos/lib/cpl/cplsample/Makefile b/reactos/lib/cpl/cplsample/Makefile new file mode 100644 index 00000000000..fdad5316c17 --- /dev/null +++ b/reactos/lib/cpl/cplsample/Makefile @@ -0,0 +1,47 @@ +# $Id: Makefile,v 1.1 2004/02/05 19:17:11 weiden Exp $ + +PATH_TO_TOP = ../../.. + +TARGET_TYPE = dynlink + +TARGET_EXTENSION = .cpl + +TARGET_NAME = cplsample + +TARGET_INSTALLDIR = system32 + +TARGET_BASE = 0x75970000 + +TARGET_CFLAGS = \ + -I./include \ + -DUNICODE \ + -D_UNICODE \ + -D__REACTOS__ \ + -Wall \ + -Werror \ + -fno-builtin + +TARGET_LFLAGS = -nostartfiles + +TARGET_SDKLIBS = kernel32.a user32.a comctl32.a + +TARGET_GCCLIBS = gcc + +TARGET_PCH = + +TARGET_CLEAN = + +TARGET_OBJECTS = cplsample.o + +DEP_OBJECTS = $(TARGET_OBJECTS) + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk + +include $(TOOLS_PATH)/depend.mk + +%/TAGS: + etags -o $(@D)/TAGS $(@D)/\*.c + +etags: ./TAGS diff --git a/reactos/lib/cpl/cplsample/cplsample.c b/reactos/lib/cpl/cplsample/cplsample.c new file mode 100644 index 00000000000..f9fd5fec49f --- /dev/null +++ b/reactos/lib/cpl/cplsample/cplsample.c @@ -0,0 +1,222 @@ +/* + * ReactOS + * Copyright (C) 2004 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id: cplsample.c,v 1.1 2004/02/05 19:17:11 weiden Exp $ + * + * PROJECT: ReactOS Sample Control Panel + * FILE: lib/cpl/cplsample/cplsample.c + * PURPOSE: ReactOS Sample Control Panel + * PROGRAMMER: Thomas Weidenmueller (w3seek@users.sourceforge.net) + * UPDATE HISTORY: + * 05-01-2004 Created + */ +#include +#include +#include "resource.h" +#include "cplsample.h" + +#define NUM_APPLETS (1) + +LONG CALLBACK Applet1(VOID); +HINSTANCE hApplet = 0; + +/* Applets */ +APPLET Applets[NUM_APPLETS] = +{ + {IDC_CPLICON_1, IDS_CPLNAME_1, IDS_CPLDESCRIPTION_1, Applet1} +}; + +static void +InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc) +{ + ZeroMemory(psp, sizeof(PROPSHEETPAGE)); + psp->dwSize = sizeof(PROPSHEETPAGE); + psp->dwFlags = PSP_DEFAULT; + psp->hInstance = hApplet; + psp->u1.pszTemplate = MAKEINTRESOURCE(idDlg); + psp->pfnDlgProc = DlgProc; +} + +/* Property page dialog callback */ +BOOL CALLBACK +Page1Proc( + HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam +) +{ + switch(uMsg) + { + case WM_INITDIALOG: + break; + } + return FALSE; +} + +/* Property page dialog callback */ +BOOL CALLBACK +Page2Proc( + HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam +) +{ + switch(uMsg) + { + case WM_INITDIALOG: + break; + } + return FALSE; +} + +/* Property page dialog callback */ +BOOL CALLBACK +Page3Proc( + HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam +) +{ + switch(uMsg) + { + case WM_INITDIALOG: + break; + } + return FALSE; +} + +/* Property Sheet Callback */ +int CALLBACK +PropSheetProc( + HWND hwndDlg, + UINT uMsg, + LPARAM lParam +) +{ + switch(uMsg) + { + case PSCB_BUTTONPRESSED: + switch(lParam) + { + case PSBTN_OK: /* OK */ + break; + case PSBTN_CANCEL: /* Cancel */ + break; + case PSBTN_APPLYNOW: /* Apply now */ + break; + case PSBTN_FINISH: /* Close */ + break; + default: + return FALSE; + } + break; + + case PSCB_INITIALIZED: + break; + } + return TRUE; +} + +/* First Applet */ + +LONG CALLBACK +Applet1(VOID) +{ + PROPSHEETPAGE psp[3]; + PROPSHEETHEADER psh; + TCHAR Caption[1024]; + + LoadString(hApplet, IDS_CPLNAME_1, Caption, sizeof(Caption) / sizeof(TCHAR)); + + ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); + psh.dwSize = sizeof(PROPSHEETHEADER); + psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK; + psh.hwndParent = NULL; + psh.hInstance = hApplet; + psh.u1.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON_1)); + psh.pszCaption = Caption; + psh.nPages = sizeof(psp) / sizeof(PROPSHEETHEADER); + psh.u2.nStartPage = 0; + psh.u3.ppsp = psp; + psh.pfnCallback = PropSheetProc; + + InitPropSheetPage(&psp[0], IDD_PROPPAGE1, Page1Proc); + InitPropSheetPage(&psp[1], IDD_PROPPAGE2, Page2Proc); + InitPropSheetPage(&psp[2], IDD_PROPPAGE3, Page3Proc); + + return (LONG)(PropertySheet(&psh) != -1); +} + +/* Control Panel Callback */ +LONG CALLBACK +CPlApplet( + HWND hwndCPl, + UINT uMsg, + LPARAM lParam1, + LPARAM lParam2) +{ + int i = (int)lParam1; + + switch(uMsg) + { + case CPL_INIT: + { + return TRUE; + } + case CPL_GETCOUNT: + { + return NUM_APPLETS; + } + case CPL_INQUIRE: + { + CPLINFO *CPlInfo = (CPLINFO*)lParam2; + CPlInfo->lData = 0; + CPlInfo->idIcon = Applets[i].idIcon; + CPlInfo->idName = Applets[i].idName; + CPlInfo->idInfo = Applets[i].idDescription; + break; + } + case CPL_DBLCLK: + { + Applets[i].AppletProc(); + break; + } + } + return FALSE; +} + + +BOOL STDCALL +DllMain( + HINSTANCE hinstDLL, + DWORD dwReason, + LPVOID lpvReserved) +{ + switch(dwReason) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + hApplet = hinstDLL; + break; + } + return TRUE; +} + diff --git a/reactos/lib/cpl/cplsample/cplsample.def b/reactos/lib/cpl/cplsample/cplsample.def new file mode 100644 index 00000000000..1ed84314984 --- /dev/null +++ b/reactos/lib/cpl/cplsample/cplsample.def @@ -0,0 +1,6 @@ +LIBRARY cplsample.cpl + +EXPORTS +CPlApplet@16 + +; EOF diff --git a/reactos/lib/cpl/cplsample/cplsample.edf b/reactos/lib/cpl/cplsample/cplsample.edf new file mode 100644 index 00000000000..47e146aa470 --- /dev/null +++ b/reactos/lib/cpl/cplsample/cplsample.edf @@ -0,0 +1,6 @@ +LIBRARY cplsample.cpl + +EXPORTS +CPlApplet=CPlApplet@16 + +; EOF diff --git a/reactos/lib/cpl/cplsample/cplsample.h b/reactos/lib/cpl/cplsample/cplsample.h new file mode 100644 index 00000000000..7e289ff404b --- /dev/null +++ b/reactos/lib/cpl/cplsample/cplsample.h @@ -0,0 +1,18 @@ +#ifndef __CPL_SAMPLE_H +#define __CPL_SAMPLE_H + +typedef LONG (CALLBACK *APPLET_PROC)(VOID); + +typedef struct +{ + int idIcon; + int idName; + int idDescription; + APPLET_PROC AppletProc; +} APPLET, *PAPPLET; + +extern HINSTANCE hApplet; + +#endif /* __CPL_SAMPLE_H */ + +/* EOF */ diff --git a/reactos/lib/cpl/cplsample/cplsample.rc b/reactos/lib/cpl/cplsample/cplsample.rc new file mode 100644 index 00000000000..c9b57fbb94a --- /dev/null +++ b/reactos/lib/cpl/cplsample/cplsample.rc @@ -0,0 +1,70 @@ +#include +#include +#include "resource.h" + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT + +VS_VERSION_INFO VERSIONINFO + FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD + PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", RES_STR_COMPANY_NAME + VALUE "FileDescription", "ReactOS Sample Control Panel\0" + VALUE "FileVersion", RES_STR_FILE_VERSION + VALUE "InternalName", "cplsample\0" + VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT + VALUE "OriginalFilename", "cplsample.cpl\0" + VALUE "ProductName", RES_STR_PRODUCT_NAME + VALUE "ProductVersion", RES_STR_PRODUCT_VERSION + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +IDC_CPLICON_1 ICON "resources/cpl_icon1.ico" + +IDD_PROPPAGE1 DIALOGEX 0, 0, 235, 156 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Property Page 1" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Property Page 1",-1,73,74,90,8 +END + +IDD_PROPPAGE2 DIALOGEX 0, 0, 235, 156 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Property Page 2" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Property Page 2",-1,73,74,90,8 +END + +IDD_PROPPAGE3 DIALOGEX 0, 0, 235, 156 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Property Page 3" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Property Page 3",-1,73,74,90,8 +END + +STRINGTABLE +BEGIN + IDS_CPLNAME_1 "Sample Control Panel" + IDS_CPLDESCRIPTION_1 "This is a sample control panel." +END diff --git a/reactos/lib/cpl/cplsample/resource.h b/reactos/lib/cpl/cplsample/resource.h new file mode 100644 index 00000000000..bf0cd213f79 --- /dev/null +++ b/reactos/lib/cpl/cplsample/resource.h @@ -0,0 +1,15 @@ +#ifndef __CPL_RESOURCE_H +#define __CPL_RESOURCE_H + +#define IDC_CPLICON_1 1 + +#define IDD_PROPPAGE1 100 +#define IDD_PROPPAGE2 101 +#define IDD_PROPPAGE3 102 + +#define IDS_CPLNAME_1 1001 +#define IDS_CPLDESCRIPTION_1 2001 + +#endif /* __CPL_RESOURCE_H */ + +/* EOF */ diff --git a/reactos/lib/cpl/cplsample/resources/cpl_icon1.ico b/reactos/lib/cpl/cplsample/resources/cpl_icon1.ico new file mode 100644 index 0000000000000000000000000000000000000000..3eae16df58c7f5b9a6b80827d788f7416afccbda GIT binary patch literal 1398 zcmds1v2MaJ5Pcy?>6oosVPx#onJ?g5x|yL8-r%#mb?JxX50cHi7sup4K?uN%Pj@Bxs|$P2s|z*`B_b@H#sH*;X6HIy|)ae`;;G(4U3c%KwU zng}6K%Mtq*G0LLw(UgYY#`a*~ft@q>4}8aK8_?=J=D_=@^L_oC@Gbu>Zm!E|ecnu( z+`8Q-9);RO1DVO`5*Ex${7*rzT$k>q>YY}5t123;JHup-7leVI7nk`P|W&Ys_ z_r*N>-jMqObGQP}oF-9>st~smS_|yFs$V?oA+Ep34wa~LO!6G5 MKQVRI!ab7Xj@&-27XSbN literal 0 HcmV?d00001