
Untitled
By: a guest on
Jul 20th, 2012 | syntax:
C++ | size: 1.53 KB | hits: 19 | expires: Never
#pragma once
#include "stdafx.h"
#include <commctrl.h>
#include <types.h>
#include "gstring.h"
#include "winapi.h"
class CWnd
{
public:
CWnd();
operator HWND() const {return hWnd;}
virtual inline HWND GetWnd() {return hWnd;}
virtual int PreTranslateMessage(MSG* pMsg) { return 0; }
inline void GetClientRect(RECT *rect) { ::GetClientRect(*this,rect); }
inline void GetClientRect(HWND hWnd, RECT* rect) { ::GetClientRect(hWnd,rect); }
//inline void GetFocus() { hWnd=::GetFocus (); }
inline HWND GetParent() { return hParent; }
inline DWORD GetStyle() { return GetWindowLongPtr(hWnd, GWL_STYLE); }
inline HWND GetTopWindow() { return ::GetTopWindow(*this); }
inline void SetFocus() { ::SetFocus(*this); }
inline BOOL SetWindowText(LPCTSTR lpString) { return ::SetWindowText(hWnd,lpString); }
inline int MessageBox(LPCTSTR lpText, LPCTSTR lpCaption=NULL, UINT uType=MB_OK) { return ::MessageBox(hWnd,lpText,lpCaption,uType); }
void Invalidate(BOOL bErase=TRUE);
GString GetWindowText();
GString GetWindowText(UINT uID);
void SetDlgItem(HWND hWnd, UINT uID);
void SetWindowPos(HWND hWndInsertAfter, int x, int y, int w, int h);
void ShowWindow(int nCmdShow);
protected:
HWND hWnd, hParent;
UINT uID;
};
class CEditCtrl : public CWnd
{
public:
inline void SetText(LPCTSTR text) { SetWindowText(text); }
u32 GetValue();
void SetValue(u32 value, bool has_sign=false);
};
class CSpinControl : public CWnd
{
public:
void SetRange(short low, short high);
void SetRange32(int low, int high);
};