foobar2000 SDK  2015-01-14
win32_misc.h
Go to the documentation of this file.
2 public:
3  ~uDebugLog() {*this << "\n"; uOutputDebugString(get_ptr());}
4 };
5 
6 #define FB2K_DebugLog() uDebugLog()._formatter()
7 
8 
9 class win32_font {
10 public:
11  win32_font(HFONT p_initval) : m_font(p_initval) {}
12  win32_font() : m_font(NULL) {}
14 
15  void release() {
16  HFONT temp = detach();
17  if (temp != NULL) DeleteObject(temp);
18  }
19 
20  void set(HFONT p_font) {release(); m_font = p_font;}
21  HFONT get() const {return m_font;}
22  HFONT detach() {return pfc::replace_t(m_font,(HFONT)NULL);}
23 
24  void create(const t_font_description & p_desc) {
25  SetLastError(NO_ERROR);
26  HFONT temp = p_desc.create();
27  if (temp == NULL) throw exception_win32(GetLastError());
28  set(temp);
29  }
30 
31  bool is_valid() const {return m_font != NULL;}
32 
33 private:
34  win32_font(const win32_font&);
35  const win32_font & operator=(const win32_font &);
36 
37  HFONT m_font;
38 };
void create(const t_font_description &p_desc)
Definition: win32_misc.h:24
void SHARED_EXPORT uOutputDebugString(const char *msg)
~uDebugLog()
Definition: win32_misc.h:3
win32_font(HFONT p_initval)
Definition: win32_misc.h:11
const win32_font & operator=(const win32_font &)
t_type replace_t(t_type &p_var, const t_newval &p_newval)
Definition: primitives.h:682
HFONT m_font
Definition: win32_misc.h:37
void release()
Definition: win32_misc.h:15
string8_fastalloc string_formatter
Definition: string_base.h:614
HFONT detach()
Definition: win32_misc.h:22
HFONT SHARED_EXPORT create() const
bool is_valid() const
Definition: win32_misc.h:31
void set(HFONT p_font)
Definition: win32_misc.h:20