LVectorWindow::HandlePalette

Summary

Call this function to let the vector window automatically handle the palette based on the specified message.

Syntax

#include "ltwrappr.h"

L_BOOL LVectorWindow::HandlePalette(uMsg, wParam, lParam)

Parameters

UINT uMsg

The window message.

WPARAM wParam

The first parameter of the window message.

LPARAM lParam

The second parameter of the window message.

Returns

Value Meaning
TRUE The vector window was repainted.
FALSE The vector window was not repainted.

Comments

This function works with the following Windows messages:

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

See Also

Functions

Example

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); 
   } 
} 
/***********************************************************************/ 

Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Vector C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.