#include "ltwrappr.h"
L_BOOL LVectorWindow::HandlePalette(uMsg, wParam, lParam)
UINT uMsg; |
window message |
WPARAM wParam; |
first parameter of the window message |
LPARAM lParam; |
second parameter of the window message |
Call this function to let the vector window automatically handle the palette based on the specified message.
Parameter |
Description |
uMsg |
The window message. |
wParam |
The first parameter of the window message. |
lParam |
The second parameter of the window message. |
TRUE |
The vector window was repainted. |
FALSE |
The vector window was not repainted. |
This function works with the following Windows messages:
WM_PALETTECHANGED
WM_QUERYNEWPALETTE
WM_SYSCOLORCHANGE
This function will respond to these messages by automatically handling palette issues properly.
You are responsible for calling this function with the appropriate window message to let the class object's window respond to palette changes.
Required DLLs and Libraries
LVKRN For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Functions: |
The following example derives a class from LVectorWindow, and overrides HandlePalette, OnPaletteChanged, OnQueryNewPalette, OnSysColorChange, StartChanging, EndChanging member functions. The result is class that displays all vector window messages in the vector window title bar. To use this example, derive a class from LMyVectorWindow, and use the class object as you would a LVectorWindow object.
#include <stdio.h>
class LNewVectorWindow: public LVectorWindow
{
public:
LNewVectorWindow();
virtual ~LNewVectorWindow() ;
protected:
virtual LRESULT HandlePalette(UINT uMsg,WPARAM wParam,LPARAM lParam);
virtual L_VOID OnPaletteChanged();
virtual L_VOID OnQueryNewPalette();
virtual L_VOID OnSysColorChange();
virtual L_INT StartChanging(L_UINT nChangeType,L_UINT nChangeCategory);
virtual L_VOID EndChanging(L_UINT nChangeType,L_UINT nChangeCategory,L_INT nRetCode);
L_VOID DisplayMessage(L_TCHAR *lpszMsg);
};
LNewVectorWindow::LNewVectorWindow()
{
}
LNewVectorWindow::~LNewVectorWindow()
{
}
LRESULT LNewVectorWindow::HandlePalette(UINT uMsg,WPARAM wParam,LPARAM lParam)
{
L_TCHAR *lpszMsg;
switch (uMsg)
{
case WM_PALETTECHANGED:
lpszMsg = TEXT("WM_PALETTECHANGED");
break;
case WM_QUERYNEWPALETTE:
lpszMsg = TEXT("WM_QUERYNEWPALETTE");
break;
case WM_SYSCOLORCHANGE:
lpszMsg = TEXT("WM_SYSCOLORCHANGE");
break;
default:
lpszMsg = NULL;
}
DisplayMessage(lpszMsg);
return LVectorWindow::HandlePalette(uMsg, wParam, lParam);
}
L_VOID LNewVectorWindow::OnPaletteChanged()
{
DisplayMessage(TEXT("OnPaletteChanged"));
}
L_VOID LNewVectorWindow::OnQueryNewPalette()
{
DisplayMessage(TEXT("OnQueryNewPalette"));
}
L_VOID LNewVectorWindow::OnSysColorChange()
{
DisplayMessage(TEXT("OnSysColorChange"));
}
L_INT LNewVectorWindow::StartChanging(L_UINT nChangeType,L_UINT nChangeCategory)
{
L_TCHAR* lpszMsg = NULL;
switch(nChangeType)
{
case NC_VECTOR_PALETTE:
lpszMsg = TEXT("StartChanging[NC_VECTOR_PALETTE]");
break;
}
if (lpszMsg != NULL)
{
DisplayMessage(lpszMsg);
}
return LVectorWindow::StartChanging(nChangeType,nChangeCategory);
}
L_VOID LNewVectorWindow::EndChanging(L_UINT nChangeType,L_UINT nChangeCategory,L_INT nRetCode)
{
L_TCHAR *lpszMsg;
lpszMsg = NULL;
switch(nChangeType)
{
case NC_VECTOR_PALETTE:
lpszMsg = TEXT("EndChanging[NC_VECTOR_PALETTE]");
break;
}
if (lpszMsg != NULL)
{
DisplayMessage(lpszMsg);
}
LVectorWindow::EndChanging( nChangeType, nChangeCategory, nRetCode);
}
L_VOID LNewVectorWindow::DisplayMessage(L_TCHAR *lpszMsg)
{
if (lpszMsg != NULL)
{
HWND hWnd;
if (IsControl())
hWnd = ::GetParent(GetVectorWnd());
else
hWnd = GetVectorWnd();
SetWindowText(hWnd, lpszMsg);
}
}