From 0fde8587d7c53848c17b3e49b424bd59c0df2b85 Mon Sep 17 00:00:00 2001 From: diafero Date: Tue, 2 Aug 2011 17:28:20 +0200 Subject: [PATCH] remove unused code that was possibly incorrectly licensed by Cyan --- Sources/Plasma/PubUtilLib/CMakeLists.txt | 2 - .../PubUtilLib/plWinStrBlock/strblock.c | 691 ------------------ .../PubUtilLib/plWinStrBlock/strblock.h | 244 ------- .../Plasma/PubUtilLib/plWndCtrls/basewnd.cpp | 109 --- .../Plasma/PubUtilLib/plWndCtrls/basewnd.h | 58 -- .../Plasma/PubUtilLib/plWndCtrls/plButton.h | 93 --- .../Plasma/PubUtilLib/plWndCtrls/plCheckBox.h | 85 --- .../Plasma/PubUtilLib/plWndCtrls/plComboBox.h | 213 ------ .../Plasma/PubUtilLib/plWndCtrls/plControl.h | 95 --- .../Plasma/PubUtilLib/plWndCtrls/plDialog.h | 135 ---- Sources/Plasma/PubUtilLib/plWndCtrls/plEdit.h | 146 ---- .../Plasma/PubUtilLib/plWndCtrls/plLabel.h | 59 -- .../Plasma/PubUtilLib/plWndCtrls/plListBox.h | 236 ------ .../PubUtilLib/plWndCtrls/plProgressBar.h | 90 --- .../PubUtilLib/plWndCtrls/plRadioButton.h | 81 -- .../PubUtilLib/plWndCtrls/plStatusBar.h | 68 -- .../Plasma/PubUtilLib/plWndCtrls/plTrackBar.h | 102 --- .../Plasma/PubUtilLib/plWndCtrls/plWindow.h | 661 ----------------- .../PubUtilLib/plWndCtrls/plWndCtrls.cpp | 91 --- .../Plasma/PubUtilLib/plWndCtrls/plWndCtrls.h | 307 -------- .../Plasma/PubUtilLib/plWndCtrls/webhost.cpp | 495 ------------- .../Plasma/PubUtilLib/plWndCtrls/webhost.h | 168 ----- 22 files changed, 4229 deletions(-) delete mode 100644 Sources/Plasma/PubUtilLib/plWinStrBlock/strblock.c delete mode 100644 Sources/Plasma/PubUtilLib/plWinStrBlock/strblock.h delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/basewnd.cpp delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/basewnd.h delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/plButton.h delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/plCheckBox.h delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/plComboBox.h delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/plControl.h delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/plDialog.h delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/plEdit.h delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/plLabel.h delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/plListBox.h delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/plProgressBar.h delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/plRadioButton.h delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/plStatusBar.h delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/plTrackBar.h delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/plWindow.h delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/plWndCtrls.cpp delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/plWndCtrls.h delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/webhost.cpp delete mode 100644 Sources/Plasma/PubUtilLib/plWndCtrls/webhost.h diff --git a/Sources/Plasma/PubUtilLib/CMakeLists.txt b/Sources/Plasma/PubUtilLib/CMakeLists.txt index 7bea08db..97fe4c29 100644 --- a/Sources/Plasma/PubUtilLib/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/CMakeLists.txt @@ -50,5 +50,3 @@ add_subdirectory(plTransform) add_subdirectory(plUnifiedTime) add_subdirectory(plUUID) add_subdirectory(plVault) -#add_subdirectory(plWinStrBlock) # Not being used by any current slns -#add_subdirectory(plWndCtrls) # Not being used by any current slns diff --git a/Sources/Plasma/PubUtilLib/plWinStrBlock/strblock.c b/Sources/Plasma/PubUtilLib/plWinStrBlock/strblock.c deleted file mode 100644 index 195c0d10..00000000 --- a/Sources/Plasma/PubUtilLib/plWinStrBlock/strblock.c +++ /dev/null @@ -1,691 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/************************************************************************** - THIS CODE AND INFORMATION IS PROVIDED 'AS IS' WITHOUT WARRANTY OF - ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A - PARTICULAR PURPOSE. - - Copyright 1998 Microsoft Corporation. All Rights Reserved. -**************************************************************************/ - -/************************************************************************** - - File: strblock.c - - Description: Implements the functions that manipulate a string block. - -**************************************************************************/ - -#include -#include "strblock.h" - - -// The format of string resources is explained below. -// -// The smallest granularity of string resource that can be loaded/updated is a block. -// Each block is identified by an ID, starting with 1. You need to use the block ID -// when calling FindResource(), LoadResource(), UpdateResource(). -// -// A string with ID, nStringID, is in the block with ID, nBlockID, given by the following -// formula: -// nBlockID = (nStringID / 16) + 1; // Note integer division. -// -// A block of string resource is laid out as follows: -// Each block has NO_OF_STRINGS_PER_BLOCK (= 16) strings. Each string is represented as -// an ordered pair, (LENGTH, TEXT). The LENGTH is a WORD that specifies the size, in terms -// of number of characters, of the string that follows. TEXT follows the LENGTH and is -// a sequence of UNICODE characters, NOT terminated by a NULL character.Any TEXT may be of -// zero-length, in which case, LENGTH is zero. -// -// An executable does not have a string table block with ID, nBlockID, if it does not have any -// strings with IDs - ((nBlockID - 1) * 16) thru' ((nBlockID * 16) - 1). -// -// This format is the same for Windows NT, Windows 95 & Windows 98. Yes, strings in a resource -// are internally stored in UNICODE format even in Windows 95 & Windows 98. - - -// Internal data structure format for a string block. -// Our block of strings has as an array of UNICODE string pointers. - -typedef struct tagSTRINGBLOCK -{ - UINT nBlockID; // The ID of the block. - WORD wLangID; // The language ID. - LPWSTR strArray[NO_OF_STRINGS_PER_BLOCK]; // We maintain the strings - // internally in UNICODE. -} STRINGBLOCK, * PSTRINGBLOCK; - - -// A thread-specific error number for the last block operation. -__declspec(thread) STRBLOCKERR g_strBlockErr = STRBLOCKERR_OK; - -// Set the error code. -void SetBlockError( STRBLOCKERR err ) { g_strBlockErr = err; } - - -// Forward declarations. - -// Create a string block & return the pointer to the block. Return NULL on failure. -// Sets the error code. -PSTRINGBLOCK CreateBlock( HINSTANCE hInstLib, UINT nBlockID, WORD wLangID ); - -// Parse the string block resource pointed at by, pParse, and fill the strings in pStrBlock. -BOOL ParseRes( LPVOID pRes, PSTRINGBLOCK pStrBlock ); - -// Get the size of the raw string block resource in the given block. -DWORD GetResSize( PSTRINGBLOCK pStrBlock ); - -// Update a block of string in the specified library. -// hUpdate specifies the update-file handle. This handle is returned by the BeginUpdateResource. -// pStrBlock contains the new strings. -// nBlockID specifies the ID of the block. Use the same block ID as of pStrBlock if this value is -1. -// wlangID specifies the language ID of the block. Use the same language ID as of pStrBlock, if this value is 0. -// Returns TRUE on success and FALSE on failure. -// Sets the error code. -BOOL UpdateBlock( HANDLE hUpdate, PSTRINGBLOCK pStrBlock, int nBlockID, WORD wLangID ); - -// Use the strings in the block, pStrBloc, and build a buffer whose format matches that of the -// string resource block that can be used to update string resource. -// pRes points to a buffer that gets filled. It must be large enough to hold the entire block. -// To figure out the size needed, call GetResSize(). -VOID BuildRes( PSTRINGBLOCK pStrBlock, LPVOID pRes ); - - -// Create a string block. - -HSTRBLOCK WINAPI GetStringBlockA( LPCSTR strAppName, UINT nBlockID, WORD wLangID ) -{ - PSTRINGBLOCK pStrBlock = NULL; - HINSTANCE hInstLib = NULL; - - hInstLib = LoadLibraryExA( - strAppName, - NULL, - DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE - ); - - if( NULL == hInstLib ) - { - SetBlockError(STRBLOCKERR_APPLOADFAILED); - return NULL; - } - - // Create the block of strings. - pStrBlock = CreateBlock(hInstLib, nBlockID, wLangID); - - // Free the library. - FreeLibrary(hInstLib); - - if( pStrBlock ) - SetBlockError(STRBLOCKERR_OK); - - return (HSTRBLOCK)pStrBlock; -} - - -// Create a string block. - -HSTRBLOCK WINAPI GetStringBlockW( LPCWSTR strAppName, UINT nBlockID, WORD wLangID ) -{ - PSTRINGBLOCK pStrBlock = NULL; - HINSTANCE hInstLib = NULL; - - hInstLib = LoadLibraryExW( - strAppName, - NULL, - DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE - ); - - if( NULL == hInstLib ) - { - SetBlockError(STRBLOCKERR_APPLOADFAILED); - return NULL; - } - - // Create the block of strings. - pStrBlock = CreateBlock(hInstLib, nBlockID, wLangID); - - // Free the library. - FreeLibrary(hInstLib); - - if( pStrBlock ) - SetBlockError(STRBLOCKERR_OK); - - return (HSTRBLOCK)pStrBlock; -} - - -BOOL WINAPI DeleteStringBlock( HSTRBLOCK hStrBlock ) -{ - PSTRINGBLOCK pStrBlock = (PSTRINGBLOCK)hStrBlock; - int i; - - if( NULL == pStrBlock ) - { - SetBlockError(STRBLOCKERR_INVALIDBLOCK); - return FALSE; - } - - for( i = 0; i < NO_OF_STRINGS_PER_BLOCK; i++ ) - { - if( pStrBlock->strArray[i] ) - free(pStrBlock->strArray[i]); - } - free( pStrBlock); - - SetBlockError(STRBLOCKERR_OK); - - return TRUE; -} - - -int WINAPI GetStringLength( HSTRBLOCK hStrBlock, UINT nIndex ) -{ - int nLen; - PSTRINGBLOCK pStrBlock = (PSTRINGBLOCK)hStrBlock; - - if( NULL == pStrBlock ) - { - SetBlockError(STRBLOCKERR_INVALIDBLOCK); - return -1; - } - if( (nIndex < 0) || (nIndex >= NO_OF_STRINGS_PER_BLOCK) ) - { - SetBlockError(STRBLOCKERR_INVALIDINDEX); - return -1; - } - - nLen = wcslen(pStrBlock->strArray[nIndex]); - SetBlockError(STRBLOCKERR_OK); - - return nLen; -} - - -BOOL WINAPI GetStringA( HSTRBLOCK hStrBlock, UINT nIndex, LPSTR pszText ) -{ - PSTRINGBLOCK pStrBlock = (PSTRINGBLOCK)hStrBlock; - - if( NULL == pStrBlock ) - { - SetBlockError(STRBLOCKERR_INVALIDBLOCK); - return FALSE; - } - if( (nIndex < 0) || (nIndex >= NO_OF_STRINGS_PER_BLOCK) ) - { - SetBlockError(STRBLOCKERR_INVALIDINDEX); - return FALSE; - } - if( NULL == pszText ) - { - SetBlockError(STRBLOCKERR_STRINVALID); - return FALSE; - } - - if( !WideCharToMultiByte(CP_ACP, 0, pStrBlock->strArray[nIndex], -1, pszText, - wcslen(pStrBlock->strArray[nIndex]) + 1, NULL, NULL) ) - { - SetBlockError(STRBLOCKERR_UNKNOWN); - return FALSE; - } - - SetBlockError(STRBLOCKERR_OK); - - return TRUE; -} - - -BOOL WINAPI GetStringW( HSTRBLOCK hStrBlock, UINT nIndex, LPWSTR pszText ) -{ - PSTRINGBLOCK pStrBlock = (PSTRINGBLOCK)hStrBlock; - - if( NULL == pStrBlock ) - { - SetBlockError(STRBLOCKERR_INVALIDBLOCK); - return FALSE; - } - if( (nIndex < 0) || (nIndex >= NO_OF_STRINGS_PER_BLOCK) ) - { - SetBlockError(STRBLOCKERR_INVALIDINDEX); - return FALSE; - } - if( NULL == pszText ) - { - SetBlockError(STRBLOCKERR_STRINVALID); - return FALSE; - } - - wcscpy(pszText, pStrBlock->strArray[nIndex]); - SetBlockError(STRBLOCKERR_OK); - - return TRUE; -} - - -BOOL WINAPI SetStringA( HSTRBLOCK hStrBlock, UINT nIndex, LPCSTR pszText ) -{ - PSTRINGBLOCK pStrBlock = (PSTRINGBLOCK)hStrBlock; - int nLen; - - if( NULL == pStrBlock ) - { - SetBlockError(STRBLOCKERR_INVALIDBLOCK); - return FALSE; - } - if( (nIndex < 0) || (nIndex >= NO_OF_STRINGS_PER_BLOCK) ) - { - SetBlockError(STRBLOCKERR_INVALIDINDEX); - return FALSE; - } - - // Delete the current string & reallocate a new one.. - free(pStrBlock->strArray[nIndex]); - - nLen = strlen(pszText) + 1; - pStrBlock->strArray[nIndex] = (LPWSTR)malloc( sizeof(WCHAR) * nLen); - - if( NULL == pStrBlock->strArray[nIndex] ) - { - SetBlockError(STRBLOCKERR_NOMEMORY); - return FALSE; - } - - if( !MultiByteToWideChar(CP_ACP, 0, pszText, -1, pStrBlock->strArray[nIndex], nLen) ) - { - SetBlockError(STRBLOCKERR_UNKNOWN); - return FALSE; - } - - SetBlockError(STRBLOCKERR_OK); - - return TRUE; -} - - -BOOL WINAPI SetStringW( HSTRBLOCK hStrBlock, UINT nIndex, LPCWSTR pszText ) -{ - PSTRINGBLOCK pStrBlock = (PSTRINGBLOCK)hStrBlock; - int nLen; - - if( NULL == pStrBlock ) - { - SetBlockError(STRBLOCKERR_INVALIDBLOCK); - return FALSE; - } - if( (nIndex < 0) || (nIndex >= NO_OF_STRINGS_PER_BLOCK) ) - { - SetBlockError(STRBLOCKERR_INVALIDINDEX); - return FALSE; - } - - // Delete the current string & reallocate a new one.. - free(pStrBlock->strArray[nIndex]); - nLen = wcslen(pszText) + 1; - - pStrBlock->strArray[nIndex] = (LPWSTR)malloc( sizeof(WCHAR) * nLen); - - if( NULL == pStrBlock->strArray[nIndex] ) - { - SetBlockError(STRBLOCKERR_NOMEMORY); - return FALSE; - } - - wcscpy(pStrBlock->strArray[nIndex], pszText); - SetBlockError(STRBLOCKERR_OK); - - return TRUE; -} - - -int WINAPI GetFirstStringID( HSTRBLOCK hStrBlock ) -{ - PSTRINGBLOCK pStrBlock = (PSTRINGBLOCK)hStrBlock; - - if( NULL == pStrBlock ) - { - SetBlockError(STRBLOCKERR_INVALIDBLOCK); - return -1; - } - SetBlockError(STRBLOCKERR_OK); - - return (pStrBlock->nBlockID - 1) * NO_OF_STRINGS_PER_BLOCK; -} - - -int WINAPI GetBlockID( HSTRBLOCK hStrBlock ) -{ - PSTRINGBLOCK pStrBlock = (PSTRINGBLOCK)hStrBlock; - - if( NULL == pStrBlock ) - { - SetBlockError(STRBLOCKERR_INVALIDBLOCK); - return -1; - } - SetBlockError(STRBLOCKERR_OK); - - return pStrBlock->nBlockID; -} - - -WORD WINAPI GetBlockLanguage( HSTRBLOCK hStrBlock ) -{ - PSTRINGBLOCK pStrBlock = (PSTRINGBLOCK)hStrBlock; - - if( NULL == pStrBlock ) - { - SetBlockError(STRBLOCKERR_INVALIDBLOCK); - return -1; - } - - SetBlockError(STRBLOCKERR_OK); - return pStrBlock->wLangID; -} - - -BOOL WINAPI UpdateStringBlockA( LPCSTR strAppName, HSTRBLOCK hStrBlock, int nBlockID, WORD wLangID ) -{ - HANDLE hUpdate; - PSTRINGBLOCK pStrBlock = (PSTRINGBLOCK)hStrBlock; - - if( NULL == pStrBlock ) - { - SetBlockError(STRBLOCKERR_INVALIDBLOCK); - return -1; - } - - hUpdate = BeginUpdateResourceA(strAppName, FALSE); - - if( NULL == hUpdate ) - { - DWORD dwError = GetLastError(); - - switch( dwError ) - { - case ERROR_CALL_NOT_IMPLEMENTED: - - SetBlockError(STRBLOCKERR_UPDATENOTIMPLEMENTED); - break; - - default: - - SetBlockError(STRBLOCKERR_UPDATEFAILED); - break; - } - - return FALSE; - } - - // Update the resource. - if( !UpdateBlock(hUpdate, pStrBlock, nBlockID, wLangID) ) - { - EndUpdateResource(hUpdate, FALSE); - return FALSE; - } - - if( !EndUpdateResource(hUpdate, FALSE) ) - { - SetBlockError(STRBLOCKERR_UPDATEFAILED); - return FALSE; - } - - SetBlockError(STRBLOCKERR_OK); - - return TRUE; -} - - -BOOL WINAPI UpdateStringBlockW( LPCWSTR strAppName, HSTRBLOCK hStrBlock, int nBlockID, WORD wLangID ) -{ - HANDLE hUpdate; - PSTRINGBLOCK pStrBlock = (PSTRINGBLOCK)hStrBlock; - - if( NULL == pStrBlock ) - { - SetBlockError(STRBLOCKERR_INVALIDBLOCK); - return -1; - } - - hUpdate = BeginUpdateResourceW(strAppName, FALSE); - - if( NULL == hUpdate ) - { - DWORD dwError = GetLastError(); - - switch( dwError ) - { - case ERROR_CALL_NOT_IMPLEMENTED: - - SetBlockError(STRBLOCKERR_UPDATENOTIMPLEMENTED); - break; - - default: - - SetBlockError(STRBLOCKERR_UPDATEFAILED); - break; - } - - return FALSE; - } - - // Update the resource. - if( !UpdateBlock(hUpdate, pStrBlock, nBlockID, wLangID) ) - { - EndUpdateResource(hUpdate, FALSE); - return FALSE; - } - - if( !EndUpdateResource(hUpdate, FALSE) ) - { - SetBlockError(STRBLOCKERR_UPDATEFAILED); - return FALSE; - } - - SetBlockError(STRBLOCKERR_OK); - - return TRUE; -} - - -STRBLOCKERR WINAPI GetStringBlockError() -{ - return g_strBlockErr; -} - - -// Create a string block & return the pointer to the block. Return NULL on failure. - -PSTRINGBLOCK CreateBlock( HINSTANCE hInstLib, UINT nBlockID, WORD wLangID ) -{ - PSTRINGBLOCK pStrBlock; - HRSRC hFindRes; - HGLOBAL hLoadRes; - LPVOID pRes; - - hFindRes = FindResourceEx(hInstLib, RT_STRING, MAKEINTRESOURCE(nBlockID), wLangID); - if( NULL == hFindRes ) - { - SetBlockError(STRBLOCKERR_RESNOTFOUND); - return NULL; - } - - hLoadRes = LoadResource(hInstLib, hFindRes); - if( NULL == hLoadRes ) - { - SetBlockError(STRBLOCKERR_LOADRESFAILED); - return NULL; - } - - pRes = LockResource(hLoadRes); - if( NULL == pRes ) - { - SetBlockError(STRBLOCKERR_LOADRESFAILED); - return NULL; - } - - // Create a new string block, fill the strings based on the resource contents. - pStrBlock = (PSTRINGBLOCK)malloc(sizeof(STRINGBLOCK)); - if( NULL == pStrBlock ) - { - SetBlockError(STRBLOCKERR_NOMEMORY); - return NULL; - } - - pStrBlock->nBlockID = nBlockID; - pStrBlock->wLangID = wLangID; - - if( !ParseRes(pRes, pStrBlock) ) - { - free(pStrBlock); - return NULL; - } - - return pStrBlock; -} - - -// Parse the raw string resource, pRes, and build up the string block, pStrBlock. -// The parsing illustrates the format of a string block in an executable. - -BOOL ParseRes( LPVOID pRes, PSTRINGBLOCK pStrBlock ) -{ - int i, j; - int nLen; - WCHAR* pParse = (WCHAR *)pRes; - - // There are NO_OF_STRINGS_PER_BLOCK(=16) strings per block. - for( i = 0; i < NO_OF_STRINGS_PER_BLOCK; i++ ) - { - nLen = (int)*pParse++; // The length of the string. - pStrBlock->strArray[i] = (LPWSTR)malloc((nLen + 1) * sizeof(WCHAR)); - - if( NULL == pStrBlock->strArray[i] ) - { - int k; - - for( k = 0; k < i; k++ ) // Free up the memory allocated so far. - free(pStrBlock->strArray[k]); - SetBlockError(STRBLOCKERR_NOMEMORY); - - return FALSE; - } - - for( j = 0; j < nLen; j++ ) // Copy the string. - pStrBlock->strArray[i][j] = *pParse++; - pStrBlock->strArray[i][j] = 0; - } - - SetBlockError(STRBLOCKERR_OK); - return TRUE; -} - - -DWORD GetResSize( PSTRINGBLOCK pStrBlock ) -{ - DWORD dwResSize = 0; - int i = 0; - - for( i = 0; i < NO_OF_STRINGS_PER_BLOCK; i++ ) - dwResSize += (wcslen(pStrBlock->strArray[i]) + 1); - - return dwResSize * sizeof(WCHAR); -} - - -// Build a raw resource block, pRes, based on our string block, pStrBlock. -// The raw resource block may be used to update a string resource. - -VOID BuildRes( PSTRINGBLOCK pStrBlock, LPVOID pRes ) -{ - int i, j; - int nLen; - WCHAR* pParse = (WCHAR *)pRes; - - // There are NO_OF_STRINGS_PER_BLOCK (= 16) strings per block. - for( i = 0; i < NO_OF_STRINGS_PER_BLOCK; i++ ) - { - *pParse++ = nLen = wcslen(pStrBlock->strArray[i]); - for( j = 0; j < nLen; j++ ) - *pParse++ = pStrBlock->strArray[i][j]; - } -} - - -BOOL UpdateBlock( HANDLE hUpdate, PSTRINGBLOCK pStrBlock, int nBlockID, WORD wLangID ) -{ - DWORD dwResSize; - LPVOID pRes; - DWORD dwRet = 0; - WORD wLanguageID = (0 == wLangID) ? pStrBlock->wLangID : wLangID; - - // Get the resource length as required by a raw string resource block. - dwResSize = GetResSize(pStrBlock); - pRes = malloc(dwResSize); - if( NULL == pRes ) - { - SetBlockError(STRBLOCKERR_NOMEMORY); - return FALSE; - } - - BuildRes(pStrBlock, pRes); - - if( !UpdateResource( - hUpdate, - RT_STRING, - MAKEINTRESOURCE(((-1 == nBlockID) ? pStrBlock->nBlockID : nBlockID)), - wLanguageID, - pRes, - dwResSize - ) ) - { - DWORD dwError = GetLastError(); - - switch( dwError ) - { - case ERROR_CALL_NOT_IMPLEMENTED: - - SetBlockError(STRBLOCKERR_UPDATENOTIMPLEMENTED); - break; - - default: - - SetBlockError(STRBLOCKERR_UPDATEFAILED); - break; - } - - free(pRes); - return FALSE; - } - - free(pRes); - - SetBlockError(STRBLOCKERR_OK); - - return TRUE; -} - - - diff --git a/Sources/Plasma/PubUtilLib/plWinStrBlock/strblock.h b/Sources/Plasma/PubUtilLib/plWinStrBlock/strblock.h deleted file mode 100644 index ec6eb0e8..00000000 --- a/Sources/Plasma/PubUtilLib/plWinStrBlock/strblock.h +++ /dev/null @@ -1,244 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/************************************************************************** - THIS CODE AND INFORMATION IS PROVIDED 'AS IS' WITHOUT WARRANTY OF - ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A - PARTICULAR PURPOSE. - - Copyright 1998 Microsoft Corporation. All Rights Reserved. -**************************************************************************/ - -/************************************************************************** - - File: strblock.h - - Description: Programmer's interface to manipulate a block of string - resources. It defines an API with functions to Create, - Access, Modify & Destroy a string block. - -**************************************************************************/ - -#ifndef _STRBLOCK_H -#define _STRBLOCK_H - -#include - -// The number of strings in a block. The string resource is internally -// stored as blocks of NO_OF_STRINGS_PER_BLOCK ( = 16) strings. A block -// is the smallest granularity for manipulating a string resource. -#define NO_OF_STRINGS_PER_BLOCK 16 - -// Error codes for operations on a string block. -typedef enum { - STRBLOCKERR_OK, // The last operation was successful. - STRBLOCKERR_NOMEMORY, // The last operation on the block failed due to inadequate memory. - STRBLOCKERR_INVALIDINDEX, // The index passed was incorrect. - STRBLOCKERR_UPDATEFAILED, // The specified app could not be updated. - STRBLOCKERR_APPLOADFAILED, // The specified app could not be loaded. - STRBLOCKERR_RESNOTFOUND, // The specified resource could not be located. - STRBLOCKERR_LOADRESFAILED, // The specified resource could not be loaded. - STRBLOCKERR_INVALIDBLOCK, // The specified block handle is invalid. - STRBLOCKERR_STRINVALID, // The string pointer passed was invalid. - STRBLOCKERR_UPDATENOTIMPLEMENTED, // UpdateResource not implemented. - STRBLOCKERR_UNKNOWN // An unspecified error. -} STRBLOCKERR; - - -// Handle to a block of string. We hide the internal format we use for manipulating -// a string resource by providing access to it through a handle. - -DECLARE_HANDLE(HSTRBLOCK); - - -// Methods to access a string block. - -// Function: HSTRBLOCK WINAPI GetStringBlockA( LPCSTR strAppName, UINT nBlockID, -// WORD wLangID ); -// Purpose: Get the block of string with the specified ID & language from the -// specified application (ANSI version). -// LPCSTR strAppName: The name of the application. -// UINT nBlockID: The ID of the block. -// WORD wLangID: The language identifier. You can create a language -// identifier using the macro, MAKELANGID. -// Returns: Handle to a string block if successful, NULL otherwise. -// Comments: This function creates a string block. Call DeleteStringBlock() -// when you no longer need the block. -HSTRBLOCK WINAPI GetStringBlockA( LPCSTR strAppName, UINT nBlockID, WORD wLangID ); - - -// Function: HSTRBLOCK WINAPI GetStringBlockW( LPCWSTR strAppName, UINT nBlockID, -// WORD wLangID ); -// Purpose: Get the block of string with the specified ID & language from the -// specified application (UNICODE version). -// LPCWSTR strAppName: The name of the application. -// UINT nBlockID: The ID of the block. -// WORD wLangID: The language identifier. You can create a language -// identifier using the macro, MAKELANGID. -// Returns: Handle to a string block if successful, NULL otherwise. -// Comments: This function creates a string block. Call DeleteStringBlock() -// when you no longer need the block. -HSTRBLOCK WINAPI GetStringBlockW( LPCWSTR strAppName, UINT nBlockID, WORD wLangID ); - - -// Function: BOOL WINAPI DeleteStringBlock( HSTRBLOCK hStrBlock ); -// Purpose: Delete a block of string. -// HSTRBLOCK hStrBlock: The handle to the block. -// Returns: TRUE if successful, FALSE on failure. -// Comments: Call this function when you no longer need a block. Calling this function -// frees the memory occupied by the block. Failure to delete a block -// results in memory leaks. -BOOL WINAPI DeleteStringBlock( HSTRBLOCK hStrBlock ); - - -// Function: int WINAPI GetStringLength( HSTRBLOCK hStrBlock, UINT nIndex ); -// Purpose: Get the length of a string in the block. -// HSTRBLOCK hStrBlock: The handle to the string block. -// UINT nIndex: The zero-based index of the string in the block. The index can be -// any value from 0 thru' (NO_OF_STRINGS_PER_BLOCK - 1). -// Returns: If successful, the string length in number of characters, excluding the terminating -// NULL character; -1 if the function fails. -// Comments: Call this function to get the string length before calling GetString. -int WINAPI GetStringLength( HSTRBLOCK hStrBlock, UINT nIndex ); - - -// Function: BOOL WINAPI GetStringA( HSTRBLOCK hStrBlock, UINT nIndex, LPSTR pszStr ); -// Purpose: Get the string at the specified index in the block (ANSI version). -// HSTRBLOCK hStrBlock: The handle to the string block. -// UINT nIndex: The zero-based index of the string in the block. The index can be a value -// from 0 through (NO_OF_STRINGS_PER_BLOCK - 1). -// LPSTR pszStr: The pointer to the memory to which the string requested will be copied. -// This memory should be large enough to contain the string. -// Returns: TRUE on success, FALSE otherwise. -// Comments: Before calling this function, call GetStringLength() to get the string length. -BOOL WINAPI GetStringA( HSTRBLOCK hStrBlock, UINT nIndex, LPSTR pszStr ); - - -// Function: BOOL WINAPI GetStringW( HSTRBLOCK hStrBlock, UINT nIndex, LPWSTR pszStr ); -// Purpose: Get the string at the specified index in the block (UNICODE version). -// HSTRBLOCK hStrBlock: The handle to the string block. -// UINT nIndex: The zero-based index of the string in the block. The index can be a value -// from 0 through (NO_OF_STRINGS_PER_BLOCK - 1). -// LPSTR pszStr: The pointer to the memory to which the string requested will be copied. -// This memory should be large enough to contain the string. -// Returns: TRUE on success, FALSE otherwise. -// Comments: Before calling this function, call GetStringLength() to get the string length. -BOOL WINAPI GetStringW( HSTRBLOCK hStrBlock, UINT nIndex, LPWSTR pszStr ); - - -// Function: BOOL WINAPI SetStringA( HSTRBLOCK hStrBlock, UINT nIndex, LPCSTR pszText ); -// Purpose: Change the string at the specified index in the block (ANSI version). -// HSTRBLOCK hStrBlock: The handle to the string block. -// UINT nIndex: The zero-based index of the string in the block. The index can be a value -// from 0 through (NO_OF_STRINGS_PER_BLOCK - 1). -// LPCSTR pszText: The pointer to the new string. -// Returns: TRUE on success, FALSE otherwise. -BOOL WINAPI SetStringA( HSTRBLOCK hStrBlock, UINT nIndex, LPCSTR pszText ); - - -// Function: BOOL WINAPI SetStringW( HSTRBLOCK hStrBlock, UINT nIndex, LPCWSTR pszStr ); -// Purpose: Change the string at the specified index in the block (UNICODE version). -// HSTRBLOCK hStrBlock: The handle to the string block. -// UINT nIndex: The zero-based index of the string in the block. The index can be a value -// from 0 through (NO_OF_STRINGS_PER_BLOCK - 1). -// LPCWSTR pszText: The pointer to the new string. -// Returns: TRUE on success, FALSE otherwise. -BOOL WINAPI SetStringW( HSTRBLOCK hStrBlock, UINT nIndex, LPCWSTR pszText ); - - -// Function: int WINAPI GetFirstStringID( HSTRBLOCK hStrBlock ); -// Purpose: Get the ID of the first string in the block. -// HSTRBLOCK hStrBlock: The handle to the string block. -// Returns: The ID of the first string in the block. -1 if the function fails. -int WINAPI GetFirstStringID( HSTRBLOCK hStrBlock ); - - -// Function: int WINAPI GetBlockID( HSTRBLOCK hStrBlock ); -// Purpose: Get the ID of the string block. This is the ID of the string block that was -// specified when the block was created. -// HSTRBLOCK hStrBlock: The handle to the string block. -// Returns: The block ID, if sucessful, or -1 on failure. -int WINAPI GetBlockID( HSTRBLOCK hStrBlock ); - - -// Function: WORD WINAPI GetBlockLanguage( HSTRBLOCK hStrBlock ); -// Purpose: Get the identifier of the language for the string block. This is the language ID -// specified when the block was created. -// HSTRBLOCK hStrBlock: The handle to the string block. -// Returns: The language ID of the block, if successful; 0 on failure. -// Comments: For info on language IDs, refer help of MAKELANGID. -WORD WINAPI GetBlockLanguage( HSTRBLOCK hStrBlock ); - - -// Function: BOOL WINAPI UpdateStringBlockA( LPCSTR strAppName, HSTRBLOCK hStrBlock, -// int nBlockID, WORD wLangID ); -// Purpose: Update the block of string resource in the specified application -// (ANSI version). -// LPCTSTR strAppName: The name of the application whose string resource has to be updated. -// HSTRBLOCK hStrBlock: The handle to the block that contains the new strings. -// int nBlockID: The ID of the block to update in the app. If it is -1, use the same block -// ID as that of hStrBlock. -// WORD wLangID: The identifier of the language whaose string block has to be updated. If this -// value is 0, use the same language as that of hStrBlock. -// Returns: TRUE on success, FALSE on failure. -BOOL WINAPI UpdateStringBlockA( LPCSTR strAppName, HSTRBLOCK hStrBlock, int nBlockID, WORD wLangID ); - - -// Function: BOOL WINAPI UpdateStringBlockW( LPCWTR strAppName, HSTRBLOCK hStrBlock, -// int nBlockID, WORD wLangID ); -// Purpose: Update the block of string resource in the specified application -// (UNICODE version). -// LPCTSTR strAppName: The name of the application whose string resource has to be updated. -// HSTRBLOCK hStrBlock: The handle to the block that contains the new strings. -// int nBlockID: The ID of the block to update in the app. If it is -1, use the same block -// ID as that of hStrBlock. -// WORD wLangID: The identifier of the language whaose string block has to be updated. If this -// value is 0, use the same language as that of hStrBlock. -// Returns: TRUE on success, FALSE on failure. -BOOL WINAPI UpdateStringBlockW( LPCWSTR strAppName, HSTRBLOCK hStrBlock, int nBlockID, WORD wLangID ); - - -// Function: STRBLOCKERR WINAPI GetStringBlockError(); -// Purpose: Get the error status of the last string block action. -// Returns: The error status of the last operation on the specified block. -// Comments: The error code is maintained on a per-thread basis. Multiple threads do not -// overwrite each other's last block error code. -STRBLOCKERR WINAPI GetStringBlockError(); - - -#ifdef UNICODE -#define GetStringBlock GetStringBlockW -#define GetString GetStringW -#define SetString SetStringW -#define UpdateStringBlock UpdateStringBlockW -#else -#define GetStringBlock GetStringBlockA -#define GetString GetStringA -#define SetString SetStringA -#define UpdateStringBlock UpdateStringBlockA -#endif // UNICODE - -#endif // _STRBLOCK_H \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/basewnd.cpp b/Sources/Plasma/PubUtilLib/plWndCtrls/basewnd.cpp deleted file mode 100644 index e240baf5..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/basewnd.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#include "hsTypes.h" - - -// Stolen from: http://www.mvps.org/user32/webhost.cab -// No copyright notices, so I assume it's public domain -Colin -#include "basewnd.h" - -#include "hsConfig.h" -#if HS_BUILD_FOR_WIN32 - - -wchar_t basewnd::szClassName[] = L"BASEWND"; - - -void basewnd::Initialize(HINSTANCE hAppInstance,UINT style) -{ - WNDCLASSEX wc = - { - sizeof(wc), - style, - WindowProc, - 0,0, - hAppInstance, - LoadIcon(NULL,IDI_APPLICATION), - LoadCursor(NULL,IDC_ARROW), - (HBRUSH)(COLOR_WINDOW+1), - NULL, - szClassName, - LoadIcon(NULL,IDI_APPLICATION) - }; - RegisterClassEx(&wc); -} - - -LRESULT CALLBACK basewnd::WindowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam) -{ - basewnd* _this; - if(uMsg == WM_CREATE && (_this = (basewnd*)(LPCREATESTRUCT(lParam))->lpCreateParams)) - { - SetWindowLong(hwnd,GWL_USERDATA,(long)_this); - _this->hwnd = hwnd; - _this->AddRef(); - } - else - _this = (basewnd*)GetWindowLong(hwnd,GWL_USERDATA); - - LRESULT result = 0; - BOOL fDoDef = !(_this && _this->HandleMessage(uMsg,wParam,lParam,&result)); - - if(uMsg == WM_DESTROY) - { - SetWindowLong(hwnd,GWL_USERDATA,(long)NULL); - _this->Release(); - } - - return fDoDef?DefWindowProc(hwnd,uMsg,wParam,lParam):result; -} - - -basewnd::basewnd() -: mcRef(1) -{ -} - - -basewnd::~basewnd() -{ -} - -ULONG basewnd::AddRef() -{ - return mcRef++; -} - -ULONG basewnd::Release() -{ - if(--mcRef) - return mcRef; - delete this; - return 0; -} - - -#endif \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/basewnd.h b/Sources/Plasma/PubUtilLib/plWndCtrls/basewnd.h deleted file mode 100644 index c8264b97..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/basewnd.h +++ /dev/null @@ -1,58 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -// Stolen from: http://www.mvps.org/user32/webhost.cab -// No copyright notices, so I assume it's public domain -Colin - -#include "hsConfig.h" -#if HS_BUILD_FOR_WIN32 - -#pragma once - -#include - - -struct basewnd -{ - static wchar_t szClassName[]; - static LRESULT CALLBACK WindowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam); - static void Initialize(HINSTANCE hAppInstance,UINT style=0); - - HWND hwnd; - ULONG mcRef; - basewnd(); - virtual ~basewnd(); - -public: - virtual ULONG AddRef(); - virtual ULONG Release(); - virtual BOOL HandleMessage(UINT,WPARAM,LPARAM,LRESULT*)=0; - -public: // inline overrides - BOOL ShowWindow(int nCmdShow){return ::ShowWindow(hwnd,nCmdShow);} - BOOL UpdateWindow(void){return ::UpdateWindow(hwnd);} -}; - -#endif \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/plButton.h b/Sources/Plasma/PubUtilLib/plWndCtrls/plButton.h deleted file mode 100644 index 59a7ab80..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/plButton.h +++ /dev/null @@ -1,93 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef plButton_h_inc -#define plButton_h_inc - - -class plButton : public plControl -{ -public: - DECLARE_WINDOWSUBCLASS(plButton,plControl) - - plDelegate fClickDelegate; - plDelegate fDoubleClickDelegate; - plDelegate fPushDelegate; - plDelegate fUnPushDelegate; - plDelegate fSetFocusDelegate; - plDelegate fKillFocusDelegate; - - plButton() - {} - plButton( plWindow * inOwner, int inId=0, plDelegate inClicked=plDelegate(), WNDPROC inSuperProc=nil ) - : plControl( inOwner, inId, inSuperProc?inSuperProc:_SuperProc ) - , fClickDelegate( inClicked ) - {} - - void OpenWindow( bool visible, int X, int Y, int XL, int YL, const wchar_t * text ) - { - PerformCreateWindowEx - ( - 0, - nil, - WS_CHILD, - X, Y, - XL, YL, - *fOwnerWindow, - (HMENU)fControlID, - plWndCtrls::Instance() - ); - SendMessage( *this, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(0,0) ); - SetText( text ); - if( visible ) - ShowWindow( *this, SW_SHOWNOACTIVATE ); - } - void SetVisibleText( const wchar_t * text ) - { - CHECK(Handle()); - if( text ) - SetText( text ); - Show( text!=nil ); - } - - void Click() - { - SendMessage( *this, BM_CLICK, 0, 0 ); - } - - bool InterceptControlCommand( unsigned int message, unsigned int wParam, LONG lParam ) - { - if ( HIWORD(wParam)==BN_CLICKED ) {fClickDelegate(); return 1;} - else if( HIWORD(wParam)==BN_DBLCLK ) {fDoubleClickDelegate(); return 1;} - else if( HIWORD(wParam)==BN_PUSHED ) {fPushDelegate(); return 1;} - else if( HIWORD(wParam)==BN_UNPUSHED ) {fUnPushDelegate(); return 1;} - else if( HIWORD(wParam)==BN_SETFOCUS ) {fSetFocusDelegate(); return 1;} - else if( HIWORD(wParam)==BN_KILLFOCUS ) {fUnPushDelegate(); return 1;} - else return 0; - } -}; - - -#endif // plButton_h_inc diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/plCheckBox.h b/Sources/Plasma/PubUtilLib/plWndCtrls/plCheckBox.h deleted file mode 100644 index d08f41e6..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/plCheckBox.h +++ /dev/null @@ -1,85 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef plCheckBox_h_inc -#define plCheckBox_h_inc - - -class plCheckBox : public plButton -{ - DECLARE_WINDOWSUBCLASS(plCheckBox,plButton) - plCheckBox() - {} - plCheckBox( plWindow * inOwner, int inId=0, plDelegate inClicked=plDelegate(), WNDPROC inSuperProc=nil ) - : plButton( inOwner, inId, inClicked, inSuperProc?inSuperProc:_SuperProc ) - {} - void OpenWindow( bool visible, int X, int Y, int XL, int YL, const wchar_t * text ) - { - PerformCreateWindowEx - ( - 0, - nil, - WS_CHILD|BS_CHECKBOX, - X, Y, - XL, YL, - *fOwnerWindow, - (HMENU)fControlID, - plWndCtrls::Instance() - ); - SendMessage( *this, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(0,0) ); - SetText( text ); - if( visible ) - ShowWindow( *this, SW_SHOWNOACTIVATE ); - } - void Check(bool check=true) - { - SendMessage(*this,BM_SETCHECK,(check)?BST_CHECKED:BST_UNCHECKED,0); - } - bool IsChecked() const - { - return (SendMessage(*this,BM_GETCHECK,0,0)==BST_CHECKED); - } - bool IsUnchecked() const - { - return !IsChecked(); - } - std::string IGetValue() const - { - char tmp[20]; - sprintf(tmp,"%s",IsChecked()?"true":"false"); - return tmp; - } - void ISetValue(const char * value) - { - if (stricmp(value,"true")==0) - Check(true); - else if (stricmp(value,"false")==0) - Check(false); - else - Check(atoi(value)?true:false); - } -}; - -#endif // plCheckBox_h_inc diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/plComboBox.h b/Sources/Plasma/PubUtilLib/plWndCtrls/plComboBox.h deleted file mode 100644 index 4d5477b0..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/plComboBox.h +++ /dev/null @@ -1,213 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef plComboBox_h_inc -#define plComboBox_h_inc - -class plComboBox : public plControl -{ -public: - DECLARE_WINDOWSUBCLASS(plComboBox,plControl) - - plDelegate fDoubleClickDelegate; - plDelegate fDropDownDelegate; - plDelegate fCloseComboDelegate; - plDelegate fEditChangeDelegate; - plDelegate fEditUpdateDelegate; - plDelegate fSetFocusDelegate; - plDelegate fKillFocusDelegate; - plDelegate fSelectionChangeDelegate; - plDelegate fSelectionEndOkDelegate; - plDelegate fSelectionEndCancelDelegate; - plDelegate fEnterKeyPressedDelegate; - - plComboBox() - {} - plComboBox( plWindow * inOwner, int inId=0, WNDPROC inSuperProc=nil ) - : plControl( inOwner, inId, inSuperProc?inSuperProc:_SuperProc ) - {} - - void OpenWindow( bool visible ) - { - PerformCreateWindowEx - ( - 0, - nil, - WS_CHILD | WS_VSCROLL | CBS_DROPDOWNLIST | (visible?WS_VISIBLE:0), - 0, 0, - 64, 384, - *fOwnerWindow, - (HMENU)fControlID, - plWndCtrls::Instance() - ); - SendMessage( *this, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(0,0) ); - } - LONG WndProc( unsigned int message, unsigned int wParam, LONG lParam ) - { - switch (message) - { - case WM_GETDLGCODE: - return DLGC_WANTALLKEYS; - - case WM_CHAR: - //Process this message to avoid message beeps. - if ((wParam == VK_RETURN) || (wParam == VK_TAB)) - return 0; - else - return plControl::WndProc( message, wParam, lParam ); - - default: - return plControl::WndProc( message, wParam, lParam ); - } - } - - void OnKeyDown( UInt16 ch ) - { - if (ch==VK_RETURN) - fEnterKeyPressedDelegate(); - else if (ch==VK_TAB) - PostMessage (*fOwnerWindow, WM_NEXTDLGCTL, 0, 0L); - } - - bool InterceptControlCommand( unsigned int message, unsigned int wParam, LONG lParam ) - { - if ( HIWORD(wParam)==CBN_DBLCLK ) {fDoubleClickDelegate(); return 1;} - else if( HIWORD(wParam)==CBN_DROPDOWN ) {fDropDownDelegate(); return 1;} - else if( HIWORD(wParam)==CBN_CLOSEUP ) {fCloseComboDelegate(); return 1;} - else if( HIWORD(wParam)==CBN_EDITCHANGE ) {fEditChangeDelegate(); return 1;} - else if( HIWORD(wParam)==CBN_EDITUPDATE ) {fEditUpdateDelegate(); return 1;} - else if( HIWORD(wParam)==CBN_SETFOCUS ) {fSetFocusDelegate(); return 1;} - else if( HIWORD(wParam)==CBN_KILLFOCUS ) {fKillFocusDelegate(); return 1;} - else if( HIWORD(wParam)==CBN_SELCHANGE ) {fSelectionChangeDelegate(); return 1;} - else if( HIWORD(wParam)==CBN_SELENDOK ) {fSelectionEndOkDelegate(); return 1;} - else if( HIWORD(wParam)==CBN_SELENDCANCEL ) {fSelectionEndCancelDelegate(); return 1;} - else return 0; - } - - virtual int InsertString( int index, const wchar_t * str ) - { - return SendMessage( *this, CB_INSERTSTRING, index, (LPARAM)str ); - } - virtual void InsertStringAndData( int index, const wchar_t * str, void * item ) - { - int i = SendMessage( *this, CB_INSERTSTRING, index, (LPARAM)str ); - SetItemData(i,item); - } - virtual int AddString( const wchar_t * str ) - { - return SendMessage( *this, CB_ADDSTRING, 0, (LPARAM)str ); - } - virtual void AddStringAndData( const wchar_t * str, void * item ) - { - int index = SendMessage( *this, CB_ADDSTRING, 0, (LPARAM)str ); - SetItemData(index,item); - } - virtual void AddStrings( const std::vector & strings ) - { - for (int i=0; i & strings ) - { - for (int i=0; i=0) - tempString = GetString(index); - else - tempString = GetText(); - - char *temp = hsWStringToString(tempString.c_str()); - retVal = temp; - delete [] temp; - return retVal; - } - void ISetValue(const char * value) - { - wchar_t *temp = hsStringToWString(value); - SetCurrent(FindString(temp)); - delete [] temp; - } -}; - - -#endif // plComboBox_h_inc diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/plControl.h b/Sources/Plasma/PubUtilLib/plWndCtrls/plControl.h deleted file mode 100644 index 5a101114..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/plControl.h +++ /dev/null @@ -1,95 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef plControl_h_inc -#define plControl_h_inc - - -class plControl : public plWindow -{ -public: - WNDPROC WindowDefWndProc; - - plControl() - {} - plControl( plWindow * ownerWindow, int inId, WNDPROC inSuperProc ) - : plWindow( ownerWindow ) - { - CHECK(fOwnerWindow); - WindowDefWndProc = inSuperProc; - fControlID = inId ? inId : ownerWindow->fTopControlID++; - fOwnerWindow->fControls.push_back( this ); - } - ~plControl() - { - CHECK(fOwnerWindow); - std::vector::iterator it = std::find(fOwnerWindow->fControls.begin(),fOwnerWindow->fControls.end(),this); - if (it!=fOwnerWindow->fControls.end()) - fOwnerWindow->fControls.erase(it); - } - - int CallDefaultProc( unsigned int message, unsigned int wParam, LONG lParam ) - { - return CallWindowProc( WindowDefWndProc, Handle(), message, wParam, lParam ); - } - static WNDPROC RegisterWindowClass( const wchar_t * name, const wchar_t * winBaseClass ) - { -#ifdef UNICODE - WNDPROC superProc=nil; - WNDCLASSEX cls; - HSMemory::ClearMemory( &cls, sizeof(cls) ); - cls.cbSize = sizeof(cls); - CHECK( GetClassInfoEx( nil, winBaseClass, &cls ) ); - superProc = cls.lpfnWndProc; - cls.lpfnWndProc = plWindow::StaticWndProc; - cls.lpszClassName = name; - cls.hInstance = plWndCtrls::Instance(); - CHECK(cls.lpszMenuName==nil); - CHECK(RegisterClassEx( &cls )); -#else - char* cWinBaseClass = hsWStringToString(winBaseClass); - char* cName = hsWStringToString(name); - - WNDPROC superProc=nil; - WNDCLASSEX cls; - HSMemory::ClearMemory( &cls, sizeof(cls) ); - cls.cbSize = sizeof(cls); - CHECK( GetClassInfoEx( nil, cWinBaseClass, &cls ) ); - superProc = cls.lpfnWndProc; - cls.lpfnWndProc = plWindow::StaticWndProc; - cls.lpszClassName = cName; - cls.hInstance = plWndCtrls::Instance(); - CHECK(cls.lpszMenuName==nil); - CHECK(RegisterClassEx( &cls )); - - delete [] cName; - delete [] cWinBaseClass; -#endif - return superProc; - } -}; - - -#endif // plControl_h_inc diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/plDialog.h b/Sources/Plasma/PubUtilLib/plWndCtrls/plDialog.h deleted file mode 100644 index 585919cd..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/plDialog.h +++ /dev/null @@ -1,135 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef plDialog_h_inc -#define plDialog_h_inc - -class plDialog : public plWindow -{ -protected: - DLGTEMPLATE* ILoadDlgTemplate() - { - HRSRC hRsrc = FindResourceEx(plWndCtrls::Instance(), RT_DIALOG, MAKEINTRESOURCE(fControlID), (WORD)(plWndCtrls::GetLanguage())); - HGLOBAL hGlobal = LoadResource(plWndCtrls::Instance(), hRsrc); - LPVOID lpsz = LockResource(hGlobal); - return (DLGTEMPLATE*)lpsz; - } - -public: - plDialog() - {} - plDialog( int inDialogId, plWindow * ownerWindow=nil ) - : plWindow( ownerWindow ) - { - fControlID = inDialogId; - } - - int CallDefaultProc( unsigned int message, unsigned int wParam, LONG lParam ) - { - return 0; - } - virtual int DoModal() - { - CHECK(Handle()==nil); - _Windows.push_back( this ); - _ModalCount++; - int result = 0; - if (plWndCtrls::GetLanguage() != 0) - result = DialogBoxIndirectParam(plWndCtrls::Instance(),ILoadDlgTemplate(),fOwnerWindow?fOwnerWindow->Handle():nil,(int(APIENTRY*)(HWND,unsigned int,WPARAM,LPARAM))StaticWndProc,(LPARAM)this); - else - result = DialogBoxParam(plWndCtrls::Instance(),MAKEINTRESOURCE(fControlID),fOwnerWindow?fOwnerWindow->Handle():nil,(int(APIENTRY*)(HWND,unsigned int,WPARAM,LPARAM))StaticWndProc,(LPARAM)this); - int err = GetLastError(); - _ModalCount--; - return result; - } - void OpenWindow(bool visible=true) - { - CHECK(Handle()==nil); - _Windows.push_back( this ); - - HWND hWndCreated = nil; - if (plWndCtrls::GetLanguage() != 0) - hWndCreated = CreateDialogIndirectParam(plWndCtrls::Instance(),ILoadDlgTemplate(),nil,(int(APIENTRY*)(HWND,unsigned int,WPARAM,LPARAM))StaticWndProc,(LPARAM)this); - else - hWndCreated = CreateDialogParam(plWndCtrls::Instance(),MAKEINTRESOURCE(fControlID),nil,(int(APIENTRY*)(HWND,unsigned int,WPARAM,LPARAM))StaticWndProc,(LPARAM)this); - - int err = GetLastError(); - CHECK(hWndCreated); - CHECK(hWndCreated==Handle()); - Show(visible); - } - void OpenChildWindow( int inControlId, bool visible ) - { - CHECK(!Handle()); - _Windows.push_back( this ); - HWND hWndParent = inControlId ? GetDlgItem(fOwnerWindow->Handle(),inControlId) : fOwnerWindow ? fOwnerWindow->Handle() : nil; - - HWND hWndCreated = nil; - if (plWndCtrls::GetLanguage() != 0) - hWndCreated = CreateDialogIndirectParam(plWndCtrls::Instance(),ILoadDlgTemplate(),hWndParent,(int(APIENTRY*)(HWND,unsigned int,WPARAM,LPARAM))StaticWndProc,(LPARAM)this); - else - hWndCreated = CreateDialogParam(plWndCtrls::Instance(),MAKEINTRESOURCE(fControlID),hWndParent,(int(APIENTRY*)(HWND,unsigned int,WPARAM,LPARAM))StaticWndProc,(LPARAM)this); - - int err = GetLastError(); - CHECK(hWndCreated); - CHECK(hWndCreated==Handle()); - Show( visible ); - } - virtual void OnInitDialog() - { - plWindow::OnInitDialog(); - for( int i=0; iHandle()); - control->Handle() = GetDlgItem( *this, control->fControlID ); - CHECK(control->Handle()); - _Windows.push_back(control); - control->WindowDefWndProc = (WNDPROC)GetWindowLong( control->Handle(), GWL_WNDPROC ); - SetWindowLong( control->Handle(), GWL_WNDPROC, (LONG)plWindow::StaticWndProc ); - } - for( int i=0; iOnCreate(); - } - } - void EndDialog( int result ) - { - ::EndDialog( Handle(), result ); - } - void EndDialogTrue() - { - EndDialog( 1 ); - } - void EndDialogFalse() - { - EndDialog( 0 ); - } -}; - - -#endif // plDialog_h_inc diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/plEdit.h b/Sources/Plasma/PubUtilLib/plWndCtrls/plEdit.h deleted file mode 100644 index 6d6a0d21..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/plEdit.h +++ /dev/null @@ -1,146 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef plEdit_h_inc -#define plEdit_h_inc - - -class plEdit : public plControl -{ -private: - bool fRestrictToAlphaNum; -public: - DECLARE_WINDOWSUBCLASS(plEdit,plControl) - - plDelegate fChangeDelegate; - plDelegate fKillFocusDelegate; - - plEdit() - {fRestrictToAlphaNum = false;} - plEdit( plWindow * inOwner, int inId=0, WNDPROC inSuperProc=nil, bool restrict=false ) - : plControl( inOwner, inId, inSuperProc?inSuperProc:_SuperProc ), fRestrictToAlphaNum(restrict) - {} - - void OpenWindow( bool visible, bool multiline, bool readOnly ) - { - PerformCreateWindowEx - ( - WS_EX_CLIENTEDGE, - nil, - WS_CHILD | (visible?WS_VISIBLE:0) | ES_LEFT | (multiline?(ES_MULTILINE|WS_VSCROLL|WS_HSCROLL):0) | ES_AUTOVSCROLL | ES_AUTOHSCROLL | (readOnly?ES_READONLY:0), - 0, 0, - 0, 0, - *fOwnerWindow, - (HMENU)fControlID, - plWndCtrls::Instance() - ); - SendMessage( *this, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(0,0) ); - } - bool InterceptControlCommand( unsigned int message, unsigned int wParam, LONG lParam ) - { - if (HIWORD(wParam)==EN_CHANGE) - { - fChangeDelegate(); - return 1; - } - else if(HIWORD(wParam)==EN_KILLFOCUS) - { - fKillFocusDelegate(); - return 1; - } - else - return 0; - } - - virtual LONG OnChar( char ch ) - { - if (fRestrictToAlphaNum) - { - // we only accept 0-9, a-z, A-Z, or backspace - if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'z') && (ch < 'A' || ch >'Z') && !(ch == VK_BACK)) - { - MessageBeep(-1); // alert the user - return FALSE; // and make sure the default handler doesn't get it - } - } - return TRUE; - } - - bool GetReadOnly() - { - CHECK(Handle()); - return (GetWindowLong( *this, GWL_STYLE )&ES_READONLY)!=0; - } - void SetReadOnly( bool readOnly ) - { - CHECK(Handle()); - SendMessage( *this, EM_SETREADONLY, readOnly, 0 ); - } - int GetLineCount() - { - CHECK(Handle()); - return SendMessage( *this, EM_GETLINECOUNT, 0, 0 ); - } - int GetLineIndex( int line ) - { - CHECK(Handle()); - return SendMessage( *this, EM_LINEINDEX, line, 0 ); - } - void GetSelection( int& start, int& end ) - { - CHECK(Handle()); - SendMessage( *this, EM_GETSEL, (WPARAM)&start, (LPARAM)&end ); - } - void SetSelection( int start, int end ) - { - CHECK(Handle()); - SendMessage( *this, EM_SETSEL, start, end ); - } - void SetSelectedText( const wchar_t * text ) - { - CHECK(Handle()); - SendMessage( *this, EM_REPLACESEL, 1, (LPARAM)text ); - } - void SetLimitText( int maxChars ) - { - CHECK(Handle()); - SendMessage( *this, EM_SETLIMITTEXT, maxChars, 0 ); - } - bool GetModify() - { - return SendMessage( *this, EM_GETMODIFY, 0, 0 )!=0; - } - void SetModify( bool modified ) - { - SendMessage( *this, EM_SETMODIFY, modified, 0 ); - } - void ScrollCaret() - { - SendMessage( *this, EM_SCROLLCARET, 0, 0 ); - } -}; - - -#endif // plEdit_h_inc diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/plLabel.h b/Sources/Plasma/PubUtilLib/plWndCtrls/plLabel.h deleted file mode 100644 index e0459582..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/plLabel.h +++ /dev/null @@ -1,59 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef plLabel_h_inc -#define plLabel_h_inc - - -class plLabel : public plControl -{ -public: - DECLARE_WINDOWSUBCLASS(plLabel,plControl) - - plLabel() - {} - plLabel( plWindow * inOwner, int inId=0, WNDPROC inSuperProc=nil ) - : plControl( inOwner, inId, inSuperProc?inSuperProc:_SuperProc ) - {} - - void OpenWindow( bool visible ) - { - PerformCreateWindowEx - ( - WS_EX_CLIENTEDGE, - nil, - WS_CHILD | (visible?WS_VISIBLE:0), - 0, 0, - 0, 0, - *fOwnerWindow, - (HMENU)fControlID, - plWndCtrls::Instance() - ); - SendMessage( *this, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(0,0) ); - } -}; - - -#endif // plLabel_h_inc diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/plListBox.h b/Sources/Plasma/PubUtilLib/plWndCtrls/plListBox.h deleted file mode 100644 index b66c9ac0..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/plListBox.h +++ /dev/null @@ -1,236 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef plListBox_h_inc -#define plListBox_h_inc - - -class plListBox : public plControl -{ -public: - DECLARE_WINDOWSUBCLASS(plListBox,plControl) - - plDelegate DoubleClickDelegate; - plDelegate SelectionChangeDelegate; - plDelegate SelectionCancelDelegate; - plDelegate SetFocusDelegate; - plDelegate KillFocusDelegate; - - plListBox() - {} - plListBox( plWindow * inOwner, int inId=0, WNDPROC inSuperProc=nil ) - : plControl( inOwner, inId, inSuperProc?inSuperProc:_SuperProc ) - { - CHECK(fOwnerWindow); - } - - void OpenWindow( bool visible, bool integral, bool multiSel, bool ownerDrawVariable ) - { - PerformCreateWindowEx - ( - WS_EX_CLIENTEDGE, - nil, - WS_CHILD | WS_BORDER | WS_VSCROLL | WS_CLIPCHILDREN | LBS_NOTIFY | (visible?WS_VISIBLE:0) | (integral?0:LBS_NOINTEGRALHEIGHT) | (multiSel?(LBS_EXTENDEDSEL|LBS_MULTIPLESEL):0) | (ownerDrawVariable?LBS_OWNERDRAWVARIABLE:0), - 0, 0, - 0, 0, - *fOwnerWindow, - (HMENU)fControlID, - plWndCtrls::Instance() - ); - SendMessage( *this, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(0,0) ); - } - - bool InterceptControlCommand( unsigned int message, unsigned int wParam, LONG lParam ) - { - if ( HIWORD(wParam)==LBN_DBLCLK ) {DoubleClickDelegate(); return 1;} - else if( HIWORD(wParam)==LBN_SELCHANGE) {SelectionChangeDelegate(); return 1;} - else if( HIWORD(wParam)==LBN_SELCANCEL) {SelectionCancelDelegate(); return 1;} - else if( HIWORD(wParam)==LBN_SETFOCUS) {SetFocusDelegate(); return 1;} - else if( HIWORD(wParam)==LBN_KILLFOCUS) {KillFocusDelegate(); return 1;} - else return 0; - } - - std::wstring GetString( int index ) const - { - int length = SendMessage(*this,LB_GETTEXTLEN,index,0); - if (length == LB_ERR) - return L""; - std::wstring ch; - ch.resize(length); - length = SendMessage( *this, LB_GETTEXT, index, (LPARAM)ch.data() ); - ch.resize(length); - return ch; - } - void * GetItemData( int index ) - { - return (void*)SendMessage( *this, LB_GETITEMDATA, index, 0 ); - } - void SetItemData( int index, void * value ) - { - SendMessage( *this, LB_SETITEMDATA, index, (LPARAM)value ); - } - int GetCurrent() const - { - return SendMessage( *this, LB_GETCARETINDEX, 0, 0 ); - } - void SetCurrent( int index, bool bScrollIntoView ) - { - SendMessage( *this, LB_SETCURSEL, index, 0 ); - SendMessage( *this, LB_SETCARETINDEX, index, bScrollIntoView ); - } - int GetTop() - { - return SendMessage( *this, LB_GETTOPINDEX, 0, 0 ); - } - void SetTop( int index ) - { - SendMessage( *this, LB_SETTOPINDEX, index, 0 ); - } - void DeleteString( int index ) - { - SendMessage( *this, LB_DELETESTRING, index, 0 ); - } - int GetCount() - { - return SendMessage( *this, LB_GETCOUNT, 0, 0 ); - } - int GetItemHeight( int index ) - { - return SendMessage( *this, LB_GETITEMHEIGHT, index, 0 ); - } - int ItemFromPoint( const plPoint & P ) - { - DWORD result=SendMessage( *this, LB_ITEMFROMPOINT, 0, MAKELPARAM(P.X,P.Y) ); - return HIWORD(result) ? -1 : LOWORD(result); - } - plRect GetItemRect( int index ) - { - RECT R; R.left=R.right=R.top=R.bottom=0; - SendMessage( *this, LB_GETITEMRECT, index, (LPARAM)&R ); - return R; - } - void Empty() - { - SendMessage( *this, LB_RESETCONTENT, 0, 0 ); - } - bool GetSelected( int index ) - { - return SendMessage( *this, LB_GETSEL, index, 0 )?true:false; - } - - int AddString( const wchar_t * C ) - { - return SendMessage( *this, LB_ADDSTRING, 0, (LPARAM)C ); - } - void AddStrings( std::vector & strings ) - { - for (int i=0; i=0) - tempString = GetString(index); - else - tempString = GetText(); - - char *temp = hsWStringToString(tempString.c_str()); - retVal = temp; - delete [] temp; - return retVal; - } - void ISetValue(const char * value) - { - wchar_t *temp = hsStringToWString(value); - SetCurrent(FindString(temp), true); - delete [] temp; - } -}; - -#endif // plListBox_h_inc diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/plProgressBar.h b/Sources/Plasma/PubUtilLib/plWndCtrls/plProgressBar.h deleted file mode 100644 index 9e853bbd..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/plProgressBar.h +++ /dev/null @@ -1,90 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef plProgressBar_h_inc -#define plProgressBar_h_inc - -class plProgressBar : public plControl -{ -public: - DECLARE_WINDOWSUBCLASS(plProgressBar,plControl) - - int fPercent; - int fMax; - - plProgressBar() - {} - plProgressBar( plWindow * inOwner, int inId=0, WNDPROC inSuperProc=nil ) - : plControl( inOwner, inId, inSuperProc?inSuperProc:_SuperProc ) - , fPercent( 0 ) - , fMax( 100 ) - {} - - void OpenWindow( bool Visible ) - { - PerformCreateWindowEx - ( - WS_EX_CLIENTEDGE, - nil, - WS_CHILD | (Visible?WS_VISIBLE:0), - 0, 0, - 0, 0, - *fOwnerWindow, - (HMENU)fControlID, - plWndCtrls::Instance() - ); - SendMessage( *this, PBM_SETRANGE, 0, 100 ); - } - - void SetMax(int inMax) - { - fMax = inMax; - } - void SetProgress( int inCurrent ) - { - int inPercent = (int)((float(inCurrent)/float(Max(fMax,1)))*100.f); - if( inPercent!=fPercent ) - SendMessage( *this, PBM_SETPOS, inPercent, 0 ); - fPercent = inPercent; - } - int GetProgress() const - { - int value = SendMessage( *this, PBM_GETPOS, 0, 0 ); - return value; - } - std::string IGetValue() const - { - char tmp[20]; - sprintf(tmp,"%d",GetProgress()); - return tmp; - } - void ISetValue(const char * value) - { - SetProgress(atoi(value)); - } -}; - - -#endif // plProgressBar_h_inc diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/plRadioButton.h b/Sources/Plasma/PubUtilLib/plWndCtrls/plRadioButton.h deleted file mode 100644 index fcda38db..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/plRadioButton.h +++ /dev/null @@ -1,81 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef plRadioButton_h_inc -#define plRadioButton_h_inc - - -class plRadioButton : public plButton -{ - DECLARE_WINDOWSUBCLASS(plRadioButton,plButton) - plRadioButton() - {} - plRadioButton( plWindow * inOwner, int inId=0, plDelegate inClicked=plDelegate(), WNDPROC inSuperProc=nil ) - : plButton( inOwner, inId, inClicked, inSuperProc?inSuperProc:_SuperProc ) - {} - void OpenWindow( bool visible, int X, int Y, int XL, int YL, const wchar_t * text ) - { - PerformCreateWindowEx - ( - 0, - nil, - WS_CHILD|BS_RADIOBUTTON, - X, Y, - XL, YL, - *fOwnerWindow, - (HMENU)fControlID, - plWndCtrls::Instance() - ); - SendMessage( *this, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(0,0) ); - SetText( text ); - if( visible ) - ShowWindow( *this, SW_SHOWNOACTIVATE ); - } - void Check(bool check=true) - { - SendMessage(*this,BM_SETCHECK,(check)?BST_CHECKED:BST_UNCHECKED,0); - } - bool IsChecked() const - { - return (SendMessage(*this,BM_GETCHECK,0,0)==BST_CHECKED); - } - std::string IGetValue() const - { - char tmp[20]; - sprintf(tmp,"%s",IsChecked()?"true":"false"); - return tmp; - } - void ISetValue(const char * value) - { - if (stricmp(value,"true")==0) - Check(true); - else if (stricmp(value,"false")==0) - Check(false); - else - Check(atoi(value)?true:false); - } -}; - -#endif // plRadioButton_h_inc diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/plStatusBar.h b/Sources/Plasma/PubUtilLib/plWndCtrls/plStatusBar.h deleted file mode 100644 index 323e4dc6..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/plStatusBar.h +++ /dev/null @@ -1,68 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef plStatusBar_h_inc -#define plStatusBar_h_inc - - -class plStatusBar : public plControl -{ -public: - DECLARE_WINDOWSUBCLASS(plStatusBar,plControl) - - plStatusBar() - {} - plStatusBar( plWindow * inOwner, int inId=0, WNDPROC inSuperProc=nil ) - : plControl( inOwner, inId, inSuperProc?inSuperProc:_SuperProc ) - {} - - void OpenWindow( plWindow * inOwner, bool Visible ) - { - if (inOwner) - { - if (fOwnerWindow) - { - std::vector::iterator it = std::find(fOwnerWindow->fControls.begin(),fOwnerWindow->fControls.end(),this); - if (it!=fOwnerWindow->fControls.end()) - fOwnerWindow->fControls.erase(it); - } - fOwnerWindow = inOwner; - fOwnerWindow->fControls.push_back( this ); - } - CHECK(fOwnerWindow); - LONG style = WS_CHILD|WS_BORDER; - if (Visible) - style |= WS_VISIBLE; -#if UNICODE - fhWnd = CreateStatusWindow(style, - L"",*fOwnerWindow,fControlID); -#else - fhWnd = CreateStatusWindow(style, - "",*fOwnerWindow,fControlID); -#endif - } -}; - -#endif // plStatusBar_h_inc diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/plTrackBar.h b/Sources/Plasma/PubUtilLib/plWndCtrls/plTrackBar.h deleted file mode 100644 index 331f953f..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/plTrackBar.h +++ /dev/null @@ -1,102 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef plTrackBar_h_inc -#define plTrackBar_h_inc - - -class plTrackBar : public plControl -{ -public: - DECLARE_WINDOWSUBCLASS(plTrackBar,plControl) - - plDelegate fThumbTrackDelegate; - plDelegate fThumbPositionDelegate; - - plTrackBar() - {} - plTrackBar( plWindow * inOwner, int inId=0, WNDPROC inSuperProc=nil ) - : plControl( inOwner, inId, inSuperProc?inSuperProc:_SuperProc ) - {} - - void OpenWindow( bool Visible ) - { - PerformCreateWindowEx - ( - WS_EX_CLIENTEDGE, - nil, - WS_CHILD | TBS_HORZ | TBS_AUTOTICKS | TBS_BOTTOM | (Visible?WS_VISIBLE:0), - 0, 0, - 0, 0, - *fOwnerWindow, - (HMENU)fControlID, - plWndCtrls::Instance() - ); - } - - bool InterceptControlCommand( unsigned int Message, unsigned int wParam, LONG lParam ) - { - if ( Message==WM_HSCROLL && LOWORD(wParam)==TB_THUMBTRACK ) {fThumbTrackDelegate(); return 1;} - else if( Message==WM_HSCROLL ) {fThumbPositionDelegate(); return 1;} - else return 0; - } - - void SetTicFreq( int TicFreq ) - { - SendMessage( *this, TBM_SETTICFREQ, TicFreq, 0 ); - } - void SetRange( int Min, int Max ) - { - SendMessage( *this, TBM_SETRANGE, 1, MAKELONG(Min,Max) ); - } - void SetPos( int Pos ) - { - SendMessage( *this, TBM_SETPOS, 1, Pos ); - } - int GetRangeMin() - { - return SendMessage(*this, TBM_GETRANGEMIN, 0, 0); - } - int GetRangeMax() - { - return SendMessage(*this, TBM_GETRANGEMAX, 0, 0); - } - int GetPos() const - { - return SendMessage( *this, TBM_GETPOS, 0, 0 ); - } - std::string IGetValue() const - { - char tmp[20]; - sprintf(tmp,"%d",GetPos()); - return tmp; - } - void ISetValue(const char * value) - { - SetPos(atoi(value)); - } -}; - -#endif // plTrackBar_h_inc diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/plWindow.h b/Sources/Plasma/PubUtilLib/plWndCtrls/plWindow.h deleted file mode 100644 index 20745137..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/plWindow.h +++ /dev/null @@ -1,661 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef plWindow_h_inc -#define plWindow_h_inc - -class plControl; - -#include - - -class plWindow -: public plClass // plClass _must_ be the first base class in list. -, public plConfigValueBase -{ -public: - HWND fhWnd; - WORD fControlID; - WORD fTopControlID; - bool fDestroyed; - bool fMdiChild; - plWindow * fOwnerWindow; - std::vector fControls; - HWND & Handle() { return fhWnd;} - const HWND & Handle() const { return fhWnd;} - bool fEdited; - - static int _ModalCount; - static std::vector _Windows; - static std::vector _DeleteWindows; - static LONG APIENTRY StaticWndProc(HWND hWnd, unsigned int message, unsigned int wParam, LONG lParam ) - { - // look for this hwnd in window list - int i; - for(i=0; i<_Windows.size(); i++ ) - if( _Windows[i]->Handle()==hWnd ) - break; - if (i==_Windows.size()) - { -// hsStatusMessage("hwnd not found in _Windows.\n"); - } - - // if window not found and this is WM_NCCREATE or WM_INITDIALOG msg... - if( i==_Windows.size() && (message==WM_NCCREATE || message==WM_INITDIALOG || message==WM_ACTIVATE) ) - { - // get the plWindow object - plWindow * WindowCreate - = message!=WM_NCCREATE - ? (plWindow*)lParam - : (GetWindowLong(hWnd,GWL_EXSTYLE) & WS_EX_MDICHILD) - ? (plWindow*)((MDICREATESTRUCT*)((CREATESTRUCT*)lParam)->lpCreateParams)->lParam - : (plWindow*)((CREATESTRUCT*)lParam)->lpCreateParams; - CHECK(WindowCreate); - CHECK(!WindowCreate->Handle()); - - // set the hwnd for this plWindow - WindowCreate->Handle() = hWnd; - // look for this plWindow in window list - for( i=0; i<_Windows.size(); i++ ) - if( _Windows[i]==WindowCreate ) - break; - if (i==_Windows.size()) - { - hsStatusMessage("plWindow not found in _Windows.\n"); - } - CHECK(i<_Windows.size()); - } - // if window not found and message is not WM_NCCREATE or WM_INITDIALOG msg... - if( i==_Windows.size() ) - { - // Gets through before WM_NCCREATE: WM_GETMINMAXINFO - return DefWindowProc( hWnd, message, wParam, lParam ); - } - else - { - // call the plWindow class's message handler - return _Windows[i]->WndProc( message, wParam, lParam ); - } - } - static WNDPROC RegisterWindowClass( const wchar_t * name, DWORD style, int iconId=0 ) - { -#ifdef UNICODE - WNDCLASSEX cls; - HSMemory::ClearMemory( &cls, sizeof(cls) ); - cls.cbSize = sizeof(cls); - cls.style = style; - cls.lpfnWndProc = StaticWndProc; - cls.hInstance = plWndCtrls::Instance(); - cls.hIcon = LoadIcon(plWndCtrls::Instance(),MAKEINTRESOURCE(iconId)); - cls.lpszClassName = name; - cls.hIconSm = LoadIcon(plWndCtrls::Instance(),MAKEINTRESOURCE(iconId)); - CHECK(RegisterClassEx( &cls )); -#else - char *cName = hsWStringToString(name); - WNDCLASSEX cls; - HSMemory::ClearMemory( &cls, sizeof(cls) ); - cls.cbSize = sizeof(cls); - cls.style = style; - cls.lpfnWndProc = StaticWndProc; - cls.hInstance = plWndCtrls::Instance(); - cls.hIcon = LoadIcon(plWndCtrls::Instance(),MAKEINTRESOURCE(iconId)); - cls.lpszClassName = cName; - cls.hIconSm = LoadIcon(plWndCtrls::Instance(),MAKEINTRESOURCE(iconId)); - CHECK(RegisterClassEx( &cls )); - delete [] cName; -#endif - return nil; - } - - plWindow( plWindow * ownerWindow=nil ) - : fhWnd (nil) - , fControlID (0) - , fTopControlID (FIRST_AUTO_CONTROL) - , fDestroyed (0) - , fMdiChild (0) - , fOwnerWindow (ownerWindow) - , fEdited (false) - { - fReadEvaluate = plEvaluate(this,(TEvaluate)HasConfigName); - fWriteEvaluate = plEvaluate(this,(TEvaluate)HasConfigName); - } - virtual ~plWindow() - { - MaybeDestroy(); - std::vector::iterator it = std::find(_DeleteWindows.begin(),_DeleteWindows.end(),this); - if (it!=_DeleteWindows.end()) - _DeleteWindows.erase(it); - } - - plRect GetClientRect() const - { - RECT R; - ::GetClientRect( Handle(), &R ); - return plRect( R ); - } - plRect GetUpdateRect(bool erase) const - { - RECT R; - ::GetUpdateRect(*this,&R,erase); - return plRect(R); - } - void MoveWindow( plRect R, bool bRepaint ) - { - ::MoveWindow( Handle(), R.Min.X, R.Min.Y, R.Width(), R.Height(), bRepaint ); - } - plRect GetWindowRect() const - { - RECT R; - ::GetWindowRect( Handle(), &R ); - return fOwnerWindow ? fOwnerWindow->ScreenToClient(R) : plRect(R); - } - plPoint ClientToScreen( const plPoint& inP ) - { - POINT P; - P.x = inP.X; - P.y = inP.Y; - ::ClientToScreen( Handle(), &P ); - return plPoint( P.x, P.y ); - } - plPoint ScreenToClient( const plPoint& inP ) - { - POINT P; - P.x = inP.X; - P.y = inP.Y; - ::ScreenToClient( Handle(), &P ); - return plPoint( P.x, P.y ); - } - plRect ClientToScreen( const plRect& inR ) - { - return plRect( ClientToScreen(inR.Min), ClientToScreen(inR.Max) ); - } - plRect ScreenToClient( const plRect& inR ) - { - return plRect( ScreenToClient(inR.Min), ScreenToClient(inR.Max) ); - } - plPoint GetCursorPos() - { - plPoint mouse; - ::GetCursorPos( mouse ); - return ScreenToClient( mouse ); - } - void Show( bool show = true ) - { - ShowWindow( Handle(), show ? SW_SHOW : SW_HIDE ); - } - void ShowHow( int how ) - { - ShowWindow( Handle(), how ); - } - void Hide() - { - Show(false); - } - bool IsVisible() - { - return ::IsWindowVisible(*this)?true:false; - } - - virtual void DoDestroy() - { - if( Handle() ) - DestroyWindow( *this ); - std::vector::iterator it = std::find(_Windows.begin(),_Windows.end(),this); - if (it!=_Windows.end()) - _Windows.erase(it); - } - virtual void GetWindowClassName( wchar_t * result )=0; - virtual LONG WndProc( unsigned int message, unsigned int wParam, LONG lParam ) - { - try - { - if( message==WM_DESTROY ) - { - OnDestroy(); - } - else if( message==WM_DRAWITEM ) - { - DRAWITEMSTRUCT * Info = (DRAWITEMSTRUCT*)lParam; - for( int i=0; iHandle()==Info->hwndItem ) - {((plWindow*)fControls[i])->OnDrawItem(Info); break;} - return 1; - } - else if( message==WM_MEASUREITEM ) - { - MEASUREITEMSTRUCT * Info = (MEASUREITEMSTRUCT*)lParam; - for( int i=0; ifControlID==Info->CtlID ) - {((plWindow*)fControls[i])->OnMeasureItem(Info); break;} - return 1; - } - else if ( message==WM_NOTIFY ) - { - OnNotify((int)wParam,(LPNMHDR)lParam); - } - else if( message==WM_CLOSE ) - { - OnClose(); - } - else if( message==WM_CHAR ) - { - if (!OnChar( wParam )) // give the control a chance to filter input - return FALSE; - } - else if( message==WM_KEYDOWN ) - { - OnKeyDown( wParam ); - } - else if( message==WM_KEYUP ) - { - OnKeyUp( wParam ); - } - else if( message==WM_PAINT ) - { - OnPaint(); - } - else if( message==WM_CREATE ) - { - OnCreate(); - } - else if( message==WM_TIMER ) - { - OnTimer( (int)wParam ); - } - else if( message==WM_INITDIALOG ) - { - OnInitDialog(); - } - else if( message==WM_SETFOCUS ) - { - OnSetFocus( (HWND)wParam ); - } - else if( message==WM_ACTIVATE ) - { - OnActivate( LOWORD(wParam)!=0 ); - } - else if( message==WM_KILLFOCUS ) - { - OnKillFocus( (HWND)wParam ); - } - else if( message==WM_SIZE ) - { - OnSize( wParam, LOWORD(lParam), HIWORD(lParam) ); - } - else if( message==WM_PASTE ) - { - OnPaste(); - } - else if( message==WM_SHOWWINDOW ) - { - OnShowWindow( wParam?true:false ); - } - else if( message==WM_COPYDATA ) - { - OnCopyData( (HWND)wParam, (COPYDATASTRUCT*)lParam ); - } - else if( message==WM_CAPTURECHANGED ) - { - OnReleaseCapture(); - } - else if( message==WM_MDIACTIVATE ) - { - OnMdiActivate( (HWND)lParam==Handle()); - } - else if( message==WM_MOUSEMOVE ) - { - OnMouseMove( wParam, plPoint(LOWORD(lParam), HIWORD(lParam)) ); - } - else if( message==WM_LBUTTONDOWN ) - { - OnLeftButtonDown(); - } - else if( message==WM_RBUTTONDOWN ) - { - OnRightButtonDown(); - } - else if( message==WM_LBUTTONUP ) - { - OnLeftButtonUp(); - } - else if( message==WM_RBUTTONUP ) - { - OnRightButtonUp(); - } - else if( message==WM_CUT ) - { - OnCut(); - } - else if( message==WM_COPY ) - { - OnCopy(); - } - else if( message==WM_UNDO ) - { - OnUndo(); - } - else if( message==WM_SETCURSOR ) - { - if( OnSetCursor() ) - return 1; - } - else if( message==WM_COMMAND || message==WM_HSCROLL || message==WM_VSCROLL ) - { - for( int i=0; iHandle() - && ((plWindow*)fControls[i])->InterceptControlCommand(message,wParam,lParam) ) - return 1; - OnCommand( wParam ); - } - else if ( message==WM_SYSCOMMAND ) - { - OnSysCommand( wParam ); - } - return CallDefaultProc( message, wParam, lParam ); - } - catch( const char * e ) - { - hsStatusMessage( e ); - hsStatusMessage("\n"); - return 0; - } - } - virtual int CallDefaultProc( unsigned int message, unsigned int wParam, LONG lParam ) - { - if( fMdiChild ) - return DefMDIChildProc( Handle(), message, wParam, lParam ); - else - return DefWindowProc( Handle(), message, wParam, lParam ); - } - virtual bool InterceptControlCommand( unsigned int message, unsigned int wParam, LONG lParam ) - { - return 0; - } - virtual std::wstring GetText() const - { - CHECK(Handle()); - int length = GetLength(); - std::wstring result; - if (length==0) - return result; - result.resize(length); - SendMessage( *this, WM_GETTEXT, length+1, (LPARAM)result.data() ); - return result; - } - virtual void SetText( const wchar_t * text ) - { - CHECK(Handle()); - SendMessage( *this, WM_SETTEXT, 0, (LPARAM)text ); - } - virtual void SetTextF( const wchar_t * fmt, ... ) - { - va_list args; - va_start( args, fmt ); - SetTextV( fmt, args ); - va_end( args ); - } - virtual void SetTextV( const wchar_t * fmt, va_list args ) - { - std::wstring s; - xtl::formatv( s, fmt, args ); - SetText( s.c_str() ); - } - virtual void SetEnabled(bool enabled) - { - CHECK(Handle()); - EnableWindow(*this,enabled); - } - virtual bool IsEnabled() - { - return IsWindowEnabled(*this)?true:false; - } - virtual int GetLength() const - { - CHECK(Handle()); - return SendMessage( *this, WM_GETTEXTLENGTH, 0, 0 ); - } - virtual void SetFocus() - { - ::SetFocus(*this); - } - virtual void Activate() - { - ::SetActiveWindow(*this); - } - - // plWindow notifications. - virtual void OnNotify( int idCtrl, LPNMHDR pnmh ) - {} - virtual void OnCopyData( HWND hWndSender, COPYDATASTRUCT * CD ) - {} - virtual void OnSetFocus( HWND hWndLosingFocus ) - {} - virtual void OnKillFocus( HWND hWndGainingFocus ) - {} - virtual void OnSize( DWORD flags, int newX, int newY ) - {} - virtual void OnCommand( int command ) - {} - virtual void OnSysCommand( int command ) - {} - virtual void OnActivate( bool active ) - {} - virtual LONG OnChar( char ch ) // Return TRUE if you want to let the default handler grab it, FALSE if you don't - {return TRUE;} - virtual void OnKeyDown( UInt16 ch ) - {} - virtual void OnKeyUp( UInt16 ch ) - {} - virtual void OnCut() - {} - virtual void OnCopy() - {} - virtual void OnPaste() - {} - virtual void OnShowWindow( bool bShow ) - {} - virtual void OnUndo() - {} - virtual void OnPaint() - {} - virtual void OnCreate() - {} - virtual void OnDrawItem( DRAWITEMSTRUCT * info ) - {} - virtual void OnMeasureItem( MEASUREITEMSTRUCT * info ) - {} - virtual void OnInitDialog() - {} - virtual void OnMouseEnter() - {} - virtual void OnMouseLeave() - {} - virtual void OnMouseHover() - {} - virtual void OnTimer( int timer ) - {} - virtual void OnReleaseCapture() - {} - virtual void OnMdiActivate( bool active ) - {} - virtual void OnMouseMove( DWORD flags, plPoint location ) - {} - virtual void OnLeftButtonDown() - {} - virtual void OnRightButtonDown() - {} - virtual void OnLeftButtonUp() - {} - virtual void OnRightButtonUp() - {} - virtual int OnSetCursor() - { - return 0; - } - virtual void OnClose() - { - DestroyWindow( *this ); - } - virtual void OnDestroy() - { - CHECK(Handle()); - std::vector::iterator it = std::find(_Windows.begin(),_Windows.end(),this); - if (it!=_Windows.end()) - _Windows.erase(it); - Handle() = nil; - } - - // plWindow functions. - void MaybeDestroy() - { - if( !fDestroyed ) - { - fDestroyed=1; - DoDestroy(); - } - } - void _CloseWindow() - { - CHECK(Handle()); - DestroyWindow( *this ); - } - operator HWND() const - { - return Handle(); - } - void SetFont( HFONT hFont ) - { - SendMessage( *this, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(0,0) ); - } - void SetSmallIcon( HICON hIcon ) - { - SendMessage( *this, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); - } - void SetBigIcon( HICON hIcon ) - { - SendMessage( *this, WM_SETICON, ICON_BIG, (LPARAM)hIcon); - } - void PerformCreateWindowEx( - DWORD dwExStyle, - LPCTSTR lpWindowName, - DWORD dwStyle, - int x, int y, - int nWidth, int nHeight, - HWND hWndParent, - HMENU hMenu, - HINSTANCE hInstance) - { - CHECK(Handle()==nil); - _Windows.push_back( this ); - - wchar_t className[256]; - GetWindowClassName( className ); -#ifdef UNICODE - HWND hWndCreated = CreateWindowEx( - dwExStyle, - className, - lpWindowName, - dwStyle,x,y, - nWidth,nHeight, - hWndParent,hMenu, - plWndCtrls::Instance(), - this); -#else - char *cClassName = hsWStringToString(className); - HWND hWndCreated = CreateWindowEx( - dwExStyle, - cClassName, - lpWindowName, - dwStyle,x,y, - nWidth,nHeight, - hWndParent,hMenu, - plWndCtrls::Instance(), - this); - delete [] cClassName; -#endif - -/* -#define SAFE(s) ((s)?s:"null") - - std::strstream str; - str - << "vars: " << std::endl - << dwExStyle << std::endl - << SAFE(className) << std::endl - << SAFE(lpWindowName) << std::endl - << dwStyle << std::endl - << x << std::endl - << y << std::endl - << nWidth << std::endl - << nHeight << std::endl - << hWndParent << std::endl - << hMenu << std::endl - << plWndCtrls::Instance() << std::endl - << '\0'; - MessageBox(nil,str.str(),"",MB_OK); - str.freeze(false); -*/ - - if( !hWndCreated ) - hsStatusMessage( "CreateWindowEx failed" ); - CHECK(hWndCreated); - CHECK(hWndCreated==Handle()); - } - void SetRedraw( bool redraw ) - { - SendMessage( *this, WM_SETREDRAW, redraw, 0 ); - } - - // plConfigValueBase - std::string IGetValue() const - { - std::string sText = ""; - char *temp = hsWStringToString(GetText().c_str()); - sText = temp; - delete [] temp; - return sText; - } - void ISetValue(const char * value) - { - wchar_t *wValue = hsStringToWString(value); - SetText(wValue); - delete [] wValue; - } - virtual void SetEdited(bool value) - { - fEdited = value; - } - virtual bool Edited() const - { - return fEdited; - } -}; - - - - - -#endif plWindow_h_inc diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/plWndCtrls.cpp b/Sources/Plasma/PubUtilLib/plWndCtrls/plWndCtrls.cpp deleted file mode 100644 index 8625a3d4..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/plWndCtrls.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#include "hsTypes.h" - -#include "plWndCtrls.h" -#include "basewnd.h" - -#if HS_BUILD_FOR_WIN32 - -//////////////////////////////////////////////////////////////////// - -int plWindow::_ModalCount = 0; -std::vector plWindow::_Windows; -std::vector plWindow::_DeleteWindows; - -//////////////////////////////////////////////////////////////////// - -WNDPROC plButton::_SuperProc = nil; -WNDPROC plCheckBox::_SuperProc = nil; -WNDPROC plRadioButton::_SuperProc = nil; -WNDPROC plEdit::_SuperProc = nil; -WNDPROC plLabel::_SuperProc = nil; -WNDPROC plProgressBar::_SuperProc = nil; -WNDPROC plTrackBar::_SuperProc = nil; -WNDPROC plComboBox::_SuperProc = nil; -WNDPROC plListBox::_SuperProc = nil; -WNDPROC plStatusBar::_SuperProc = nil; - -//////////////////////////////////////////////////////////////////// - -HINSTANCE plWndCtrls::hInstance = nil; -DWORD plWndCtrls::fLanguage = 0; - -//////////////////////////////////////////////////////////////////// - -void plWndCtrls::Init(HINSTANCE hInst) -{ - hInstance = hInst; - - CoInitialize(NULL); - - INITCOMMONCONTROLSEX icex; - icex.dwSize = sizeof(INITCOMMONCONTROLSEX); - icex.dwICC = ICC_BAR_CLASSES; - InitCommonControlsEx(&icex); - - REGISTER_WINDOWSUBCLASS(plEdit,L"EDIT"); - REGISTER_WINDOWSUBCLASS(plButton,L"BUTTON"); - REGISTER_WINDOWSUBCLASS(plCheckBox,L"BUTTON"); - REGISTER_WINDOWSUBCLASS(plRadioButton,L"BUTTON"); - REGISTER_WINDOWSUBCLASS(plLabel,L"STATIC"); - REGISTER_WINDOWSUBCLASS(plComboBox,L"COMBOBOX"); - REGISTER_WINDOWSUBCLASS(plListBox,L"LISTBOX"); - REGISTER_WINDOWSUBCLASS(plTrackBar,TRACKBAR_CLASS); - REGISTER_WINDOWSUBCLASS(plProgressBar,PROGRESS_CLASS); - REGISTER_WINDOWSUBCLASS(plStatusBar,STATUSCLASSNAME); - - basewnd::Initialize( hInst ); -} - -void plWndCtrls::Shutdown() -{ - CoUninitialize(); -} - - -//////////////////////////////////////////////////////////////////// -#endif // HS_BUILD_FOR_WIN32 diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/plWndCtrls.h b/Sources/Plasma/PubUtilLib/plWndCtrls/plWndCtrls.h deleted file mode 100644 index 655fdb73..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/plWndCtrls.h +++ /dev/null @@ -1,307 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef plWndCtrls_h_inc -#define plWndCtrls_h_inc - -#include "hsConfig.h" - - -#if HS_BUILD_FOR_WIN32 - -#include "hsUtils.h" -#include "hsMemory.h" -#include "../plContainer/plConfigInfo.h" - -#include -#include -#include -#include -#include - -//////////////////////////////////////////////////////////////////// - -class plWndCtrls -{ -public: - static void Init(HINSTANCE hInst); - static void Shutdown(); - static HINSTANCE Instance() { return hInstance;} - static void MakeWndClassName(wchar_t * result, const wchar_t * base) - { - swprintf(result, L"Plasma_%s", base); - } - static void SetLanguage(DWORD lang) { fLanguage = lang; } - static DWORD GetLanguage() { return fLanguage; } - -private: - static HINSTANCE hInstance; - static DWORD fLanguage; - plWndCtrls(); - plWndCtrls & operator=(const plWndCtrls &); -}; - -//////////////////////////////////////////////////////////////////// - -#define CHECK(c) hsAssert(c,#c) -#define N_ELEMENTS(a) ( sizeof(a) / sizeof((a)[0]) ) - -template inline T Max(const T & A, const T & B){return (A>=B)?A:B;} -template inline T Min(const T & A, const T & B){return (A<=B)?A:B;} - - -//////////////////////////////////////////////////////////////////// -// Window class definition macros. - - -#define DECLARE_WINDOWCLASS(cls,parentcls) \ -public: \ - void GetWindowClassName( wchar_t * result ) {plWndCtrls::MakeWndClassName(result,L#cls);} - -#define DECLARE_WINDOWSUBCLASS(cls,parentcls) \ - DECLARE_WINDOWCLASS(cls,parentcls) \ - static WNDPROC _SuperProc; - -#define REGISTER_WINDOWCLASS(cls,clsf) \ - {wchar_t Temp[256]; plWndCtrls::MakeWndClassName(Temp,L#cls); cls::RegisterWindowClass( Temp, clsf );} - -#define REGISTER_WINDOWCLASSWITHICON(cls,clsf,iconid) \ - {wchar_t Temp[256]; plWndCtrls::MakeWndClassName(Temp,L#cls); cls::RegisterWindowClass( Temp, clsf, iconid );} - -#define REGISTER_WINDOWSUBCLASS(cls,wincls) \ - {wchar_t Temp[256]; plWndCtrls::MakeWndClassName(Temp,L#cls); cls::_SuperProc = cls::RegisterWindowClass( Temp, wincls );} - -#define FIRST_AUTO_CONTROL 8192 - - -//////////////////////////////////////////////////////////////////// - -struct plPoint -{ - int X, Y; - plPoint() - {} - plPoint( int InX, int InY ) - : X( InX ) - , Y( InY ) - {} - static plPoint ZeroValue() - { - return plPoint(0,0); - } - static plPoint NoneValue() - { - return plPoint(-1,-1); - } - operator POINT*() const - { - return (POINT*)this; - } - const int& operator()( int i ) const - { - return (&X)[i]; - } - int& operator()( int i ) - { - return (&X)[i]; - } - static int Num() - { - return 2; - } - bool operator==( const plPoint& Other ) const - { - return X==Other.X && Y==Other.Y; - } - bool operator!=( const plPoint& Other ) const - { - return X!=Other.X || Y!=Other.Y; - } - plPoint& operator+=( const plPoint& Other ) - { - X += Other.X; - Y += Other.Y; - return *this; - } - plPoint& operator-=( const plPoint& Other ) - { - X -= Other.X; - Y -= Other.Y; - return *this; - } - plPoint operator+( const plPoint& Other ) const - { - return plPoint(*this) += Other; - } - plPoint operator-( const plPoint& Other ) const - { - return plPoint(*this) -= Other; - } -}; - -//////////////////////////////////////////////////////////////////// - -struct plRect -{ - plPoint Min, Max; - plRect() - {} - plRect( int X0, int Y0, int X1, int Y1 ) - : Min( X0, Y0 ) - , Max( X1, Y1 ) - {} - plRect( plPoint InMin, plPoint InMax ) - : Min( InMin ) - , Max( InMax ) - {} - plRect( RECT R ) - : Min( R.left, R.top ) - , Max( R.right, R.bottom ) - {} - operator RECT*() const - { - return (RECT*)this; - } - const plPoint& operator()( int i ) const - { - return (&Min)[i]; - } - plPoint& operator()( int i ) - { - return (&Min)[i]; - } - bool operator==( const plRect& Other ) const - { - return Min==Other.Min && Max==Other.Max; - } - bool operator!=( const plRect& Other ) const - { - return Min!=Other.Min || Max!=Other.Max; - } - plRect Right( int Width ) - { - return plRect( ::Max(Min.X,Max.X-Width), Min.Y, Max.X, Max.Y ); - } - plRect Bottom( int Height ) - { - return plRect( Min.X, ::Max(Min.Y,Max.Y-Height), Max.X, Max.Y ); - } - plPoint Size() - { - return plPoint( Max.X-Min.X, Max.Y-Min.Y ); - } - void Resize(plPoint size) - { - Max.X=Min.X+size.X; - Max.Y=Min.Y+size.Y; - } - int Width() - { - return Max.X-Min.X; - } - int Height() - { - return Max.Y-Min.Y; - } - plRect& operator+=( const plPoint& P ) - { - Min += P; - Max += P; - return *this; - } - plRect& operator-=( const plPoint& P ) - { - Min -= P; - Max -= P; - return *this; - } - plRect operator+( const plPoint& P ) const - { - return plRect( Min+P, Max+P ); - } - plRect operator-( const plPoint& P ) const - { - return plRect( Min-P, Max-P ); - } - plRect operator+( const plRect& R ) const - { - return plRect( Min+R.Min, Max+R.Max ); - } - plRect operator-( const plRect& R ) const - { - return plRect( Min-R.Min, Max-R.Max ); - } - plRect Inner( plPoint P ) const - { - return plRect( Min+P, Max-P ); - } - bool Contains( plPoint P ) const - { - return P.X>=Min.X && P.X=Min.Y && P.Y*fDelegate)();} } -}; - -//////////////////////////////////////////////////////////////////// -// include private headers - -// 'this' : used in base member initializer list -#pragma warning(disable:4355) - -#include "plWindow.h" -#include "plControl.h" -#include "plLabel.h" -#include "plButton.h" -#include "plCheckBox.h" -#include "plRadioButton.h" -#include "plComboBox.h" -#include "plEdit.h" -#include "plButton.h" -#include "plDialog.h" -#include "plTrackBar.h" -#include "plProgressBar.h" -#include "plListBox.h" -#include "plStatusBar.h" - -#pragma warning(default:4355) - -//////////////////////////////////////////////////////////////////// -#endif // HS_BUILD_FOR_WIN32 -#endif // plWndCtrls_h_inc diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/webhost.cpp b/Sources/Plasma/PubUtilLib/plWndCtrls/webhost.cpp deleted file mode 100644 index 5be09667..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/webhost.cpp +++ /dev/null @@ -1,495 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#include "hsTypes.h" -#include "hsConfig.h" -#if HS_BUILD_FOR_WIN32 - -// Stolen from: http://www.mvps.org/user32/webhost.cab -// No copyright notices, so I assume it's public domain -Colin -#include "webhost.h" -#include "plWndCtrls.h" - -// IUnknown - -STDMETHODIMP CNullStorage::QueryInterface(REFIID riid,void ** ppvObject) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP_(ULONG) CNullStorage::AddRef(void) -{ - return 1; -} - -STDMETHODIMP_(ULONG) CNullStorage::Release(void) -{ - return 1; -} - - -// IStorage -STDMETHODIMP CNullStorage::CreateStream(const WCHAR * pwcsName,DWORD grfMode,DWORD reserved1,DWORD reserved2,IStream ** ppstm) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CNullStorage::OpenStream(const WCHAR * pwcsName,void * reserved1,DWORD grfMode,DWORD reserved2,IStream ** ppstm) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CNullStorage::CreateStorage(const WCHAR * pwcsName,DWORD grfMode,DWORD reserved1,DWORD reserved2,IStorage ** ppstg) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CNullStorage::OpenStorage(const WCHAR * pwcsName,IStorage * pstgPriority,DWORD grfMode,SNB snbExclude,DWORD reserved,IStorage ** ppstg) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CNullStorage::CopyTo(DWORD ciidExclude,IID const * rgiidExclude,SNB snbExclude,IStorage * pstgDest) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CNullStorage::MoveElementTo(const OLECHAR * pwcsName,IStorage * pstgDest,const OLECHAR* pwcsNewName,DWORD grfFlags) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CNullStorage::Commit(DWORD grfCommitFlags) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CNullStorage::Revert(void) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CNullStorage::EnumElements(DWORD reserved1,void * reserved2,DWORD reserved3,IEnumSTATSTG ** ppenum) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CNullStorage::DestroyElement(const OLECHAR * pwcsName) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CNullStorage::RenameElement(const WCHAR * pwcsOldName,const WCHAR * pwcsNewName) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CNullStorage::SetElementTimes(const WCHAR * pwcsName,FILETIME const * pctime,FILETIME const * patime,FILETIME const * pmtime) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CNullStorage::SetClass(REFCLSID clsid) -{ - return S_OK; -} - -STDMETHODIMP CNullStorage::SetStateBits(DWORD grfStateBits,DWORD grfMask) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CNullStorage::Stat(STATSTG * pstatstg,DWORD grfStatFlag) -{ - NOTIMPLEMENTED; -} - - - - -STDMETHODIMP CMySite::QueryInterface(REFIID riid,void ** ppvObject) -{ - if(riid == IID_IUnknown || riid == IID_IOleClientSite) - *ppvObject = (IOleClientSite*)this; - else if(riid == IID_IOleInPlaceSite) // || riid == IID_IOleInPlaceSiteEx || riid == IID_IOleInPlaceSiteWindowless) - *ppvObject = (IOleInPlaceSite*)this; - else - { - *ppvObject = NULL; - return E_NOINTERFACE; - } - - return S_OK; -} - -STDMETHODIMP_(ULONG) CMySite::AddRef(void) -{ - return 1; -} - -STDMETHODIMP_(ULONG) CMySite::Release(void) -{ - return 1; -} - - -// IOleClientSite - -STDMETHODIMP CMySite::SaveObject() -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CMySite::GetMoniker(DWORD dwAssign,DWORD dwWhichMoniker,IMoniker ** ppmk) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CMySite::GetContainer(LPOLECONTAINER FAR* ppContainer) -{ - // We are a simple object and don't support a container. - *ppContainer = NULL; - - return E_NOINTERFACE; -} - -STDMETHODIMP CMySite::ShowObject() -{ - // NOTIMPLEMENTED; - // huh? - return NOERROR; -} - -STDMETHODIMP CMySite::OnShowWindow(BOOL fShow) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CMySite::RequestNewObjectLayout() -{ - NOTIMPLEMENTED; -} - -// IOleWindow - -STDMETHODIMP CMySite::GetWindow(HWND FAR* lphwnd) -{ - *lphwnd = host->hwnd; - - return S_OK; -} - -STDMETHODIMP CMySite::ContextSensitiveHelp(BOOL fEnterMode) -{ - NOTIMPLEMENTED; -} - -// IOleInPlaceSite - - -STDMETHODIMP CMySite::CanInPlaceActivate() -{ - // Yes we can - return S_OK; -} - -STDMETHODIMP CMySite::OnInPlaceActivate() -{ - // Why disagree. - return S_OK; -} - -STDMETHODIMP CMySite::OnUIActivate() -{ - return S_OK; -} - -STDMETHODIMP CMySite::GetWindowContext( - LPOLEINPLACEFRAME FAR* ppFrame, - LPOLEINPLACEUIWINDOW FAR* ppDoc, - LPRECT prcPosRect, - LPRECT prcClipRect, - LPOLEINPLACEFRAMEINFO lpFrameInfo) -{ - *ppFrame = &host->frame; - *ppDoc = NULL; - GetClientRect(host->hwnd,prcPosRect); - GetClientRect(host->hwnd,prcClipRect); - - lpFrameInfo->fMDIApp = FALSE; - lpFrameInfo->hwndFrame = host->hwnd; - lpFrameInfo->haccel = NULL; - lpFrameInfo->cAccelEntries = 0; - - return S_OK; -} - -STDMETHODIMP CMySite::Scroll(SIZE scrollExtent) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CMySite::OnUIDeactivate(BOOL fUndoable) -{ - return S_OK; -} - -STDMETHODIMP CMySite::OnInPlaceDeactivate() -{ - return S_OK; -} - -STDMETHODIMP CMySite::DiscardUndoState() -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CMySite::DeactivateAndUndo() -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CMySite::OnPosRectChange(LPCRECT lprcPosRect) -{ - return S_OK; -} - - -/////////////////////////////////////////////////////////////////////////////// -// -// CMyFrame -// - - -// IUnknown -STDMETHODIMP CMyFrame::QueryInterface(REFIID riid,void ** ppvObject) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP_(ULONG) CMyFrame::AddRef(void) -{ - return 1; -} - -STDMETHODIMP_(ULONG) CMyFrame::Release(void) -{ - return 1; -} - -// IOleWindow -STDMETHODIMP CMyFrame::GetWindow(HWND FAR* lphwnd) -{ - *lphwnd = this->host->hwnd; - return S_OK; - // NOTIMPLEMENTED; -} - -STDMETHODIMP CMyFrame::ContextSensitiveHelp(BOOL fEnterMode) -{ - NOTIMPLEMENTED; -} - -// IOleInPlaceUIWindow -STDMETHODIMP CMyFrame::GetBorder(LPRECT lprectBorder) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CMyFrame::RequestBorderSpace(LPCBORDERWIDTHS pborderwidths) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CMyFrame::SetBorderSpace(LPCBORDERWIDTHS pborderwidths) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CMyFrame::SetActiveObject(IOleInPlaceActiveObject *pActiveObject,LPCOLESTR pszObjName) -{ - return S_OK; -} - -// IOleInPlaceFrame -STDMETHODIMP CMyFrame::InsertMenus(HMENU hmenuShared,LPOLEMENUGROUPWIDTHS lpMenuWidths) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CMyFrame::SetMenu(HMENU hmenuShared,HOLEMENU holemenu,HWND hwndActiveObject) -{ - return S_OK; -} - -STDMETHODIMP CMyFrame::RemoveMenus(HMENU hmenuShared) -{ - NOTIMPLEMENTED; -} - -STDMETHODIMP CMyFrame::SetStatusText(LPCOLESTR pszStatusText) -{ - return S_OK; -} - -STDMETHODIMP CMyFrame::EnableModeless(BOOL fEnable) -{ - return S_OK; -} - -STDMETHODIMP CMyFrame::TranslateAccelerator( LPMSG lpmsg,WORD wID) -{ - NOTIMPLEMENTED; -} - - - -webhostwnd::webhostwnd() -{ - site.host = this; - frame.host = this; -} - -webhostwnd::~webhostwnd() -{ -} - -HWND webhostwnd::operator =(webhostwnd* rhs) -{ - return hwnd; -} - - -webhostwnd* webhostwnd::Create(HWND hParent, RECT& rect) -{ - webhostwnd* _this = TRACKED_NEW webhostwnd; - - CreateWindowEx( - 0, - szClassName,L"TheWebbyWindow", - WS_CHILD, - rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top, - hParent,NULL,plWndCtrls::Instance(),_this); - - int err = GetLastError(); - - return _this; -} - - -BOOL webhostwnd::HandleMessage(UINT uMsg,WPARAM wParam,LPARAM lParam,LRESULT* r) -{ - if(uMsg == WM_DESTROY) - { - UnCreateEmbeddedWebControl(); - PostQuitMessage(0); - return TRUE; - } - else if(uMsg == WM_CREATE) - { - CreateEmbeddedWebControl(); - return TRUE; - } - - return FALSE; -} - - -void webhostwnd::CreateEmbeddedWebControl(void) -{ - OleCreate(CLSID_WebBrowser,IID_IOleObject,OLERENDER_DRAW,0,&site,&storage,(void**)&mpWebObject); - - mpWebObject->SetHostNames(L"Web Host",L"Web View"); - - // I have no idea why this is necessary. remark it out and everything works perfectly. - OleSetContainedObject(mpWebObject,TRUE); - - RECT rect; - GetClientRect(hwnd,&rect); - - mpWebObject->DoVerb(OLEIVERB_SHOW,NULL,&site,-1,hwnd,&rect); - - IWebBrowser2* iBrowser; - mpWebObject->QueryInterface(IID_IWebBrowser2,(void**)&iBrowser); - - VARIANT vURL; - vURL.vt = VT_BSTR; - vURL.bstrVal = SysAllocString(L"about:blank"); - VARIANT ve1, ve2, ve3, ve4; - ve1.vt = VT_EMPTY; - ve2.vt = VT_EMPTY; - ve3.vt = VT_EMPTY; - ve4.vt = VT_EMPTY; - - iBrowser->put_Left(0); - iBrowser->put_Top(0); - iBrowser->put_Width(rect.right); - iBrowser->put_Height(rect.bottom); - - iBrowser->Navigate2(&vURL, &ve1, &ve2, &ve3, &ve4); - - VariantClear(&vURL); - - iBrowser->Release(); -} - - -void webhostwnd::UnCreateEmbeddedWebControl(void) -{ - mpWebObject->Close(OLECLOSE_NOSAVE); - mpWebObject->Release(); -} - -#include - -void webhostwnd::GoToPage(const char* address) -{ - IWebBrowser2* iBrowser; - mpWebObject->QueryInterface(IID_IWebBrowser2,(void**)&iBrowser); - - - _bstr_t s(address); - - VARIANT vURL; - vURL.vt = VT_BSTR; - vURL.bstrVal = SysAllocString(s); - VARIANT vHeaders; - vHeaders.vt = VT_EMPTY; - - VARIANT ve1, ve2, ve3; - ve1.vt = VT_EMPTY; - ve2.vt = VT_EMPTY; - ve3.vt = VT_EMPTY; - - iBrowser->Navigate2(&vURL, &ve1, &ve2, &ve3, &vHeaders); - - VariantClear(&vURL); - - iBrowser->Release(); -} - -// OleUninitialize(); - -#endif \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plWndCtrls/webhost.h b/Sources/Plasma/PubUtilLib/plWndCtrls/webhost.h deleted file mode 100644 index d3525e54..00000000 --- a/Sources/Plasma/PubUtilLib/plWndCtrls/webhost.h +++ /dev/null @@ -1,168 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -// Stolen from: http://www.mvps.org/user32/webhost.cab -// No copyright notices, so I assume it's public domain -Colin -#include -#include "basewnd.h" -#include -#include -#include - -#define NOTIMPLEMENTED __asm{ int 3 }; return E_NOTIMPL - - -struct CNullStorage -: public IStorage -{ - // IUnknown - STDMETHODIMP QueryInterface(REFIID riid,void ** ppvObject); - STDMETHODIMP_(ULONG) AddRef(void); - STDMETHODIMP_(ULONG) Release(void); - // IStorage - STDMETHODIMP CreateStream(const WCHAR * pwcsName,DWORD grfMode,DWORD reserved1,DWORD reserved2,IStream ** ppstm); - STDMETHODIMP OpenStream(const WCHAR * pwcsName,void * reserved1,DWORD grfMode,DWORD reserved2,IStream ** ppstm); - STDMETHODIMP CreateStorage(const WCHAR * pwcsName,DWORD grfMode,DWORD reserved1,DWORD reserved2,IStorage ** ppstg); - STDMETHODIMP OpenStorage(const WCHAR * pwcsName,IStorage * pstgPriority,DWORD grfMode,SNB snbExclude,DWORD reserved,IStorage ** ppstg); - STDMETHODIMP CopyTo(DWORD ciidExclude,IID const * rgiidExclude,SNB snbExclude,IStorage * pstgDest); - STDMETHODIMP MoveElementTo(const OLECHAR * pwcsName,IStorage * pstgDest,const OLECHAR* pwcsNewName,DWORD grfFlags); - STDMETHODIMP Commit(DWORD grfCommitFlags); - STDMETHODIMP Revert(void); - STDMETHODIMP EnumElements(DWORD reserved1,void * reserved2,DWORD reserved3,IEnumSTATSTG ** ppenum); - STDMETHODIMP DestroyElement(const OLECHAR * pwcsName); - STDMETHODIMP RenameElement(const WCHAR * pwcsOldName,const WCHAR * pwcsNewName); - STDMETHODIMP SetElementTimes(const WCHAR * pwcsName,FILETIME const * pctime,FILETIME const * patime,FILETIME const * pmtime); - STDMETHODIMP SetClass(REFCLSID clsid); - STDMETHODIMP SetStateBits(DWORD grfStateBits,DWORD grfMask); - STDMETHODIMP Stat(STATSTG * pstatstg,DWORD grfStatFlag); -}; - -struct webhostwnd; - - -struct CMyFrame -: public IOleInPlaceFrame -{ - webhostwnd* host; - // IUnknown - STDMETHODIMP QueryInterface(REFIID riid,void ** ppvObject); - STDMETHODIMP_(ULONG) AddRef(void); - STDMETHODIMP_(ULONG) Release(void); - // IOleWindow - STDMETHODIMP GetWindow(HWND FAR* lphwnd); - STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode); - // IOleInPlaceUIWindow - STDMETHODIMP GetBorder(LPRECT lprectBorder); - STDMETHODIMP RequestBorderSpace(LPCBORDERWIDTHS pborderwidths); - STDMETHODIMP SetBorderSpace(LPCBORDERWIDTHS pborderwidths); - STDMETHODIMP SetActiveObject(IOleInPlaceActiveObject *pActiveObject,LPCOLESTR pszObjName); - // IOleInPlaceFrame - STDMETHODIMP InsertMenus(HMENU hmenuShared,LPOLEMENUGROUPWIDTHS lpMenuWidths); - STDMETHODIMP SetMenu(HMENU hmenuShared,HOLEMENU holemenu,HWND hwndActiveObject); - STDMETHODIMP RemoveMenus(HMENU hmenuShared); - STDMETHODIMP SetStatusText(LPCOLESTR pszStatusText); - STDMETHODIMP EnableModeless(BOOL fEnable); - STDMETHODIMP TranslateAccelerator( LPMSG lpmsg,WORD wID); - -}; - - - -struct CMySite -: public IOleClientSite, -public IOleInPlaceSite -{ - webhostwnd* host; - - // IUnknown - STDMETHODIMP QueryInterface(REFIID riid,void ** ppvObject); - STDMETHODIMP_(ULONG) AddRef(void); - STDMETHODIMP_(ULONG) Release(void); - // IOleClientSite - STDMETHODIMP SaveObject(); - STDMETHODIMP GetMoniker(DWORD dwAssign,DWORD dwWhichMoniker,IMoniker ** ppmk); - STDMETHODIMP GetContainer(LPOLECONTAINER FAR* ppContainer); - STDMETHODIMP ShowObject(); - STDMETHODIMP OnShowWindow(BOOL fShow); - STDMETHODIMP RequestNewObjectLayout(); - // IOleWindow - STDMETHODIMP GetWindow(HWND FAR* lphwnd); - STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode); - // IOleInPlaceSite methods - STDMETHODIMP CanInPlaceActivate(); - STDMETHODIMP OnInPlaceActivate(); - STDMETHODIMP OnUIActivate(); - STDMETHODIMP GetWindowContext(LPOLEINPLACEFRAME FAR* lplpFrame,LPOLEINPLACEUIWINDOW FAR* lplpDoc,LPRECT lprcPosRect,LPRECT lprcClipRect,LPOLEINPLACEFRAMEINFO lpFrameInfo); - STDMETHODIMP Scroll(SIZE scrollExtent); - STDMETHODIMP OnUIDeactivate(BOOL fUndoable); - STDMETHODIMP OnInPlaceDeactivate(); - STDMETHODIMP DiscardUndoState(); - STDMETHODIMP DeactivateAndUndo(); - STDMETHODIMP OnPosRectChange(LPCRECT lprcPosRect); -}; - - -struct CMyContainer -: public IOleContainer -{ - // IUnknown - STDMETHODIMP QueryInterface(REFIID riid,void ** ppvObject); - STDMETHODIMP_(ULONG) AddRef(void); - STDMETHODIMP_(ULONG) Release(void); - // IParseDisplayName - STDMETHODIMP ParseDisplayName(IBindCtx *pbc,LPOLESTR pszDisplayName,ULONG *pchEaten,IMoniker **ppmkOut); - // IOleContainer - STDMETHODIMP EnumObjects(DWORD grfFlags,IEnumUnknown **ppenum); - STDMETHODIMP LockContainer(BOOL fLock); -}; - - -struct webhostwnd : public basewnd -{ - webhostwnd(); - ~webhostwnd(); - - static webhostwnd* Create(HWND hParent, RECT& rect); - - virtual BOOL HandleMessage(UINT,WPARAM,LPARAM,LRESULT*); - - void CreateEmbeddedWebControl(void); - void UnCreateEmbeddedWebControl(void); - - HWND operator =(webhostwnd* rhs); - - CNullStorage storage; - CMySite site; - CMyFrame frame; - - IOleObject* mpWebObject; - - void OnPaint(HDC hdc); - void GoToPage(const char* address); -}; - - - -