Example #1
0
void Win32Painter::Update(Widget *w)
{
	Button *button;
	if ((button=reinterpret_cast<Button*>(w))) {
		SetWindowPos(hwnd_,NULL,w->X(),w->Y(),w->Width(),w->Height(),0);
		SetWindowText(hwnd_,button->Label().c_str());
	}
}
Example #2
0
void Win32Painter::Create(Widget *w)
{
	Button *button;
	Static *label;
	TextField *textField;

	HINSTANCE inst = (HINSTANCE)GetWindowLong(parent_, GWL_HINSTANCE);
	if ((button=dynamic_cast<Button*>(w))) {
		hwnd_ = CreateWindow("BUTTON",button->Label().c_str(),WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,button->X(),button->Y(),button->Width(),button->Height(),parent_,NULL,inst,NULL);
	} else if ((label=dynamic_cast<Static*>(w))) {
		hwnd_ = CreateWindow("STATIC",label->Label().c_str(),WS_CHILD|WS_VISIBLE|SS_LEFT,label->X(),label->Y(),label->Width(),label->Height(),parent_,NULL,inst,NULL);
	} else if ((textField=dynamic_cast<TextField*>(w))) {
		hwnd_ = CreateWindow("EDIT",textField->Text().c_str(),WS_CHILD|WS_VISIBLE|ES_LEFT|ES_AUTOHSCROLL|WS_BORDER,textField->X(),textField->Y(),textField->Width(),textField->Height(),parent_,NULL,inst,NULL);
	}
	originalWndProc_ = (WNDPROC)SetWindowLong(hwnd_, GWL_WNDPROC, (LONG)WndProc);	
	SetWindowLong(hwnd_, GWL_USERDATA, (LONG)w);
}