ultimatepp/uppdev/KbdFocusCaret/main.cpp
cxl 4a1c627474 Adding uppdev....
git-svn-id: svn://ultimatepp.org/upp/trunk@328 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2008-08-15 08:36:24 +00:00

26 lines
565 B
C++

#include <CtrlLib/CtrlLib.h>
struct KbdFocusCaret : public TopWindow {
String text;
virtual void GotFocus() { Refresh(); }
virtual void LostFocus() { Refresh(); }
virtual bool Key(dword key, int count) {
text = GetKeyDesc(key);
Refresh();
return true;
}
virtual void Paint(Draw& w) {
w.DrawRect(GetSize(), SWhite);
w.DrawText(0, 0, text);
w.DrawText(0, 30, HasFocus() ? "Has Focus" : "No Focus");
}
KbdFocusCaret() {
Sizeable().Zoomable();
SetCaret(60, 60, 10, 10);
}
};
GUI_APP_MAIN
{
KbdFocusCaret().Run();
}