mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Rainbow nest
git-svn-id: svn://ultimatepp.org/upp/trunk@3529 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
b79918ff26
commit
036fd725ec
22 changed files with 6208 additions and 0 deletions
75
rainbow/WinAlt/UtilWinAlt.cpp
Normal file
75
rainbow/WinAlt/UtilWinAlt.cpp
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
#include <CtrlCore/CtrlCore.h>
|
||||
|
||||
#ifdef GUI_WINALT
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
SystemDraw& ScreenInfo();
|
||||
|
||||
bool ScreenInPaletteMode()
|
||||
{
|
||||
return ScreenInfo().PaletteMode();
|
||||
}
|
||||
|
||||
Size GetScreenSize()
|
||||
{
|
||||
return ScreenInfo().GetPageSize();
|
||||
}
|
||||
|
||||
HRGN GetFrameRgn(const Rect& rect, int n) {
|
||||
HRGN rgn = CreateRectRgnIndirect(rect);
|
||||
Rect r = rect;
|
||||
r.Deflate(n);
|
||||
if(r.Width() > 0 && r.Height() > 0) {
|
||||
HRGN rgnin = CreateRectRgnIndirect(r);
|
||||
CombineRgn(rgn, rgn, rgnin, RGN_XOR);
|
||||
DeleteObject(rgnin);
|
||||
}
|
||||
return rgn;
|
||||
}
|
||||
|
||||
void DrawDragRect(SystemDraw& w, const Rect& _rect1, const Rect& _rect2, const Rect& _clip, int n, Color color, uint64 pattern)
|
||||
{
|
||||
Point o = w.GetOffset();
|
||||
Rect rect1 = _rect1 + o;
|
||||
Rect rect2 = _rect2 + o;
|
||||
Rect clip = _clip + o;
|
||||
HDC hdc = w.BeginGdi();
|
||||
word wpat[8] = {
|
||||
(byte)(pattern >> 56), (byte)(pattern >> 48), (byte)(pattern >> 40), (byte)(pattern >> 32),
|
||||
(byte)(pattern >> 24), (byte)(pattern >> 16), (byte)(pattern >> 8), (byte)(pattern >> 0),
|
||||
};
|
||||
HBITMAP bitmap = CreateBitmap(8, 8, 1, 1, wpat);
|
||||
HBRUSH brush = ::CreatePatternBrush(bitmap);
|
||||
DeleteObject(bitmap);
|
||||
SetTextColor(hdc, color);
|
||||
SetBkColor(hdc, SColorText());
|
||||
Point offset;
|
||||
#ifdef PLATFORM_WINCE
|
||||
offset = Point(0, 0);
|
||||
#else
|
||||
::GetViewportOrgEx(hdc, offset);
|
||||
#endif
|
||||
HRGN rgn = GetFrameRgn(rect1 + offset, n);
|
||||
HRGN rgn2 = GetFrameRgn(rect2 + offset, n);
|
||||
HRGN cliprgn = CreateRectRgnIndirect(clip + offset);
|
||||
CombineRgn(rgn, rgn, rgn2, RGN_XOR);
|
||||
CombineRgn(rgn, rgn, cliprgn, RGN_AND);
|
||||
SelectClipRgn(hdc, rgn);
|
||||
Rect r;
|
||||
GetClipBox(hdc, r);
|
||||
HBRUSH obrush = (HBRUSH) SelectObject(hdc, brush);
|
||||
PatBlt(hdc, r.left, r.top, r.Width(), r.Height(), PATINVERT);
|
||||
SelectObject(hdc, obrush);
|
||||
SelectClipRgn(hdc, NULL);
|
||||
DeleteObject(rgn);
|
||||
DeleteObject(rgn2);
|
||||
DeleteObject(cliprgn);
|
||||
ReleaseDC(NULL, hdc);
|
||||
DeleteObject(brush);
|
||||
w.EndGdi();
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue