1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxMiniFrame
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "minifram.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
32 #include "wx/minifram.h"
33 #include "wx/msw/private.h"
36 #include "wx/msw/gnuwin32/extra.h"
39 #if !USE_SHARED_LIBRARY
40 IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame
, wxFrame
)
43 long wxMiniFrame::MSWDefWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
45 if ((GetWindowStyleFlag() & wxTINY_CAPTION_HORIZ
) ||
46 (GetWindowStyleFlag() & wxTINY_CAPTION_VERT
))
47 return ::ibDefWindowProc((HWND
) GetHWND(), nMsg
, wParam
, lParam
);
48 else if ( m_oldWndProc
)
49 return ::CallWindowProc(CASTWNDPROC m_oldWndProc
, (HWND
) GetHWND(), (UINT
) nMsg
, (WPARAM
) wParam
, (LPARAM
) lParam
);
51 return ::DefWindowProc((HWND
) GetHWND(), nMsg
, wParam
, lParam
);
54 wxMiniFrame::~wxMiniFrame(void)
58 /////////////////////////////////////////////////////////////////////////
60 // Project: ItsyBitsy window support module
64 // ItsyBitsy is a support module that allows you to create windows
65 // that look and act very much like a popup window witha system
66 // menu and caption bar, except everything is scaled to about 2/3
69 // For documentation on how to use ItsyBits, read the document
73 // 9/27/91 Charlie Kindel (cek/ckindel)
74 // Wrote and documented it.
77 // 2/23/93 cek Added minimize/maximize buttons.
78 // 3/18/93 cek Fixed system menu bug where system menu
79 // popped back up if you clicked on the
80 // icon again while it was up.
81 // 3/24/93 cek More comments. Fixed DS_MODALDIALOG style
82 // problem. Use auto precompiled headers
85 //////////////////////////////////////////////////////////////////////////
92 #if !defined( __WATCOMC__ ) && !defined( __MWERKS__ )
101 // Some mildly useful macros for the standard 16 colors
102 #define RGBBLACK RGB(0,0,0)
103 #define RGBRED RGB(128,0,0)
104 #define RGBGREEN RGB(0,128,0)
105 #define RGBBLUE RGB(0,0,128)
107 #define RGBBROWN RGB(128,128,0)
108 #define RGBMAGENTA RGB(128,0,128)
109 #define RGBCYAN RGB(0,128,128)
110 #define RGBLTGRAY RGB(192,192,192)
112 #define RGBGRAY RGB(128,128,128)
113 #define RGBLTRED RGB(255,0,0)
114 #define RGBLTGREEN RGB(0,255,0)
115 #define RGBLTBLUE RGB(0,0,255)
117 #define RGBYELLOW RGB(255,255,0)
118 #define RGBLTMAGENTA RGB(255,0,255)
119 #define RGBLTCYAN RGB(0,255,255)
120 #define RGBWHITE RGB(255,255,255)
123 #ifndef GlobalAllocPtr
124 #define GlobalPtrHandle(lp) \
125 ((HGLOBAL)GlobalHandle(lp))
127 #define GlobalLockPtr(lp) \
128 ((BOOL)GlobalLock(GlobalPtrHandle(lp)))
129 #define GlobalUnlockPtr(lp) \
130 GlobalUnlock(GlobalPtrHandle(lp))
132 #define GlobalAllocPtr(flags, cb) \
133 (GlobalLock(GlobalAlloc((flags), (cb))))
134 #define GlobalReAllocPtr(lp, cbNew, flags) \
135 (GlobalUnlockPtr(lp), GlobalLock(GlobalReAlloc(GlobalPtrHandle(lp) , (cbNew), (flags))))
136 #define GlobalFreePtr(lp) \
137 (GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp)))
140 #if defined(__BORLANDC__) || defined(__WATCOMC__)
141 #define max(a,b) (((a) > (b)) ? (a) : (b))
142 #define min(a,b) (((a) < (b)) ? (a) : (b))
145 // CAPTIONXY is the default size of the system menu icon. This
146 // determines the height/width of the caption.
148 // The value that results from the following formula works out
149 // nicely for the veritcal caption on VGA, 8514 (Large Fonts),
150 // 8514 (Small Fonts), XGA (Small Fonts), XGA (Large Fonts),
151 // and TIGA (Small Fonts). It may not be good on other displays.
153 // The problem is that TT fonts turn into bitmap fonts when they
154 // are sized below a certain threshold. The idea is to make the
155 // size of the caption just big enough to get the smallest TT
156 // (scalable) font to fit.
158 #define CAPTIONXY (GetSystemMetrics( SM_CYCAPTION ) / 2 + 1)
160 #define TestWinStyle( hWnd, dwStyleBit ) \
161 (((DWORD)GetWindowLong( hWnd, GWL_STYLE ) & (DWORD)dwStyleBit) ? TRUE : FALSE )
162 #define HASCAPTION( hwnd ) (TestWinStyle( hwnd, IBS_VERTCAPTION ) ||\
163 TestWinStyle( hwnd, IBS_HORZCAPTION ))
165 #define SETCAPTIONSIZE(h,i) (UINT)SetProp(h,"ibSize",(HANDLE)i)
166 #define GETCAPTIONSIZE(h) (UINT)GetProp(h,"ibSize")
167 #define FREECAPTIONSIZE(h) RemoveProp(h,"ibSize")
169 #define SETMENUWASUPFLAG(h,i) (UINT)SetProp(h,"ibFlag",(HANDLE)i)
170 #define GETMENUWASUPFLAG(h) (UINT)GetProp(h,"ibFlag")
171 #define FREEMENUWASUPFLAG(h) RemoveProp(h,"ibFlag")
173 /////////////////////////////////////////////////////////////////////
174 // Little known fact:
175 // ExtTextOut() is the fastest way to draw a filled rectangle
176 // in Windows (if you don't want dithered colors or borders).
178 // Unfortunately there is a bug in the Windows 3.0 8514 driver
179 // in using ExtTextOut() to a memory DC. If you are drawing
180 // to an off screen bitmap, then blitting that bitmap to the
181 // display, do not #define wxUSE_EXTTEXTOUT below.
183 // The following macro (DRAWFASTRECT) draws a filled rectangle
184 // with no border and a solid color. It uses the current back-
185 // ground color as the fill color.
186 //////////////////////////////////////////////////////////////////////
187 #define wxUSE_EXTTEXTOUT
188 #ifdef wxUSE_EXTTEXTOUT
189 #define DRAWFASTRECT(hdc,lprc) ExtTextOut(hdc,0,0,ETO_OPAQUE,lprc,NULL,0,NULL)
191 #define DRAWFASTRECT(hdc,lprc) {\
192 HBRUSH hbr = CreateSolidBrush( GetBkColor( hdc ) ) ;\
193 hbr = SelectObject(hdc, hbr) ;\
194 PatBlt(hdc,(lprc)->left,(lprc)->top,(lprc)->right-(lprc)->left,(lprc)->bottom-(lprc)->top,PATCOPY) ;\
195 hbr = SelectObject(hdc, hbr) ;\
196 DeleteObject( hbr ) ;\
200 // The DrawArrow function takes the following to indicate what
201 // kind of arrow to draw.
205 #define ARROW_RESTORE 2
207 BOOL PASCAL
DepressMinMaxButton( HWND hWnd
, UINT uiHT
, LPRECT
) ;
208 BOOL PASCAL
DoMenu( HWND hWnd
) ;
209 void PASCAL
SetupSystemMenu( HWND hWnd
, HMENU hMenu
) ;
210 BOOL PASCAL
GetCaptionRect( HWND hWnd
, LPRECT lprc
) ;
211 BOOL PASCAL
GetIconRect( HWND hWnd
, LPRECT lprc
) ;
212 BOOL PASCAL
GetButtonRect( HWND hWnd
, UINT nPos
, LPRECT lprc
) ;
213 BOOL PASCAL
GetMinButtonRect( HWND hWnd
, LPRECT lprc
) ;
214 BOOL PASCAL
GetMaxButtonRect( HWND hWnd
, LPRECT lprc
) ;
215 BOOL PASCAL
DrawCaption( HDC hDC
, HWND hWnd
, LPRECT lprc
,
216 BOOL fVert
, BOOL fSysMenu
,
217 BOOL fMin
, BOOL fMax
, BOOL fActive
) ;
218 void PASCAL
DrawSysMenu( HDC hDC
, HWND hWnd
, BOOL fInvert
) ;
219 void PASCAL
DrawButton( HDC hDC
, HWND hWnd
, BOOL fMin
, BOOL fDepressed
) ;
220 void PASCAL
DrawArrow( HDC hdc
, LPRECT lprc
, UINT uiStyle
) ;
226 ///////////////////////////////////////////////////////////////////////
227 // External/Public functions
228 ///////////////////////////////////////////////////////////////////////
230 /////////////////////////////////////////////////////////////////
231 // UINT WINAPI ibGetCaptionSize( HWND hWnd )
235 // Gets the size of the caption (height if horz, width if
240 ///////////////////////////////////////////////////////////////
241 UINT WINAPI
ibGetCaptionSize( HWND hWnd
)
243 return GETCAPTIONSIZE( hWnd
) + 1 ;
244 } // ibSetCaptionSize()
246 /////////////////////////////////////////////////////////////////
247 // UINT WINAPI ibSetCaptionSize( HWND hWnd, UINT nSize )
251 // Changes the size of the caption (height if horz, width if
256 //////////////////////////////////////////////////////////////////
257 UINT WINAPI
ibSetCaptionSize( HWND hWnd
, UINT nSize
)
265 ui
= SETCAPTIONSIZE( hWnd
, nSize
) ;
267 // Once we change the window style, we need a WM_NCCALCRECT
270 // SWP_FRAMECHANGED is not documented in the 3.1 SDK docs,
271 // but *is* in WINDOWS.H.
273 SetWindowPos( hWnd
, NULL
, 0, 0, 0, 0, SWP_FRAMECHANGED
|
274 SWP_NOSIZE
| SWP_NOMOVE
|
275 SWP_NOACTIVATE
| SWP_NOZORDER
) ;
279 } // ibSetCaptionSize()
281 /////////////////////////////////////////////////////////////////
282 // LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam )
286 // This function should be called instead of DefWindowProc() for
287 // windows that want to have itsybitsy captions.
291 //////////////////////////////////////////////////////////////////
292 LRESULT WINAPI
ibDefWindowProc( HWND hWnd
, UINT uiMsg
, WPARAM wParam
, LPARAM lParam
)
301 // was hit then pop up the menu
303 if (HASCAPTION( hWnd
) && (wParam
== VK_SPACE
))
317 DWORD dw
= GetWindowLong( hWnd
, GWL_STYLE
) ;
319 // Fool DefWindowProc into thinking we do not have
320 // a system menu. Otherwise it will try to
323 SetWindowLong( hWnd
, GWL_STYLE
, dw
&~WS_SYSMENU
) ;
324 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
325 SetWindowLong( hWnd
, GWL_STYLE
, dw
) ;
331 // The menu that is poped up for the system menu with
332 // TrackPopupMenu() sends it's notifications as WM_COMMAND
333 // messages. We need to translate these into
334 // WM_SYSCOMMAND messages. All standard WM_SYSCOMMAND
335 // ids are greater than 0xF000.
337 // This could be a possible cause of confusion if the
338 // itsybitsy window had children that used SC_MOVE or SC_CLOSE
339 // as their IDs. Take note and be careful.
341 // Also, because ibDefWindowProc looks at WM_COMMAND messages,
342 // you will need to be careful to call ibDefWindowProc() for
343 // any wm_command messages that you would normally ignore.
344 // Otherwise the system menu won't work.
346 if (wParam
>= 0xF000)
347 // Call PostMessage() here instead of SendMessage!
349 // Our menu was created by TrackPopupMenu(). TPM() does
350 // not return until after the menu has been destroyed
351 // (and thus the command associated with the menu selection
352 // sent). Therefore when we get here, we are still
353 // *inside* TPM(). If we Send WM_SYSCOMMAND, SC_CLOSE
354 // to the window, the window will be destroyed before
355 // TPM() returns to our code within DoMenu() below. Wel...
356 // We do stuff with the window handle after DoMenu()
357 // returns (namely GetProp()). Since the window has
358 // been destroyed,this is bad.
359 PostMessage( hWnd
, WM_SYSCOMMAND
, wParam
, lParam
) ;
361 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
363 case WM_GETMINMAXINFO
:
365 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
366 if (HASCAPTION( hWnd
) && TestWinStyle( hWnd
, WS_THICKFRAME
))
368 LPPOINT lppt
= (LPPOINT
)lParam
;
373 int cx
, cy
; // window frame/border width
375 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
377 cx
= GetSystemMetrics( SM_CXFRAME
) ;
378 cy
= GetSystemMetrics( SM_CYFRAME
) ;
380 else if (TestWinStyle(hWnd
, WS_BORDER
))
382 cx
= GetSystemMetrics( SM_CXBORDER
) ;
383 cy
= GetSystemMetrics( SM_CYBORDER
) ;
387 // VZ: I don't know what should be here, but the vars must
389 wxFAIL_MSG("don't know how to initialize cx, cy");
394 GetIconRect( hWnd
, &rcMenu
) ;
395 GetMinButtonRect( hWnd
, &rcMin
) ;
396 GetMaxButtonRect( hWnd
, &rcMax
) ;
397 nX
= (rcMenu
.right
-rcMenu
.left
) +
398 (rcMin
.right
-rcMin
.left
) +
399 (rcMin
.right
-rcMin
.left
) ;
402 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
) )
404 lppt
[3].x
= nCapSize
+ cx
* 2 - 1 ;
405 lppt
[3].y
= nX
+ (2* nCapSize
) ;
409 lppt
[3].x
= nX
+ (2* nCapSize
) ;
410 lppt
[3].y
= nCapSize
+ cy
* 2 - 1 ;
413 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
417 /////////////////////////////////////////////////////////////////////
418 // Non-client area messages. These are used to allow the
419 // minature caption bar to be handled correctly.
425 // We have two things that we need to store somewhere:
426 // 1) The caption height (width).
427 // and 2) A flag indicating whether the sysmenu was
430 // CAPTIONXY is a macro that calls GetSystemMetrics.
432 SETCAPTIONSIZE( hWnd
, CAPTIONXY
) ;
434 // Set our flag that tells us whether the system menu was
437 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
439 // Are we in 3.1? If so we have some neat features
440 // we can use like rotated TrueType fonts.
442 fWin31
= (BOOL
)(LOWORD( GetVersion() ) >= 0x030A) ;
444 // If IBS_????CAPTION was specified and the WS_DLGFRAME (or
445 // WS_DLGFRAME 'cause it == WS_CAPTION | WS_BORDER)
446 // was specified the creator made a mistake. Things get really
447 // ugly if DefWindowProc sees WS_DLGFRAME, so we strip
448 // the WS_DLGFRAME part off!
450 dwStyle
= GetWindowLong( hWnd
, GWL_STYLE
) ;
451 if ((dwStyle
& IBS_VERTCAPTION
|| dwStyle
& IBS_HORZCAPTION
) &&
452 dwStyle
& WS_DLGFRAME
)
454 dwStyle
&= (DWORD
)~WS_DLGFRAME
;
455 SetWindowLong( hWnd
, GWL_STYLE
, dwStyle
) ;
458 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
461 // We store the caption size in a window prop. so we
462 // must remove props.
464 FREECAPTIONSIZE( hWnd
) ;
465 FREEMENUWASUPFLAG( hWnd
) ;
466 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
469 // This is sent when the window manager wants to find out
470 // how big our client area is to be. If we have a mini-caption
471 // then we trap this message and calculate the cleint area rect,
472 // which is the client area rect calculated by DefWindowProc()
473 // minus the width/height of the mini-caption bar
475 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
476 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
))
478 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
480 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
) )
481 ((LPRECT
)lParam
)->left
+= nCapSize
;
483 ((LPRECT
)lParam
)->top
+= nCapSize
;
488 // This message is sent whenever the mouse moves over us.
489 // We will depend on DefWindowProc for everything unless
490 // there is a mini-caption, in which case we will
491 // return HTCAPTION or HTSYSMENU. When the user clicks
492 // or double clicks, NC_LBUTTON/ message are sent with
493 // wParam equal to what we return here.
494 // This means that this is an ideal place to figure out
497 // let defwindowproc handle the standard borders etc...
499 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
500 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
) && lRet
== HTNOWHERE
)
508 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
510 // if DefWindowProc returned HTCAPTION then we have to
511 // refine the area and return HTSYSMENU if appropriate
513 pt
.x
= LOWORD( lParam
) ;
514 pt
.y
= HIWORD( lParam
) ;
516 GetCaptionRect( hWnd
, &rc
) ; // window coords
517 if (PtInRect( &rc
, pt
))
521 // rely on the fact that Get???Rect() return an invalid
522 // (empty) rectangle if the menu/buttons don't exist
524 GetIconRect( hWnd
, &rcMenu
) ;
525 GetMinButtonRect( hWnd
, &rcMinButton
) ;
526 GetMaxButtonRect( hWnd
, &rcMaxButton
) ;
528 if (PtInRect( &rcMenu
, pt
))
531 if (PtInRect( &rcMinButton
, pt
))
534 if (PtInRect( &rcMaxButton
, pt
))
538 if (lRet
!= HTSYSMENU
)
539 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
542 case WM_NCLBUTTONDBLCLK
:
543 // Windows recieve WM_NC?BUTTONDBLCLK messages whether they
544 // have CS_DBLCLKS or not. We watch for one of these
545 // to see if the user double clicked on the system menu (to
546 // close the window) or on the caption (to maximize the window).
548 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
) && wParam
== HTSYSMENU
)
550 SendMessage( hWnd
, WM_CLOSE
, 0, 0L ) ;
553 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
555 case WM_NCLBUTTONDOWN
:
559 // If we're iconic or we don't have a caption then
560 // DefWindowProc will do the job just fine.
562 if (IsIconic( hWnd
) || !HASCAPTION( hWnd
))
563 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
565 // Here's were we handle the system menu, the min and max buttons.
566 // If you wanted to change the behavior of the min/max buttons
567 // do something like swap tool palettes or something, you
568 // would change the SendMessage() calls below.
573 if (GETMENUWASUPFLAG( hWnd
) == FALSE
&& DoMenu( hWnd
))
574 SETMENUWASUPFLAG( hWnd
, TRUE
) ;
576 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
580 GetMinButtonRect( hWnd
, &rc
) ;
581 // Note that DepressMinMaxButton() goes into
582 // a PeekMessage() loop waiting for the mouse
585 if (DepressMinMaxButton( hWnd
, wParam
, &rc
))
586 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_MINIMIZE
, lParam
) ;
590 GetMaxButtonRect( hWnd
, &rc
) ;
591 // Note that DepressMinMaxButton() goes into
592 // a PeekMessage() loop waiting for the mouse
595 if (DepressMinMaxButton( hWnd
, wParam
, &rc
))
598 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_RESTORE
, lParam
) ;
600 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_MAXIMIZE
, lParam
) ;
605 // Well, it appears as though the user clicked somewhere other
606 // than the buttons. We let DefWindowProc do it's magic.
607 // This is where things like dragging and sizing the
610 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
617 if (IsIconic( hWnd
))
618 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
620 // Paint the non-client area here. We will call DefWindowProc
621 // after we are done so it can paint the borders and so
624 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
625 if (HASCAPTION( hWnd
))
629 HDC hDC
= GetWindowDC( hWnd
) ;
632 GetCaptionRect( hWnd
, &rcCap
) ; // Convert to window coords
633 GetWindowRect( hWnd
, &rc
) ;
634 OffsetRect( &rcCap
, -rc
.left
, -rc
.top
) ;
636 if (uiMsg
== WM_NCPAINT
)
637 fActive
= (hWnd
== GetActiveWindow()) ;
641 DrawCaption( hDC
, hWnd
, &rcCap
,
642 TestWinStyle(hWnd
, IBS_VERTCAPTION
),
643 TestWinStyle(hWnd
, WS_SYSMENU
),
644 TestWinStyle(hWnd
, WS_MINIMIZEBOX
),
645 TestWinStyle(hWnd
, WS_MAXIMIZEBOX
),
648 ReleaseDC( hWnd
, hDC
) ;
654 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
659 } // ibDefWindowProc()
661 // ibAdjustWindowRect( HWND hWnd, LPRECT lprc )
663 // Does the same thing as the USER function AdjustWindowRect(),
664 // but knows about itsybitsy windows. AdjustWindowRect() is
665 // bogus for stuff like this.
667 void WINAPI
ibAdjustWindowRect( HWND hWnd
, LPRECT lprc
)
669 short cx
= 0, cy
= 0 ;
672 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
674 // First check Windows's styles, then our own.
676 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
678 cx
= GetSystemMetrics( SM_CXFRAME
) ;
679 cy
= GetSystemMetrics( SM_CYFRAME
) ;
682 if (TestWinStyle(hWnd
, DS_MODALFRAME
))
684 cx
= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
685 cy
= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
688 if (TestWinStyle(hWnd
, WS_BORDER
))
690 cx
= GetSystemMetrics( SM_CXBORDER
) ;
691 cy
= GetSystemMetrics( SM_CYBORDER
) ;
694 InflateRect( lprc
, cx
, cy
) ;
696 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
697 lprc
->left
-= nCapSize
;
699 if (TestWinStyle( hWnd
, IBS_HORZCAPTION
))
700 lprc
->top
-= nCapSize
;
702 } // ibAdjustWindowRect()
705 ///////////////////////////////////////////////////////////////////////
706 // Internal functions
707 ///////////////////////////////////////////////////////////////////////
709 // DepressMinMaxButton()
711 // This function is called when the user has pressed either the min or
712 // max button (i.e. WM_NCLBUTTONDOWN). We go into a Peekmessage() loop,
713 // waiting for the mouse to come back up. This allows us to make the
714 // button change up/down state like a real button does.
716 // lprc points to the rectangle that describes the button the
717 // user has clicked on.
719 BOOL PASCAL
DepressMinMaxButton( HWND hWnd
, UINT uiHT
, LPRECT lprc
)
721 BOOL fDepressed
= TRUE
;
724 // Draw button in down state
725 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
) ;
730 if (PeekMessage((LPMSG
)&msg
, NULL
, WM_MOUSEFIRST
, WM_MOUSELAST
, PM_REMOVE
))
736 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, !fDepressed
) ;
738 return PtInRect( lprc
, msg
.pt
) ;
741 if (PtInRect( lprc
, msg
.pt
))
744 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
= TRUE
) ;
749 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
= FALSE
) ;
756 } // DepressMinMaxButton()
758 // DrawCaption( HDC hDC, HWND hWnd, LPRECT lprc,
759 // BOOL fVert, BOOL fSysMenu, BOOL fActive )
761 // This function draws an itsy bitsy caption bar with or
762 // without system menu to the dc specified by hDC. The
763 // caption is drawn to fit within the lprc RECT and is
764 // drawn//withOut/ borders.
766 BOOL PASCAL
DrawCaption( HDC hDC
, HWND hWnd
, LPRECT lprc
,
767 BOOL fVert
, BOOL fSysMenu
, BOOL fMin
,
768 BOOL fMax
, BOOL fActive
)
772 COLORREF rgbCaptionBG
;
774 COLORREF rgbWindowFrame
;
779 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
783 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
785 // if we have focus use the active caption color
786 // otherwise use the inactive caption color
790 rgbText
= GetSysColor( COLOR_CAPTIONTEXT
) ;
791 rgbCaptionBG
= GetSysColor( COLOR_ACTIVECAPTION
) ;
796 rgbText
= GetSysColor( COLOR_INACTIVECAPTIONTEXT
) ;
798 rgbText
= GetSysColor( COLOR_CAPTIONTEXT
) ;
800 rgbCaptionBG
= GetSysColor( COLOR_INACTIVECAPTION
) ;
803 SetBkMode( hDC
, TRANSPARENT
) ;
804 SelectObject( hDC
, GetStockObject( NULL_BRUSH
) ) ;
805 SelectObject( hDC
, GetStockObject( NULL_PEN
) ) ;
812 rcCap
.top
+= nCapSize
;
814 rcCap
.left
+= nCapSize
;
820 rcCap
.bottom
-= nCapSize
;
822 rcCap
.right
-= nCapSize
;
828 rcCap
.bottom
-= nCapSize
;
830 rcCap
.right
-= nCapSize
;
835 rc
.left
= lprc
->right
- 1 ;
836 rc
.right
= lprc
->right
;
838 rc
.bottom
= lprc
->bottom
;
842 rc
.left
= lprc
->left
;
843 rc
.right
= lprc
->right
;
844 rc
.bottom
= lprc
->bottom
;
845 rc
.top
= rc
.bottom
- 1 ;
848 SetBkColor( hDC
, rgbWindowFrame
) ;
849 DRAWFASTRECT( hDC
, &rc
) ;
851 hbrCaption
= CreateSolidBrush( rgbCaptionBG
) ;
852 hbrCaption
= (HBRUSH
) SelectObject( hDC
, hbrCaption
) ;
853 SelectObject( hDC
, (HPEN
) GetStockObject( NULL_PEN
) ) ;
855 Rectangle( hDC
, rcCap
.left
, rcCap
.top
, rcCap
.right
, rcCap
.bottom
+ 1 ) ;
857 Rectangle( hDC
, rcCap
.left
, rcCap
.top
, rcCap
.right
+1, rcCap
.bottom
) ;
858 hbrCaption
= (HBRUSH
) SelectObject( hDC
, hbrCaption
) ;
859 DeleteObject( hbrCaption
) ;
862 // Draw caption text here. Only do it in 3.1 'cause 3.1 gives
865 ui
= GetWindowTextLength( hWnd
) ;
876 lpsz
= (char*)GlobalAllocPtr( GHND
, ui
+ 2 );
881 GetWindowText( hWnd
, lpsz
, ui
+ 1 ) ;
882 nBkMode
= SetBkMode( hDC
, TRANSPARENT
) ;
883 rgbText
= SetTextColor( hDC
, rgbText
) ;
885 memset( &lf
, '\0', sizeof(LOGFONT
) ) ;
887 lf
.lfHeight
= -(int)(nCapSize
- 3) ;
888 lf
.lfCharSet
= ANSI_CHARSET
;
889 lf
.lfQuality
= DEFAULT_QUALITY
;
890 lf
.lfClipPrecision
= CLIP_LH_ANGLES
| CLIP_STROKE_PRECIS
;
893 lf
.lfWeight
= FW_BOLD
;
898 // Can only rotate true type fonts (well, ok, we could
899 // try and use "modern").
900 strcpy( lf
.lfFaceName
, "Arial" ) ;
901 lf
.lfPitchAndFamily
= FF_SWISS
| 0x04;
902 lf
.lfEscapement
= 900 ;
904 // Note: The Win 3.1 documentation for CreateFont() say's
905 // that the lfOrientation member is ignored. It appears,
906 // that on Windows 16 3.1 this is true, but when running
907 // as a 16 bit WinApp on WindowsNT 3.1 the lfOrientation
908 // must be set or the text does not rotate!
910 lf
.lfOrientation
= 900 ;
912 hFont
= CreateFontIndirect( &lf
) ;
913 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
915 GetTextExtentPoint( hDC
, lpsz
, ui
, &Size
) ;
916 cx
= rcCap
.bottom
- ((rcCap
.bottom
- rcCap
.top
- Size
.cx
) / 2) ;
917 cy
= rcCap
.left
- 1 + ((rcCap
.right
- rcCap
.left
- Size
.cy
) / 2) ;
919 // Make sure we got a rotatable font back.
921 GetTextMetrics( hDC
, &tm
) ;
922 if (tm
.tmPitchAndFamily
& TMPF_VECTOR
||
923 tm
.tmPitchAndFamily
& TMPF_TRUETYPE
)
927 min( (long)cx
, rcCap
.bottom
),
932 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
933 DeleteObject( hFont
) ;
937 // Use small fonts always for the horizontal. Cause it looks
938 // more like "System" than Arial.
940 lf
.lfPitchAndFamily
= FF_SWISS
;
942 hFont
= CreateFontIndirect( &lf
) ;
943 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
945 GetTextExtentPoint( hDC
, lpsz
, ui
, &Size
) ;
946 cx
= rcCap
.left
+ ((rcCap
.right
- rcCap
.left
- Size
.cx
) / 2) ;
947 cy
= rcCap
.top
+ ((rcCap
.bottom
- rcCap
.top
- Size
.cy
) / 2) ;
949 // Figger out how big the string is
952 max( (long)cx
, rcCap
.left
),
957 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
958 DeleteObject( hFont
) ;
963 rgbText
= SetTextColor( hDC
, rgbText
) ;
964 SetBkMode( hDC
, nBkMode
) ;
966 GlobalFreePtr( lpsz
) ;
971 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
974 DrawButton( hDC
, hWnd
, TRUE
, FALSE
) ;
977 DrawButton( hDC
, hWnd
, FALSE
, FALSE
) ;
984 // DrawSysMenu( HDC hDC, hWnd, BOOL fInvert )
986 // Draws the little system menu icon.
988 void PASCAL
DrawSysMenu( HDC hDC
, HWND hWnd
, BOOL fInvert
)
993 COLORREF rgbIconFace
;
994 COLORREF rgbWindowFrame
;
998 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1003 hDC
= GetWindowDC( hWnd
) ;
1010 rgbIconFace
= GetNearestColor( hDC
, RGBLTGRAY
) ;
1011 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1013 GetIconRect( hWnd
, &rcIcon
) ;
1014 GetWindowRect( hWnd
, &rc
) ;
1016 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1020 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1022 rc
= rcIcon
; // separator line
1023 rc
.top
= ++rc
.bottom
- 1 ;
1027 rc
= rcIcon
; // separator line
1028 rc
.left
= ++rc
.right
- 1 ;
1032 SetBkColor( hDC
, rgbIconFace
) ;
1033 DRAWFASTRECT( hDC
, &rcTemp
) ;
1035 // Draw separator line
1036 SetBkColor( hDC
, rgbWindowFrame
) ;
1037 DRAWFASTRECT( hDC
, &rc
) ;
1041 // Draw the little horizontal doo-hickey
1043 rcTemp
.top
= rcIcon
.top
+ ((nCapSize
-1) / 2) ;
1044 rcTemp
.bottom
= rcTemp
.top
+ 3 ;
1045 rcTemp
.left
= rcTemp
.left
+ 3 ;
1046 rcTemp
.right
= rcTemp
.right
- 1 ;
1048 SetBkColor( hDC
, RGBGRAY
) ;
1049 DRAWFASTRECT( hDC
, &rcTemp
) ;
1052 OffsetRect( &rc
, -1, -1 ) ;
1053 SetBkColor( hDC
, RGBBLACK
) ;
1054 DRAWFASTRECT( hDC
, &rc
) ;
1056 InflateRect( &rc
, -1, -1 ) ;
1057 SetBkColor( hDC
, RGBWHITE
) ;
1058 DRAWFASTRECT( hDC
, &rc
) ;
1062 InvertRect( hDC
, &rcIcon
) ;
1065 ReleaseDC( hWnd
, hDC
) ;
1070 // DoMenu( HWND hWnd )
1072 // Pops up the system menu.
1074 BOOL PASCAL
DoMenu( HWND hWnd
)
1083 if (!TestWinStyle(hWnd
, WS_SYSMENU
))
1086 hDC
= GetWindowDC( hWnd
);
1091 DrawSysMenu( hDC
, hWnd
, TRUE
) ;
1095 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1106 GetIconRect( hWnd
, &rcIcon
) ;
1107 GetWindowRect( hWnd
, &rc
) ;
1108 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1110 ClientToScreen( hWnd
, &pt
) ;
1111 ClientToScreen( hWnd
, (LPPOINT
)&rc
.right
) ;
1113 dw
= GetWindowLong( hWnd
, GWL_STYLE
) ;
1114 SetWindowLong( hWnd
, GWL_STYLE
, dw
| WS_SYSMENU
) ;
1116 hMenu
= GetSystemMenu( hWnd
, FALSE
) ;
1117 SetupSystemMenu( hWnd
, hMenu
) ;
1119 SetWindowLong( hWnd
, GWL_STYLE
, dw
) ;
1121 TrackPopupMenu( hMenu
, 0, //TPM_LEFTALIGN,
1128 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
1129 ReleaseDC( hWnd
, hDC
) ;
1135 // SetupSystemMenu( HWND hWnd, HMENU hMenu )
1137 // Enables/Disables the appropriate menu items on the
1138 // menu passed for the window passed.
1140 void PASCAL
SetupSystemMenu( HWND hWnd
, HMENU hMenu
)
1148 // Assume all should be grayed.
1150 wSize
= wMove
= wMinBox
= wMaxBox
= wRestore
= MF_GRAYED
;
1152 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
) || IsIconic( hWnd
))
1153 wMaxBox
= MF_ENABLED
;
1155 if (TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1156 wMinBox
= MF_ENABLED
;
1158 if (IsZoomed( hWnd
))
1159 wRestore
= MF_ENABLED
;
1161 if (TestWinStyle( hWnd
, WS_THICKFRAME
) &&
1162 !(IsIconic( hWnd
) || IsZoomed( hWnd
)))
1163 wSize
= MF_ENABLED
;
1165 if (!IsZoomed( hWnd
) &&
1166 !IsIconic( hWnd
) &&
1167 TestWinStyle( hWnd
, WS_CAPTION
) )
1168 wMove
= MF_ENABLED
;
1170 EnableMenuItem( hMenu
, SC_MOVE
, wMove
) ;
1171 EnableMenuItem( hMenu
, SC_SIZE
, wSize
) ;
1172 EnableMenuItem( hMenu
, SC_MINIMIZE
, wMinBox
) ;
1173 EnableMenuItem( hMenu
, SC_MAXIMIZE
, wMaxBox
) ;
1174 EnableMenuItem( hMenu
, SC_RESTORE
, wRestore
) ;
1176 } // SetupSystemMenu()
1178 // GetCaptionRect( HWND hWnd, LPRECT lprc )
1180 // calcluales the rectangle of the mini-caption in screen coords.
1182 BOOL PASCAL
GetCaptionRect( HWND hWnd
, LPRECT lprc
)
1186 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1188 if (!HASCAPTION( hWnd
))
1190 SetRectEmpty( lprc
) ;
1194 GetWindowRect( hWnd
, lprc
) ;
1196 // the window might have other non-client components like
1199 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
1201 lprc
->left
+= GetSystemMetrics( SM_CXFRAME
) ;
1202 lprc
->top
+= GetSystemMetrics( SM_CYFRAME
) ;
1203 lprc
->right
-= GetSystemMetrics( SM_CXFRAME
) ;
1204 lprc
->bottom
-= GetSystemMetrics( SM_CYFRAME
) ;
1207 if (TestWinStyle( hWnd
, DS_MODALFRAME
)) // if it's a dialog box
1209 lprc
->left
+= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1210 lprc
->top
+= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1211 lprc
->right
-= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1212 lprc
->bottom
-= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1215 if (TestWinStyle( hWnd
, WS_BORDER
))
1217 lprc
->left
+= GetSystemMetrics( SM_CXBORDER
) ;
1218 lprc
->top
+= GetSystemMetrics( SM_CYBORDER
) ;
1219 lprc
->right
-= GetSystemMetrics( SM_CXBORDER
) ;
1220 lprc
->bottom
-= GetSystemMetrics( SM_CYBORDER
) ;
1223 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1224 lprc
->right
= lprc
->left
+ nCapSize
;
1226 lprc
->bottom
= lprc
->top
+ nCapSize
;
1229 } // GetCaptionRect()
1231 // GetIconRect( HWND hWnd, LPRECT lprc )
1233 // Calculates the rect of the icon in screen coordinates.
1235 BOOL PASCAL
GetIconRect( HWND hWnd
, LPRECT lprc
)
1240 fMenu
= TestWinStyle( hWnd
, WS_SYSMENU
) ;
1241 fVert
= TestWinStyle( hWnd
, IBS_VERTCAPTION
) ;
1243 if (!GetCaptionRect( hWnd
, lprc
)) // window coords
1248 SetRectEmpty( lprc
) ;
1252 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1255 lprc
->bottom
= lprc
->top
+ nCapSize
;
1257 lprc
->right
= lprc
->left
+ nCapSize
;
1266 // GetMinButtonRect()
1268 // Calculates the rect of the minimize button in screen
1271 // For horizontal captions, we have the following situation ('Y' is minimize
1272 // and '^' is maximize or restore):
1274 // +---------------------------------+
1276 // +---------------------------------+
1277 // | |.......| <-- This is the width (nSize)
1279 // For vertical captions, we have the following:
1289 // |--| . <-- This is the height of the rectangle (nSize)
1293 // In order to figure out where the minimize button goes, we first need
1294 // to know if there is a maximize button. If so, use GetMaxButtonRect()
1297 BOOL PASCAL
GetMinButtonRect( HWND hWnd
, LPRECT lprc
)
1299 if (!TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1301 SetRectEmpty( lprc
) ;
1305 // The minimize button can be in either position 1 or 2. If there
1306 // is a maximize button, it's in position 2.
1308 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1309 return GetButtonRect( hWnd
, 2, lprc
) ;
1311 return GetButtonRect( hWnd
, 1, lprc
) ;
1314 // GetMaxButtonRect()
1316 // Calculates the rect of the maximize button in screen
1319 // The maximize button, if present, is always to the far right
1322 BOOL PASCAL
GetMaxButtonRect( HWND hWnd
, LPRECT lprc
)
1324 //The maximize button can only be in position 1.
1326 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1327 return GetButtonRect( hWnd
, 1, lprc
) ;
1330 SetRectEmpty( lprc
) ;
1335 // Get the rect where a button would go.
1337 // This function does not care if it's a min or max, just whether
1338 // it is the first from the right/bottom or second from the right/bottom
1341 BOOL PASCAL
GetButtonRect( HWND hWnd
, UINT nPos
, LPRECT lprc
)
1345 if (!GetCaptionRect( hWnd
, lprc
)) //window coords
1348 nSize
= GETCAPTIONSIZE( hWnd
) ;
1350 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1352 lprc
->bottom
-= nSize
* (nPos
-1) ;
1353 lprc
->top
= lprc
->bottom
- nSize
+ 1 ;
1357 lprc
->right
-= nSize
* (nPos
-1) ;
1358 lprc
->left
= lprc
->right
- nSize
+ 1 ;
1362 } // GetButtonRect()
1364 // DrawButton( HDC hDC, HWND hWnd, BOOL fMin, BOOL fDepressed )
1366 // Draws either the min, max, or restore buttons. If fMin is FALSE then it
1367 // will draw either the Max or Restore button. If fDepressed is TRUE it will
1368 // draw the button in a down state.
1370 void PASCAL
DrawButton( HDC hDC
, HWND hWnd
, BOOL fMin
, BOOL fDepressed
)
1374 COLORREF rgbWindowFrame
;
1380 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1382 // If you look at the standard Windows' min/max buttons, you will notice
1383 // that they have two pixels of 'shadow' to the bottom and right. Since
1384 // our buttons can be really, really small, we only want one pixel of
1385 // shadow when they are small. I arbitrarily decided that if the
1386 // caption size is greater than or equal to 20 we will use two
1387 // pixels. That's what this THREASHOLD stuff does.
1389 #define THRESHOLD 20
1390 nOffset
= (nCapSize
>= THRESHOLD
) ? 2 : 1 ;
1395 hDC
= GetWindowDC( hWnd
) ;
1402 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1405 GetMinButtonRect( hWnd
, &rcButton
) ;
1407 GetMaxButtonRect( hWnd
, &rcButton
) ;
1409 GetWindowRect( hWnd
, &rc
) ;
1410 OffsetRect( &rcButton
, -rc
.left
, -rc
.top
) ;
1413 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1415 rc
= rcButton
; //separator line
1416 rc
.bottom
= --rc
.top
+ 1 ;
1421 rc
= rcButton
; //separator line
1422 rc
.right
= --rc
.left
+ 1 ;
1426 //Draw separator line
1427 SetBkColor( hDC
, rgbWindowFrame
) ;
1428 DRAWFASTRECT( hDC
, &rc
) ;
1431 SetBkColor( hDC
, RGBLTGRAY
) ;
1432 DRAWFASTRECT( hDC
, &rcButton
) ;
1436 //The normal min/max buttons have one pixel on the top and left
1437 //sides for the highlight, and two pixels on the bottom and
1438 //right side for the shadow.
1440 //When our caption is 'small' we only use one pixel on all
1443 SetBkColor( hDC
, RGBWHITE
) ;
1446 rc
.right
= rc
.left
+ 1 ;
1447 DRAWFASTRECT( hDC
, &rc
) ;
1451 rc
.bottom
= rc
.top
+ 1 ;
1452 DRAWFASTRECT( hDC
, &rc
) ;
1454 SetBkColor( hDC
, RGBGRAY
) ;
1457 rc
.left
= rc
.right
- 1 ;
1458 DRAWFASTRECT( hDC
, &rc
) ;
1459 if (nCapSize
> THRESHOLD
)
1463 DRAWFASTRECT( hDC
, &rc
) ;
1468 rc
.top
= rc
.bottom
- 1 ;
1469 DRAWFASTRECT( hDC
, &rc
) ;
1470 if (nCapSize
> THRESHOLD
)
1474 DRAWFASTRECT( hDC
, &rc
) ;
1479 rcButton
.right
-= nOffset
;
1480 rcButton
.bottom
-= nOffset
;
1484 //Draw depressed state
1486 SetBkColor( hDC
, RGBGRAY
) ;
1489 rc
.right
= rc
.left
+ nOffset
;
1490 DRAWFASTRECT( hDC
, &rc
) ;
1494 rc
.bottom
= rc
.top
+ nOffset
;
1495 DRAWFASTRECT( hDC
, &rc
) ;
1497 rcButton
.left
+= 2 * nOffset
;
1498 rcButton
.top
+= 2 * nOffset
;
1501 // Now draw the arrows. We do not want the
1502 // arrows to grow too large when we have a bigger than
1503 // normal caption, so we restrict their size.
1505 // rcButton now represents where we can place our
1508 // The maximum size of our arrows (i.e. the width of rcButton)
1509 // has been empirically determined to be SM_CYCAPTION / 2
1511 n
= ((GetSystemMetrics( SM_CYCAPTION
)) / 2) -
1512 (rcButton
.right
- rcButton
.left
) ;
1514 InflateRect( &rcButton
, n
/2-1, n
/2-1 ) ;
1517 DrawArrow( hDC
, &rcButton
, ARROW_DOWN
) ;
1519 if (IsZoomed( hWnd
))
1521 DrawArrow( hDC
, &rcButton
, ARROW_RESTORE
) ;
1524 DrawArrow( hDC
, &rcButton
, ARROW_UP
) ;
1527 ReleaseDC( hWnd
, hDC
) ;
1535 // Draws either a up or down arrow. The arrow is bound by the rectangle
1537 void PASCAL
DrawArrow( HDC hdc
, LPRECT lprc
, UINT uiStyle
)
1543 int nMax
= (lprc
->bottom
- lprc
->top
) >> 1 ;
1545 SetBkColor( hdc
, RGBBLACK
) ;
1547 // We draw the arrow by drawing a series of horizontal lines
1549 xTip
= lprc
->left
+ ((lprc
->right
- lprc
->left
+1) >> 1) ;
1553 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1554 for (row
= 1 ; row
<= nMax
; row
++ )
1556 rc
.left
= xTip
- row
;
1557 rc
.right
= xTip
+ row
- 1 ;
1558 rc
.top
= yTip
+ row
;
1559 rc
.bottom
= rc
.top
+ 1 ;
1560 DRAWFASTRECT( hdc
, &rc
) ;
1565 yTip
= lprc
->bottom
- ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1566 for ( row
= nMax
; row
> 0 ; row
-- )
1568 rc
.left
= xTip
- row
;
1569 rc
.right
= xTip
+ row
- 1 ;
1570 rc
.top
= yTip
- row
;
1571 rc
.bottom
= rc
.top
+ 1 ;
1572 DRAWFASTRECT( hdc
, &rc
) ;
1578 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 3) - 2;
1579 for (row
= 1 ; row
<= nMax
; row
++ )
1581 rc
.left
= xTip
- row
;
1582 rc
.right
= xTip
+ row
- 1 ;
1583 rc
.top
= yTip
+ row
;
1584 rc
.bottom
= rc
.top
+ 1 ;
1585 DRAWFASTRECT( hdc
, &rc
) ;
1588 yTip
+= (nMax
+1) * 2 ;
1589 for ( row
= nMax
; row
> 0 ; row
-- )
1591 rc
.left
= xTip
- row
;
1592 rc
.right
= xTip
+ row
- 1 ;
1593 rc
.top
= yTip
- row
;
1594 rc
.bottom
= rc
.top
+ 1 ;
1595 DRAWFASTRECT( hdc
, &rc
) ;
1602 #endif // wxUSE_ITSY_BITSY