/*
* Cursor.h
* Copyright (c) 2011 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// SOL++2000
#pragma once
#include <sol\Resource.h>
#include <sol\DC.h>
namespace SOL {
class Cursor :public Resource {
private:
int width;
int height;
public:
Cursor(const TCHAR* name, HCURSOR hcursor)
:Resource(name, hcursor)
{
width = ::GetSystemMetrics(SM_CXCURSOR);
height = ::GetSystemMetrics(SM_CYCURSOR);
}
public:
~Cursor()
{
::DestroyCursor((HCURSOR)get());
}
public:
void draw(DC* dc, int x, int y)
{
HCURSOR hcursor = (HCURSOR)get();
if(hcursor) {
// This works well, because ...
::DrawIcon(dc->get(), x, y, hcursor);
}
}
public:
void draw(DC* dc)
{
draw(dc, 0, 0);
}
/*
Cursor(const TCHAR* name, HCURSOR hcursor);
~Cursor();
void draw(DC* dc);
void draw(DC* dc, int x, int y);
*/
void getSize(int* w, int* h) { *w = width; *h = height; }
};
}
|