added control panel template

svn path=/trunk/; revision=8040
This commit is contained in:
Thomas Bluemel 2004-02-05 19:17:11 +00:00
parent 1b0cdbf59c
commit 3bf7edc849
11 changed files with 442 additions and 2 deletions

View file

@ -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

45
reactos/lib/cpl/Makefile Normal file
View file

@ -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

View file

@ -0,0 +1,8 @@
*.coff
*.cpl
*.d
*.a
*.o
*.sym
*.map
*.tmp

View file

@ -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

View file

@ -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 <windows.h>
#include <stdlib.h>
#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;
}

View file

@ -0,0 +1,6 @@
LIBRARY cplsample.cpl
EXPORTS
CPlApplet@16
; EOF

View file

@ -0,0 +1,6 @@
LIBRARY cplsample.cpl
EXPORTS
CPlApplet=CPlApplet@16
; EOF

View file

@ -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 */

View file

@ -0,0 +1,70 @@
#include <reactos/resource.h>
#include <defines.h>
#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

View file

@ -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 */

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB