Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
366dbd2f
Commit
366dbd2f
authored
Mar 05, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clock: Make the window round in no title bar mode, to exercise SetWindowRgn.
parent
69299c77
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
7 deletions
+25
-7
main.c
programs/clock/main.c
+15
-1
winclock.c
programs/clock/winclock.c
+9
-5
winclock.h
programs/clock/winclock.h
+1
-1
No files found.
programs/clock/main.c
View file @
366dbd2f
...
...
@@ -180,6 +180,7 @@ static VOID CLOCK_ToggleTitle(VOID)
else
{
style
=
(
style
&
~
(
WS_POPUP
|
WS_THICKFRAME
))
|
WS_OVERLAPPEDWINDOW
;
SetMenu
(
Globals
.
hMainWnd
,
Globals
.
hMainMenu
);
SetWindowRgn
(
Globals
.
hMainWnd
,
0
,
TRUE
);
}
SetWindowLong
(
Globals
.
hMainWnd
,
GWL_STYLE
,
style
);
SetWindowPos
(
Globals
.
hMainWnd
,
0
,
0
,
0
,
0
,
0
,
...
...
@@ -311,7 +312,7 @@ static VOID CLOCK_Paint(HWND hWnd)
FillRect
(
dcMem
,
&
ps
.
rcPaint
,
GetStockObject
(
LTGRAY_BRUSH
));
if
(
Globals
.
bAnalog
)
AnalogClock
(
dcMem
,
Globals
.
MaxX
,
Globals
.
MaxY
,
Globals
.
bSeconds
);
AnalogClock
(
dcMem
,
Globals
.
MaxX
,
Globals
.
MaxY
,
Globals
.
bSeconds
,
Globals
.
bWithoutTitle
);
else
DigitalClock
(
dcMem
,
Globals
.
MaxX
,
Globals
.
MaxY
,
Globals
.
bSeconds
,
Globals
.
hFont
);
...
...
@@ -361,6 +362,19 @@ static LRESULT WINAPI CLOCK_WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM
case
WM_SIZE
:
{
Globals
.
MaxX
=
LOWORD
(
lParam
);
Globals
.
MaxY
=
HIWORD
(
lParam
);
if
(
Globals
.
bAnalog
&&
Globals
.
bWithoutTitle
)
{
RECT
rect
;
INT
diameter
=
min
(
Globals
.
MaxX
,
Globals
.
MaxY
);
HRGN
hrgn
=
CreateEllipticRgn
(
(
Globals
.
MaxX
-
diameter
)
/
2
,
(
Globals
.
MaxY
-
diameter
)
/
2
,
(
Globals
.
MaxX
+
diameter
)
/
2
,
(
Globals
.
MaxY
+
diameter
)
/
2
);
GetWindowRect
(
hWnd
,
&
rect
);
MapWindowPoints
(
0
,
hWnd
,
(
LPPOINT
)
&
rect
,
2
);
OffsetRgn
(
hrgn
,
-
rect
.
left
,
-
rect
.
top
);
SetWindowRgn
(
Globals
.
hMainWnd
,
hrgn
,
TRUE
);
}
CLOCK_ResetFont
();
break
;
}
...
...
programs/clock/winclock.c
View file @
366dbd2f
...
...
@@ -82,7 +82,7 @@ static void DrawTicks(HDC dc, const POINT* centre, int radius)
}
}
static
void
DrawFace
(
HDC
dc
,
const
POINT
*
centre
,
int
radius
)
static
void
DrawFace
(
HDC
dc
,
const
POINT
*
centre
,
int
radius
,
int
border
)
{
/* Ticks */
SelectObject
(
dc
,
CreatePen
(
PS_SOLID
,
2
,
ShadowColor
));
...
...
@@ -91,8 +91,12 @@ static void DrawFace(HDC dc, const POINT* centre, int radius)
DeleteObject
(
SelectObject
(
dc
,
CreatePen
(
PS_SOLID
,
2
,
TickColor
)));
OffsetWindowOrgEx
(
dc
,
SHADOW_DEPTH
,
SHADOW_DEPTH
,
NULL
);
DrawTicks
(
dc
,
centre
,
radius
);
DeleteObject
(
SelectObject
(
dc
,
GetStockObject
(
NULL_BRUSH
)));
if
(
border
)
{
SelectObject
(
dc
,
GetStockObject
(
NULL_BRUSH
));
DeleteObject
(
SelectObject
(
dc
,
CreatePen
(
PS_SOLID
,
5
,
ShadowColor
)));
Ellipse
(
dc
,
centre
->
x
-
radius
,
centre
->
y
-
radius
,
centre
->
x
+
radius
,
centre
->
y
+
radius
);
}
DeleteObject
(
SelectObject
(
dc
,
GetStockObject
(
NULL_PEN
)));
}
...
...
@@ -159,7 +163,7 @@ static void PositionHands(const POINT* centre, int radius, BOOL bSeconds)
PositionHand
(
centre
,
radius
*
0
.
79
,
second
/
60
*
2
*
M_PI
,
&
SecondHand
);
}
void
AnalogClock
(
HDC
dc
,
int
x
,
int
y
,
BOOL
bSeconds
)
void
AnalogClock
(
HDC
dc
,
int
x
,
int
y
,
BOOL
bSeconds
,
BOOL
border
)
{
POINT
centre
;
int
radius
;
...
...
@@ -171,7 +175,7 @@ void AnalogClock(HDC dc, int x, int y, BOOL bSeconds)
centre
.
x
=
x
/
2
;
centre
.
y
=
y
/
2
;
DrawFace
(
dc
,
&
centre
,
radius
);
DrawFace
(
dc
,
&
centre
,
radius
,
border
);
PositionHands
(
&
centre
,
radius
,
bSeconds
);
DrawHands
(
dc
,
bSeconds
);
...
...
programs/clock/winclock.h
View file @
366dbd2f
...
...
@@ -21,6 +21,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
void
AnalogClock
(
HDC
dc
,
int
X
,
int
Y
,
BOOL
bSeconds
);
void
AnalogClock
(
HDC
dc
,
int
X
,
int
Y
,
BOOL
bSeconds
,
BOOL
border
);
HFONT
SizeFont
(
HDC
dc
,
int
x
,
int
y
,
BOOL
bSeconds
,
const
LOGFONT
*
font
);
void
DigitalClock
(
HDC
dc
,
int
X
,
int
Y
,
BOOL
bSeconds
,
HFONT
font
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment