ReactOS  0.4.13-dev-563-g0561610
themedump.cpp File Reference
#include <cstdlib>
#include <cstdio>
#include <cwchar>
#include <iostream>
#include <exception>
#include <algorithm>
#include <functional>
#include <list>
#include <string>
#include <map>
#include <windows.h>
#include <commctrl.h>
#include <uxtheme.h>
#include <tmschema.h>
Include dependency graph for themedump.cpp:

Go to the source code of this file.

Classes

struct  tmdump::tm_property_t
 
struct  tmdump::tm_part_t
 
class  tmdump::print
 
class  tmdump::property_print
 
class  tmdump::part_print
 
class  tmdump::class_print
 
class  tmdump::schema_scan
 
struct  tmdump::state_mapping_t
 
class  tmdump::state_link
 

Namespaces

 tmdump
 

Macros

#define WIN32_LEAN_AND_MEAN
 
#define UNICODE
 
#define SCHEMA_STRINGS
 
#define TMT_ENUMDEF   (0x0D)
 
#define TMT_ENUMVAL   (0x0E)
 
#define TMT_ENUM   (0x0F)
 

Typedefs

typedef std::map< int, std::wstring > tmdump::tm_enum_t
 
typedef std::map< std::wstring, tm_enum_t > tmdump::tm_enums_t
 
typedef std::list< tm_property_t > tmdump::tm_properties_t
 
typedef std::map< int, std::wstring > tmdump::tm_states_t
 
typedef std::map< std::wstring, tm_states_t > tmdump::tm_state_enums_t
 
typedef std::map< int, tm_part_t > tmdump::tm_parts_t
 
typedef std::map< std::wstring, tm_parts_t > tmdump::tm_classes_t
 

Functions

int main (int argc, char *argv[])
 

Variables

static tm_enums_t tmdump::tm_enums
 
static tm_properties_t tmdump::tm_properties
 
static tm_state_enums_t tmdump::tm_state_enums
 
static tm_classes_t tmdump::tm_classes
 
static const tmdump::state_mapping_t tmdump::state_map []
 

Macro Definition Documentation

◆ SCHEMA_STRINGS

#define SCHEMA_STRINGS

Definition at line 23 of file themedump.cpp.

◆ TMT_ENUM

#define TMT_ENUM   (0x0F)

Definition at line 26 of file themedump.cpp.

◆ TMT_ENUMDEF

#define TMT_ENUMDEF   (0x0D)

Definition at line 24 of file themedump.cpp.

◆ TMT_ENUMVAL

#define TMT_ENUMVAL   (0x0E)

Definition at line 25 of file themedump.cpp.

◆ UNICODE

Definition at line 13 of file themedump.cpp.

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 12 of file themedump.cpp.

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

hosttype.c Copyright (C) 2002 by Brian Palmer brian.nosp@m.p@sg.nosp@m.inet..nosp@m.com

Definition at line 448 of file themedump.cpp.

449 {
450  try
451  {
452  struct TMSCHEMAINFO const & schema = *GetSchemaInfo();
453 
454  // build the tables of properties, classes, parts and states
456  (
457  schema.pPropTable,
458  schema.pPropTable + schema.iPropCount,
460  );
461 
462  // link parts to states
464  (
468  );
469 
471  ::SetThemeAppProperties(STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS);
472 
473  // dump the current values of all properties
474  for
475  (
476  tmdump::tm_classes_t::iterator p = tmdump::tm_classes.begin();
477  p != tmdump::tm_classes.end();
478  ++ p
479  )
480  {
481  const std::wstring& class_name = p->first;
482 
483  // open the theme data for the current class
484  class htheme_t
485  {
486  public:
487  HTHEME m_handle;
488 
489  htheme_t(HTHEME handle_): m_handle(handle_) { }
490  ~htheme_t() { ::CloseThemeData(m_handle); }
491 
492  operator HTHEME() { return m_handle; }
493  }
494  data = ::OpenThemeData(NULL, class_name.c_str());
495 
496  // failure
497  if(data == NULL)
498  {
500  (
501  stderr,
502  L"OpenThemeData(\"%s\") failed, error %d\n",
503  class_name.c_str(),
504  GetLastError()
505  );
506 
507  continue;
508  }
509 
510  // class name
511  std::fwprintf(stdout, L"%s\n", p->first.c_str());
512 
513  // dump system properties
514  for
515  (
516  tmdump::tm_properties_t::iterator p = tmdump::tm_properties.begin();
517  p != tmdump::tm_properties.end();
518  ++ p
519  )
520  {
521  switch(p->type)
522  {
523  case TMT_POSITION:
524  case TMT_MARGINS:
525  case TMT_RECT:
526  case TMT_INTLIST:
527  continue;
528  }
529 
530  // property name
531  std::fwprintf(stdout, L"\t%s = ", p->name.c_str());
532 
533  HRESULT hres;
534 
535  switch(p->type)
536  {
537  // string
538  case TMT_STRING:
539  case TMT_FILENAME: // FIXME
540  {
541  WCHAR buffer[256];
542  if(FAILED(hres = GetThemeSysString(data, p->id, buffer, 256))) break;
543  std::fwprintf(stdout, L"string: \"%s\"", buffer);
544  break;
545  }
546 
547  // integer
548  case TMT_INT:
549  {
550  int val;
551  if(FAILED(hres = GetThemeSysInt(data, p->id, &val))) break;
552  std::fwprintf(stdout, L"int: %d", val);
553  break;
554  }
555 
556  // boolean
557  case TMT_BOOL:
558  {
559  SetLastError(0);
560  BOOL val = GetThemeSysBool(data, p->id);
561  if(FAILED(hres = GetLastError())) break;
562  std::fwprintf(stdout, L"bool: %s", val ? L"true" : L"false");
563  break;
564  }
565 
566  // color
567  case TMT_COLOR:
568  {
569  SetLastError(0);
570 
572 
573  if(FAILED(hres = GetLastError())) break;
574 
576  (
577  stdout,
578  L"rgb: %d, %d, %d",
579  GetRValue(val),
580  GetGValue(val),
581  GetBValue(val)
582  );
583 
584  break;
585  }
586 
587  // size
588  case TMT_SIZE:
589  {
590  SetLastError(0);
591  int val = GetThemeSysSize(data, p->id);
592  if(FAILED(hres = GetLastError())) break;
593  std::fwprintf(stdout, L"size: %d", val);
594  break;
595  }
596 
597  // font
598  case TMT_FONT:
599  {
600  LOGFONTW val;
601  if(FAILED(hres = GetThemeSysFont(data, p->id, &val))) break;
602  std::fwprintf(stdout, L"font: %s", val.lfFaceName);
603  break;
604  }
605 
606  // enumerated integer
607  case TMT_ENUM:
608  {
609  int val;
610  if(FAILED(hres = GetThemeSysInt(data, p->id, &val))) break;
611 
612  std::fwprintf(stdout, L"enum(%s): ", p->enum_type->first.c_str());
613 
614  tmdump::tm_enum_t::iterator enumval = p->enum_type->second.find(val);
615 
616  if(enumval == p->enum_type->second.end())
617  std::fwprintf(stdout, L"<%d>", val);
618  else
619  std::fwprintf(stdout, L"%s", enumval->second.c_str());
620 
621  break;
622  }
623  }
624 
625  if(FAILED(hres)) std::fwprintf(stdout, L"<error %08X>", hres);
626 
627  std::fputwc(L'\n', stdout);
628  }
629 
630  }
631  }
632  catch(std::exception e)
633  {
634  std::cerr << e.what() << std::endl;
635  return EXIT_FAILURE;
636  }
637 
638  return EXIT_SUCCESS;
639 }
int WINAPI GetThemeSysSize(HTHEME hTheme, int iSizeID)
Definition: metric.c:154
#define TMT_BOOL
Definition: vssym32.h:137
#define TMT_ENUM
Definition: themedump.cpp:26
#define exception
Definition: math.h:26
#define TMT_INTLIST
Definition: vssym32.h:145
HRESULT WINAPI GetThemeSysInt(HTHEME hTheme, int iIntID, int *piValue)
Definition: metric.c:134
#define GetRValue(rgb)
Definition: wingdi.h:2913
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
static tm_properties_t tm_properties
Definition: themedump.cpp:46
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
static const tmdump::state_mapping_t state_map[]
Definition: themedump.cpp:294
#define TMT_MARGINS
Definition: vssym32.h:139
FILE * stdout
#define GetGValue(rgb)
Definition: wingdi.h:2914
#define EXIT_SUCCESS
Definition: rdjpgcom.c:55
basic_ostream< _CharT, _Traits > &_STLP_CALL endl(basic_ostream< _CharT, _Traits > &__os)
Definition: _ostream.h:357
unsigned int BOOL
Definition: ntddk_ex.h:94
HRESULT WINAPI GetThemeSysFont(HTHEME hTheme, int iFontID, LOGFONTW *plf)
Definition: metric.c:91
#define e
Definition: ke_i.h:82
#define TMT_STRING
Definition: vssym32.h:135
void WINAPI SetThemeAppProperties(DWORD dwFlags)
Definition: system.c:941
_Check_return_opt_ _CRTIMP int __cdecl fwprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const wchar_t *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
#define TMT_FONT
Definition: vssym32.h:144
static tm_classes_t tm_classes
Definition: themedump.cpp:63
#define TMT_RECT
Definition: vssym32.h:143
static clock_t begin
Definition: xmllint.c:466
GLuint GLfloat * val
Definition: glext.h:7180
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
_STLP_DECLSPEC _Stl_aligned_buffer< ostream > cerr
Definition: iostream.cpp:102
LONG HRESULT
Definition: typedefs.h:77
DWORD COLORREF
Definition: windef.h:285
_STLP_BEGIN_NAMESPACE _STLP_INLINE_LOOP _Function for_each(_InputIter __first, _InputIter __last, _Function __f)
Definition: _algo.h:59
#define EXIT_FAILURE
Definition: jerror.c:33
#define SetLastError(x)
Definition: compat.h:409
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define TMT_FILENAME
Definition: vssym32.h:140
static const WCHAR L[]
Definition: oid.c:1250
COLORREF WINAPI GetThemeSysColor(HTHEME hTheme, int iColorID)
Definition: metric.c:58
#define TMT_INT
Definition: vssym32.h:136
const WCHAR * schema
#define TMT_POSITION
Definition: vssym32.h:142
#define TMT_COLOR
Definition: vssym32.h:138
FILE * stderr
#define const
Definition: zconf.h:230
HRESULT WINAPI GetThemeSysString(HTHEME hTheme, int iStringID, LPWSTR pszStringBuff, int cchMaxStringChars)
Definition: metric.c:205
#define GetBValue(rgb)
Definition: wingdi.h:2915
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863
GLfloat GLfloat p
Definition: glext.h:8902
_Check_return_opt_ _CRTIMP wint_t __cdecl fputwc(_In_ wchar_t _Ch, _Inout_ FILE *_File)
BOOL WINAPI GetThemeSysBool(HTHEME hTheme, int iBoolID)
Definition: metric.c:26
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
#define TMT_SIZE
Definition: vssym32.h:141