/////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2003 - Don Kackman
//
// Distribute and change freely, but please don't remove my name from the source
//
// No warrantee of any kind, express or implied, is included with this
// software; use at your own risk, responsibility for damages (if any) to
// anyone resulting from the use of this software rests entirely with the
// user.
//
// The class CVisualStylesXp and the conept of theme browser app are borrowed from
// David Y Zhao. His example can be seen at http://www.codeproject.com/w2k/xpvisualstyle.asp
//
// questions - contact me at dkackman_2000@yahoo.com
//
#include "StdAfx.h"
#include ".\themepart.h"
#using <mscorlib.dll>
using namespace System::Windows::Forms::Themes;
#define DEFAULT_STATEID 0
ThemePart::ThemePart( int propTableIndex, IHasThemePartId* parent ) : ThemeItem( propTableIndex )
{
m_Parent = parent;
m_States = new StatesCollection( propTableIndex, get_Name(), this );
wchar_t szStates[] = L"PARTS";
m_ID = getID( szStates );
}
ThemePart::~ThemePart(void)
{
}
void ThemePart::DrawBackground( Graphics* graphics, System::Drawing::Rectangle Rect )
{
m_Parent->UxTheme->DrawBackground( graphics, m_ID, DEFAULT_STATEID, Rect );
}
void ThemePart::DrawBackground( Graphics* graphics, System::Drawing::Rectangle Rect, System::Drawing::Rectangle ClipRect )
{
m_Parent->UxTheme->DrawBackground( graphics, m_ID, DEFAULT_STATEID, Rect, ClipRect );
}
void ThemePart::DrawText( Graphics* graphics, String* Text, Int32 CharCount, DrawTextFlags TextFlags, bool Grayed, System::Drawing::Rectangle Rect )
{
m_Parent->UxTheme->DrawText( graphics, m_ID, DEFAULT_STATEID, Text, CharCount, TextFlags, Grayed, Rect );
}
void ThemePart::DrawText( Graphics* graphics, String* Text, DrawTextFlags TextFlags, bool Grayed, System::Drawing::Rectangle Rect )
{
m_Parent->UxTheme->DrawText( graphics, m_ID, DEFAULT_STATEID, Text, -1, TextFlags, Grayed, Rect );
}
System::Drawing::Color ThemePart::get_TextColor()
{
return m_Parent->UxTheme->GetColor( m_ID, DEFAULT_STATEID, TMT_TEXTCOLOR );
}
bool ThemePart::get_IsDefined()
{
return m_Parent->UxTheme->IsPartDefined( m_ID, DEFAULT_STATEID );
}
System::Drawing::Size ThemePart::GetSize( Graphics* graphics, ThemeSize eSize )
{
return m_Parent->UxTheme->GetPartSize( graphics, m_ID, DEFAULT_STATEID, eSize );
}