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"
37 #include "wx/msw/gnuwin32/extra.h"
41 #if !USE_SHARED_LIBRARY
42 IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame
, wxFrame
)
45 long wxMiniFrame::MSWDefWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
47 if ((GetWindowStyleFlag() & wxTINY_CAPTION_HORIZ
) ||
48 (GetWindowStyleFlag() & wxTINY_CAPTION_VERT
))
49 return ::ibDefWindowProc((HWND
) GetHWND(), nMsg
, wParam
, lParam
);
50 else if ( m_oldWndProc
)
51 return ::CallWindowProc(CASTWNDPROC m_oldWndProc
, (HWND
) GetHWND(), (UINT
) nMsg
, (WPARAM
) wParam
, (LPARAM
) lParam
);
53 return ::DefWindowProc((HWND
) GetHWND(), nMsg
, wParam
, lParam
);
56 wxMiniFrame::~wxMiniFrame(void)
60 /////////////////////////////////////////////////////////////////////////
62 // Project: ItsyBitsy window support module
66 // ItsyBitsy is a support module that allows you to create windows
67 // that look and act very much like a popup window witha system
68 // menu and caption bar, except everything is scaled to about 2/3
71 // For documentation on how to use ItsyBits, read the document
75 // 9/27/91 Charlie Kindel (cek/ckindel)
76 // Wrote and documented it.
79 // 2/23/93 cek Added minimize/maximize buttons.
80 // 3/18/93 cek Fixed system menu bug where system menu
81 // popped back up if you clicked on the
82 // icon again while it was up.
83 // 3/24/93 cek More comments. Fixed DS_MODALDIALOG style
84 // problem. Use auto precompiled headers
87 //////////////////////////////////////////////////////////////////////////
94 #if !defined( __WATCOMC__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__)
103 // Some mildly useful macros for the standard 16 colors
104 #define RGBBLACK RGB(0,0,0)
105 #define RGBRED RGB(128,0,0)
106 #define RGBGREEN RGB(0,128,0)
107 #define RGBBLUE RGB(0,0,128)
109 #define RGBBROWN RGB(128,128,0)
110 #define RGBMAGENTA RGB(128,0,128)
111 #define RGBCYAN RGB(0,128,128)
112 #define RGBLTGRAY RGB(192,192,192)
114 #define RGBGRAY RGB(128,128,128)
115 #define RGBLTRED RGB(255,0,0)
116 #define RGBLTGREEN RGB(0,255,0)
117 #define RGBLTBLUE RGB(0,0,255)
119 #define RGBYELLOW RGB(255,255,0)
120 #define RGBLTMAGENTA RGB(255,0,255)
121 #define RGBLTCYAN RGB(0,255,255)
122 #define RGBWHITE RGB(255,255,255)
125 #ifndef GlobalAllocPtr
126 #define GlobalPtrHandle(lp) \
127 ((HGLOBAL)GlobalHandle(lp))
129 #define GlobalLockPtr(lp) \
130 ((BOOL)GlobalLock(GlobalPtrHandle(lp)))
131 #define GlobalUnlockPtr(lp) \
132 GlobalUnlock(GlobalPtrHandle(lp))
134 #define GlobalAllocPtr(flags, cb) \
135 (GlobalLock(GlobalAlloc((flags), (cb))))
136 #define GlobalReAllocPtr(lp, cbNew, flags) \
137 (GlobalUnlockPtr(lp), GlobalLock(GlobalReAlloc(GlobalPtrHandle(lp) , (cbNew), (flags))))
138 #define GlobalFreePtr(lp) \
139 (GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp)))
142 #if defined(__BORLANDC__) || defined(__WATCOMC__)
143 #define max(a,b) (((a) > (b)) ? (a) : (b))
144 #define min(a,b) (((a) < (b)) ? (a) : (b))
147 // CAPTIONXY is the default size of the system menu icon. This
148 // determines the height/width of the caption.
150 // The value that results from the following formula works out
151 // nicely for the veritcal caption on VGA, 8514 (Large Fonts),
152 // 8514 (Small Fonts), XGA (Small Fonts), XGA (Large Fonts),
153 // and TIGA (Small Fonts). It may not be good on other displays.
155 // The problem is that TT fonts turn into bitmap fonts when they
156 // are sized below a certain threshold. The idea is to make the
157 // size of the caption just big enough to get the smallest TT
158 // (scalable) font to fit.
160 #define CAPTIONXY (GetSystemMetrics( SM_CYCAPTION ) / 2 + 1)
162 #define TestWinStyle( hWnd, dwStyleBit ) \
163 (((DWORD)GetWindowLong( hWnd, GWL_STYLE ) & (DWORD)dwStyleBit) ? TRUE : FALSE )
164 #define HASCAPTION( hwnd ) (TestWinStyle( hwnd, IBS_VERTCAPTION ) ||\
165 TestWinStyle( hwnd, IBS_HORZCAPTION ))
167 #define SETCAPTIONSIZE(h,i) (UINT)SetProp(h,"ibSize",(HANDLE)i)
168 #define GETCAPTIONSIZE(h) (UINT)GetProp(h,"ibSize")
169 #define FREECAPTIONSIZE(h) RemoveProp(h,"ibSize")
171 #define SETMENUWASUPFLAG(h,i) (UINT)SetProp(h,"ibFlag",(HANDLE)i)
172 #define GETMENUWASUPFLAG(h) (UINT)GetProp(h,"ibFlag")
173 #define FREEMENUWASUPFLAG(h) RemoveProp(h,"ibFlag")
175 /////////////////////////////////////////////////////////////////////
176 // Little known fact:
177 // ExtTextOut() is the fastest way to draw a filled rectangle
178 // in Windows (if you don't want dithered colors or borders).
180 // Unfortunately there is a bug in the Windows 3.0 8514 driver
181 // in using ExtTextOut() to a memory DC. If you are drawing
182 // to an off screen bitmap, then blitting that bitmap to the
183 // display, do not #define wxUSE_EXTTEXTOUT below.
185 // The following macro (DRAWFASTRECT) draws a filled rectangle
186 // with no border and a solid color. It uses the current back-
187 // ground color as the fill color.
188 //////////////////////////////////////////////////////////////////////
189 #define wxUSE_EXTTEXTOUT
190 #ifdef wxUSE_EXTTEXTOUT
191 #define DRAWFASTRECT(hdc,lprc) ExtTextOut(hdc,0,0,ETO_OPAQUE,lprc,NULL,0,NULL)
193 #define DRAWFASTRECT(hdc,lprc) {\
194 HBRUSH hbr = CreateSolidBrush( GetBkColor( hdc ) ) ;\
195 hbr = SelectObject(hdc, hbr) ;\
196 PatBlt(hdc,(lprc)->left,(lprc)->top,(lprc)->right-(lprc)->left,(lprc)->bottom-(lprc)->top,PATCOPY) ;\
197 hbr = SelectObject(hdc, hbr) ;\
198 DeleteObject( hbr ) ;\
202 // The DrawArrow function takes the following to indicate what
203 // kind of arrow to draw.
207 #define ARROW_RESTORE 2
209 BOOL PASCAL
DepressMinMaxButton( HWND hWnd
, UINT uiHT
, LPRECT
) ;
210 BOOL PASCAL
DoMenu( HWND hWnd
) ;
211 void PASCAL
SetupSystemMenu( HWND hWnd
, HMENU hMenu
) ;
212 BOOL PASCAL
GetCaptionRect( HWND hWnd
, LPRECT lprc
) ;
213 BOOL PASCAL
GetIconRect( HWND hWnd
, LPRECT lprc
) ;
214 BOOL PASCAL
GetButtonRect( HWND hWnd
, UINT nPos
, LPRECT lprc
) ;
215 BOOL PASCAL
GetMinButtonRect( HWND hWnd
, LPRECT lprc
) ;
216 BOOL PASCAL
GetMaxButtonRect( HWND hWnd
, LPRECT lprc
) ;
217 BOOL PASCAL
DrawCaption( HDC hDC
, HWND hWnd
, LPRECT lprc
,
218 BOOL fVert
, BOOL fSysMenu
,
219 BOOL fMin
, BOOL fMax
, BOOL fActive
) ;
220 void PASCAL
DrawSysMenu( HDC hDC
, HWND hWnd
, BOOL fInvert
) ;
221 void PASCAL
DrawButton( HDC hDC
, HWND hWnd
, BOOL fMin
, BOOL fDepressed
) ;
222 void PASCAL
DrawArrow( HDC hdc
, LPRECT lprc
, UINT uiStyle
) ;
228 ///////////////////////////////////////////////////////////////////////
229 // External/Public functions
230 ///////////////////////////////////////////////////////////////////////
232 /////////////////////////////////////////////////////////////////
233 // UINT WINAPI ibGetCaptionSize( HWND hWnd )
237 // Gets the size of the caption (height if horz, width if
242 ///////////////////////////////////////////////////////////////
243 UINT WINAPI
ibGetCaptionSize( HWND hWnd
)
245 return GETCAPTIONSIZE( hWnd
) + 1 ;
246 } // ibSetCaptionSize()
248 /////////////////////////////////////////////////////////////////
249 // UINT WINAPI ibSetCaptionSize( HWND hWnd, UINT nSize )
253 // Changes the size of the caption (height if horz, width if
258 //////////////////////////////////////////////////////////////////
259 UINT WINAPI
ibSetCaptionSize( HWND hWnd
, UINT nSize
)
267 ui
= SETCAPTIONSIZE( hWnd
, nSize
) ;
269 // Once we change the window style, we need a WM_NCCALCRECT
272 // SWP_FRAMECHANGED is not documented in the 3.1 SDK docs,
273 // but *is* in WINDOWS.H.
275 SetWindowPos( hWnd
, NULL
, 0, 0, 0, 0, SWP_FRAMECHANGED
|
276 SWP_NOSIZE
| SWP_NOMOVE
|
277 SWP_NOACTIVATE
| SWP_NOZORDER
) ;
281 } // ibSetCaptionSize()
283 /////////////////////////////////////////////////////////////////
284 // LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam )
288 // This function should be called instead of DefWindowProc() for
289 // windows that want to have itsybitsy captions.
293 //////////////////////////////////////////////////////////////////
294 LRESULT WINAPI
ibDefWindowProc( HWND hWnd
, UINT uiMsg
, WPARAM wParam
, LPARAM lParam
)
303 // was hit then pop up the menu
305 if (HASCAPTION( hWnd
) && (wParam
== VK_SPACE
))
319 DWORD dw
= GetWindowLong( hWnd
, GWL_STYLE
) ;
321 // Fool DefWindowProc into thinking we do not have
322 // a system menu. Otherwise it will try to
325 SetWindowLong( hWnd
, GWL_STYLE
, dw
&~WS_SYSMENU
) ;
326 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
327 SetWindowLong( hWnd
, GWL_STYLE
, dw
) ;
333 // The menu that is poped up for the system menu with
334 // TrackPopupMenu() sends it's notifications as WM_COMMAND
335 // messages. We need to translate these into
336 // WM_SYSCOMMAND messages. All standard WM_SYSCOMMAND
337 // ids are greater than 0xF000.
339 // This could be a possible cause of confusion if the
340 // itsybitsy window had children that used SC_MOVE or SC_CLOSE
341 // as their IDs. Take note and be careful.
343 // Also, because ibDefWindowProc looks at WM_COMMAND messages,
344 // you will need to be careful to call ibDefWindowProc() for
345 // any wm_command messages that you would normally ignore.
346 // Otherwise the system menu won't work.
348 if (wParam
>= 0xF000)
349 // Call PostMessage() here instead of SendMessage!
351 // Our menu was created by TrackPopupMenu(). TPM() does
352 // not return until after the menu has been destroyed
353 // (and thus the command associated with the menu selection
354 // sent). Therefore when we get here, we are still
355 // *inside* TPM(). If we Send WM_SYSCOMMAND, SC_CLOSE
356 // to the window, the window will be destroyed before
357 // TPM() returns to our code within DoMenu() below. Wel...
358 // We do stuff with the window handle after DoMenu()
359 // returns (namely GetProp()). Since the window has
360 // been destroyed,this is bad.
361 PostMessage( hWnd
, WM_SYSCOMMAND
, wParam
, lParam
) ;
363 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
365 case WM_GETMINMAXINFO
:
367 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
368 if (HASCAPTION( hWnd
) && TestWinStyle( hWnd
, WS_THICKFRAME
))
370 LPPOINT lppt
= (LPPOINT
)lParam
;
375 int cx
, cy
; // window frame/border width
377 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
379 cx
= GetSystemMetrics( SM_CXFRAME
) ;
380 cy
= GetSystemMetrics( SM_CYFRAME
) ;
382 else if (TestWinStyle(hWnd
, WS_BORDER
))
384 cx
= GetSystemMetrics( SM_CXBORDER
) ;
385 cy
= GetSystemMetrics( SM_CYBORDER
) ;
389 // VZ: I don't know what should be here, but the vars must
391 wxFAIL_MSG("don't know how to initialize cx, cy");
396 GetIconRect( hWnd
, &rcMenu
) ;
397 GetMinButtonRect( hWnd
, &rcMin
) ;
398 GetMaxButtonRect( hWnd
, &rcMax
) ;
399 nX
= (rcMenu
.right
-rcMenu
.left
) +
400 (rcMin
.right
-rcMin
.left
) +
401 (rcMin
.right
-rcMin
.left
) ;
404 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
) )
406 lppt
[3].x
= nCapSize
+ cx
* 2 - 1 ;
407 lppt
[3].y
= nX
+ (2* nCapSize
) ;
411 lppt
[3].x
= nX
+ (2* nCapSize
) ;
412 lppt
[3].y
= nCapSize
+ cy
* 2 - 1 ;
415 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
419 /////////////////////////////////////////////////////////////////////
420 // Non-client area messages. These are used to allow the
421 // minature caption bar to be handled correctly.
427 // We have two things that we need to store somewhere:
428 // 1) The caption height (width).
429 // and 2) A flag indicating whether the sysmenu was
432 // CAPTIONXY is a macro that calls GetSystemMetrics.
434 SETCAPTIONSIZE( hWnd
, CAPTIONXY
) ;
436 // Set our flag that tells us whether the system menu was
439 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
441 // Are we in 3.1? If so we have some neat features
442 // we can use like rotated TrueType fonts.
444 fWin31
= (BOOL
)(LOWORD( GetVersion() ) >= 0x030A) ;
446 // If IBS_????CAPTION was specified and the WS_DLGFRAME (or
447 // WS_DLGFRAME 'cause it == WS_CAPTION | WS_BORDER)
448 // was specified the creator made a mistake. Things get really
449 // ugly if DefWindowProc sees WS_DLGFRAME, so we strip
450 // the WS_DLGFRAME part off!
452 dwStyle
= GetWindowLong( hWnd
, GWL_STYLE
) ;
453 if ((dwStyle
& IBS_VERTCAPTION
|| dwStyle
& IBS_HORZCAPTION
) &&
454 dwStyle
& WS_DLGFRAME
)
456 dwStyle
&= (DWORD
)~WS_DLGFRAME
;
457 SetWindowLong( hWnd
, GWL_STYLE
, dwStyle
) ;
460 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
463 // We store the caption size in a window prop. so we
464 // must remove props.
466 FREECAPTIONSIZE( hWnd
) ;
467 FREEMENUWASUPFLAG( hWnd
) ;
468 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
471 // This is sent when the window manager wants to find out
472 // how big our client area is to be. If we have a mini-caption
473 // then we trap this message and calculate the cleint area rect,
474 // which is the client area rect calculated by DefWindowProc()
475 // minus the width/height of the mini-caption bar
477 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
478 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
))
480 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
482 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
) )
483 ((LPRECT
)lParam
)->left
+= nCapSize
;
485 ((LPRECT
)lParam
)->top
+= nCapSize
;
490 // This message is sent whenever the mouse moves over us.
491 // We will depend on DefWindowProc for everything unless
492 // there is a mini-caption, in which case we will
493 // return HTCAPTION or HTSYSMENU. When the user clicks
494 // or double clicks, NC_LBUTTON/ message are sent with
495 // wParam equal to what we return here.
496 // This means that this is an ideal place to figure out
499 // let defwindowproc handle the standard borders etc...
501 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
502 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
) && lRet
== HTNOWHERE
)
510 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
512 // if DefWindowProc returned HTCAPTION then we have to
513 // refine the area and return HTSYSMENU if appropriate
515 pt
.x
= LOWORD( lParam
) ;
516 pt
.y
= HIWORD( lParam
) ;
518 GetCaptionRect( hWnd
, &rc
) ; // window coords
519 if (PtInRect( &rc
, pt
))
523 // rely on the fact that Get???Rect() return an invalid
524 // (empty) rectangle if the menu/buttons don't exist
526 GetIconRect( hWnd
, &rcMenu
) ;
527 GetMinButtonRect( hWnd
, &rcMinButton
) ;
528 GetMaxButtonRect( hWnd
, &rcMaxButton
) ;
530 if (PtInRect( &rcMenu
, pt
))
533 if (PtInRect( &rcMinButton
, pt
))
536 if (PtInRect( &rcMaxButton
, pt
))
540 if (lRet
!= HTSYSMENU
)
541 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
544 case WM_NCLBUTTONDBLCLK
:
545 // Windows recieve WM_NC?BUTTONDBLCLK messages whether they
546 // have CS_DBLCLKS or not. We watch for one of these
547 // to see if the user double clicked on the system menu (to
548 // close the window) or on the caption (to maximize the window).
550 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
) && wParam
== HTSYSMENU
)
552 SendMessage( hWnd
, WM_CLOSE
, 0, 0L ) ;
555 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
557 case WM_NCLBUTTONDOWN
:
561 // If we're iconic or we don't have a caption then
562 // DefWindowProc will do the job just fine.
564 if (IsIconic( hWnd
) || !HASCAPTION( hWnd
))
565 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
567 // Here's were we handle the system menu, the min and max buttons.
568 // If you wanted to change the behavior of the min/max buttons
569 // do something like swap tool palettes or something, you
570 // would change the SendMessage() calls below.
575 if (GETMENUWASUPFLAG( hWnd
) == FALSE
&& DoMenu( hWnd
))
576 SETMENUWASUPFLAG( hWnd
, TRUE
) ;
578 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
582 GetMinButtonRect( hWnd
, &rc
) ;
583 // Note that DepressMinMaxButton() goes into
584 // a PeekMessage() loop waiting for the mouse
587 if (DepressMinMaxButton( hWnd
, wParam
, &rc
))
588 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_MINIMIZE
, lParam
) ;
592 GetMaxButtonRect( hWnd
, &rc
) ;
593 // Note that DepressMinMaxButton() goes into
594 // a PeekMessage() loop waiting for the mouse
597 if (DepressMinMaxButton( hWnd
, wParam
, &rc
))
600 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_RESTORE
, lParam
) ;
602 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_MAXIMIZE
, lParam
) ;
607 // Well, it appears as though the user clicked somewhere other
608 // than the buttons. We let DefWindowProc do it's magic.
609 // This is where things like dragging and sizing the
612 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
619 if (IsIconic( hWnd
))
620 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
622 // Paint the non-client area here. We will call DefWindowProc
623 // after we are done so it can paint the borders and so
626 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
627 if (HASCAPTION( hWnd
))
631 HDC hDC
= GetWindowDC( hWnd
) ;
634 GetCaptionRect( hWnd
, &rcCap
) ; // Convert to window coords
635 GetWindowRect( hWnd
, &rc
) ;
636 OffsetRect( &rcCap
, -rc
.left
, -rc
.top
) ;
638 if (uiMsg
== WM_NCPAINT
)
639 fActive
= (hWnd
== GetActiveWindow()) ;
643 DrawCaption( hDC
, hWnd
, &rcCap
,
644 TestWinStyle(hWnd
, IBS_VERTCAPTION
),
645 TestWinStyle(hWnd
, WS_SYSMENU
),
646 TestWinStyle(hWnd
, WS_MINIMIZEBOX
),
647 TestWinStyle(hWnd
, WS_MAXIMIZEBOX
),
650 ReleaseDC( hWnd
, hDC
) ;
656 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
661 } // ibDefWindowProc()
663 // ibAdjustWindowRect( HWND hWnd, LPRECT lprc )
665 // Does the same thing as the USER function AdjustWindowRect(),
666 // but knows about itsybitsy windows. AdjustWindowRect() is
667 // bogus for stuff like this.
669 void WINAPI
ibAdjustWindowRect( HWND hWnd
, LPRECT lprc
)
671 short cx
= 0, cy
= 0 ;
674 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
676 // First check Windows's styles, then our own.
678 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
680 cx
= GetSystemMetrics( SM_CXFRAME
) ;
681 cy
= GetSystemMetrics( SM_CYFRAME
) ;
684 if (TestWinStyle(hWnd
, DS_MODALFRAME
))
686 cx
= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
687 cy
= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
690 if (TestWinStyle(hWnd
, WS_BORDER
))
692 cx
= GetSystemMetrics( SM_CXBORDER
) ;
693 cy
= GetSystemMetrics( SM_CYBORDER
) ;
696 InflateRect( lprc
, cx
, cy
) ;
698 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
699 lprc
->left
-= nCapSize
;
701 if (TestWinStyle( hWnd
, IBS_HORZCAPTION
))
702 lprc
->top
-= nCapSize
;
704 } // ibAdjustWindowRect()
707 ///////////////////////////////////////////////////////////////////////
708 // Internal functions
709 ///////////////////////////////////////////////////////////////////////
711 // DepressMinMaxButton()
713 // This function is called when the user has pressed either the min or
714 // max button (i.e. WM_NCLBUTTONDOWN). We go into a Peekmessage() loop,
715 // waiting for the mouse to come back up. This allows us to make the
716 // button change up/down state like a real button does.
718 // lprc points to the rectangle that describes the button the
719 // user has clicked on.
721 BOOL PASCAL
DepressMinMaxButton( HWND hWnd
, UINT uiHT
, LPRECT lprc
)
723 BOOL fDepressed
= TRUE
;
726 // Draw button in down state
727 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
) ;
732 if (PeekMessage((LPMSG
)&msg
, NULL
, WM_MOUSEFIRST
, WM_MOUSELAST
, PM_REMOVE
))
738 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, !fDepressed
) ;
740 return PtInRect( lprc
, msg
.pt
) ;
743 if (PtInRect( lprc
, msg
.pt
))
746 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
= TRUE
) ;
751 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
= FALSE
) ;
758 } // DepressMinMaxButton()
760 // DrawCaption( HDC hDC, HWND hWnd, LPRECT lprc,
761 // BOOL fVert, BOOL fSysMenu, BOOL fActive )
763 // This function draws an itsy bitsy caption bar with or
764 // without system menu to the dc specified by hDC. The
765 // caption is drawn to fit within the lprc RECT and is
766 // drawn//withOut/ borders.
768 BOOL PASCAL
DrawCaption( HDC hDC
, HWND hWnd
, LPRECT lprc
,
769 BOOL fVert
, BOOL fSysMenu
, BOOL fMin
,
770 BOOL fMax
, BOOL fActive
)
774 COLORREF rgbCaptionBG
;
776 COLORREF rgbWindowFrame
;
781 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
785 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
787 // if we have focus use the active caption color
788 // otherwise use the inactive caption color
792 rgbText
= GetSysColor( COLOR_CAPTIONTEXT
) ;
793 rgbCaptionBG
= GetSysColor( COLOR_ACTIVECAPTION
) ;
798 rgbText
= GetSysColor( COLOR_INACTIVECAPTIONTEXT
) ;
800 rgbText
= GetSysColor( COLOR_CAPTIONTEXT
) ;
802 rgbCaptionBG
= GetSysColor( COLOR_INACTIVECAPTION
) ;
805 SetBkMode( hDC
, TRANSPARENT
) ;
806 SelectObject( hDC
, GetStockObject( NULL_BRUSH
) ) ;
807 SelectObject( hDC
, GetStockObject( NULL_PEN
) ) ;
814 rcCap
.top
+= nCapSize
;
816 rcCap
.left
+= nCapSize
;
822 rcCap
.bottom
-= nCapSize
;
824 rcCap
.right
-= nCapSize
;
830 rcCap
.bottom
-= nCapSize
;
832 rcCap
.right
-= nCapSize
;
837 rc
.left
= lprc
->right
- 1 ;
838 rc
.right
= lprc
->right
;
840 rc
.bottom
= lprc
->bottom
;
844 rc
.left
= lprc
->left
;
845 rc
.right
= lprc
->right
;
846 rc
.bottom
= lprc
->bottom
;
847 rc
.top
= rc
.bottom
- 1 ;
850 SetBkColor( hDC
, rgbWindowFrame
) ;
851 DRAWFASTRECT( hDC
, &rc
) ;
853 hbrCaption
= CreateSolidBrush( rgbCaptionBG
) ;
854 hbrCaption
= (HBRUSH
) SelectObject( hDC
, hbrCaption
) ;
855 SelectObject( hDC
, (HPEN
) GetStockObject( NULL_PEN
) ) ;
857 Rectangle( hDC
, rcCap
.left
, rcCap
.top
, rcCap
.right
, rcCap
.bottom
+ 1 ) ;
859 Rectangle( hDC
, rcCap
.left
, rcCap
.top
, rcCap
.right
+1, rcCap
.bottom
) ;
860 hbrCaption
= (HBRUSH
) SelectObject( hDC
, hbrCaption
) ;
861 DeleteObject( hbrCaption
) ;
864 // Draw caption text here. Only do it in 3.1 'cause 3.1 gives
867 ui
= GetWindowTextLength( hWnd
) ;
878 lpsz
= (char*)GlobalAllocPtr( GHND
, ui
+ 2 );
883 GetWindowText( hWnd
, lpsz
, ui
+ 1 ) ;
884 nBkMode
= SetBkMode( hDC
, TRANSPARENT
) ;
885 rgbText
= SetTextColor( hDC
, rgbText
) ;
887 memset( &lf
, '\0', sizeof(LOGFONT
) ) ;
889 lf
.lfHeight
= -(int)(nCapSize
- 3) ;
890 lf
.lfCharSet
= ANSI_CHARSET
;
891 lf
.lfQuality
= DEFAULT_QUALITY
;
892 lf
.lfClipPrecision
= CLIP_LH_ANGLES
| CLIP_STROKE_PRECIS
;
895 lf
.lfWeight
= FW_BOLD
;
900 // Can only rotate true type fonts (well, ok, we could
901 // try and use "modern").
902 strcpy( lf
.lfFaceName
, "Arial" ) ;
903 lf
.lfPitchAndFamily
= FF_SWISS
| 0x04;
904 lf
.lfEscapement
= 900 ;
906 // Note: The Win 3.1 documentation for CreateFont() say's
907 // that the lfOrientation member is ignored. It appears,
908 // that on Windows 16 3.1 this is true, but when running
909 // as a 16 bit WinApp on WindowsNT 3.1 the lfOrientation
910 // must be set or the text does not rotate!
912 lf
.lfOrientation
= 900 ;
914 hFont
= CreateFontIndirect( &lf
) ;
915 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
917 GetTextExtentPoint( hDC
, lpsz
, ui
, &Size
) ;
918 cx
= rcCap
.bottom
- ((rcCap
.bottom
- rcCap
.top
- Size
.cx
) / 2) ;
919 cy
= rcCap
.left
- 1 + ((rcCap
.right
- rcCap
.left
- Size
.cy
) / 2) ;
921 // Make sure we got a rotatable font back.
923 GetTextMetrics( hDC
, &tm
) ;
924 if (tm
.tmPitchAndFamily
& TMPF_VECTOR
||
925 tm
.tmPitchAndFamily
& TMPF_TRUETYPE
)
929 min( (long)cx
, rcCap
.bottom
),
934 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
935 DeleteObject( hFont
) ;
939 // Use small fonts always for the horizontal. Cause it looks
940 // more like "System" than Arial.
942 lf
.lfPitchAndFamily
= FF_SWISS
;
944 hFont
= CreateFontIndirect( &lf
) ;
945 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
947 GetTextExtentPoint( hDC
, lpsz
, ui
, &Size
) ;
948 cx
= rcCap
.left
+ ((rcCap
.right
- rcCap
.left
- Size
.cx
) / 2) ;
949 cy
= rcCap
.top
+ ((rcCap
.bottom
- rcCap
.top
- Size
.cy
) / 2) ;
951 // Figger out how big the string is
954 max( (long)cx
, rcCap
.left
),
959 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
960 DeleteObject( hFont
) ;
965 rgbText
= SetTextColor( hDC
, rgbText
) ;
966 SetBkMode( hDC
, nBkMode
) ;
968 GlobalFreePtr( lpsz
) ;
973 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
976 DrawButton( hDC
, hWnd
, TRUE
, FALSE
) ;
979 DrawButton( hDC
, hWnd
, FALSE
, FALSE
) ;
986 // DrawSysMenu( HDC hDC, hWnd, BOOL fInvert )
988 // Draws the little system menu icon.
990 void PASCAL
DrawSysMenu( HDC hDC
, HWND hWnd
, BOOL fInvert
)
995 COLORREF rgbIconFace
;
996 COLORREF rgbWindowFrame
;
1000 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1005 hDC
= GetWindowDC( hWnd
) ;
1012 rgbIconFace
= GetNearestColor( hDC
, RGBLTGRAY
) ;
1013 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1015 GetIconRect( hWnd
, &rcIcon
) ;
1016 GetWindowRect( hWnd
, &rc
) ;
1018 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1022 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1024 rc
= rcIcon
; // separator line
1025 rc
.top
= ++rc
.bottom
- 1 ;
1029 rc
= rcIcon
; // separator line
1030 rc
.left
= ++rc
.right
- 1 ;
1034 SetBkColor( hDC
, rgbIconFace
) ;
1035 DRAWFASTRECT( hDC
, &rcTemp
) ;
1037 // Draw separator line
1038 SetBkColor( hDC
, rgbWindowFrame
) ;
1039 DRAWFASTRECT( hDC
, &rc
) ;
1043 // Draw the little horizontal doo-hickey
1045 rcTemp
.top
= rcIcon
.top
+ ((nCapSize
-1) / 2) ;
1046 rcTemp
.bottom
= rcTemp
.top
+ 3 ;
1047 rcTemp
.left
= rcTemp
.left
+ 3 ;
1048 rcTemp
.right
= rcTemp
.right
- 1 ;
1050 SetBkColor( hDC
, RGBGRAY
) ;
1051 DRAWFASTRECT( hDC
, &rcTemp
) ;
1054 OffsetRect( &rc
, -1, -1 ) ;
1055 SetBkColor( hDC
, RGBBLACK
) ;
1056 DRAWFASTRECT( hDC
, &rc
) ;
1058 InflateRect( &rc
, -1, -1 ) ;
1059 SetBkColor( hDC
, RGBWHITE
) ;
1060 DRAWFASTRECT( hDC
, &rc
) ;
1064 InvertRect( hDC
, &rcIcon
) ;
1067 ReleaseDC( hWnd
, hDC
) ;
1072 // DoMenu( HWND hWnd )
1074 // Pops up the system menu.
1076 BOOL PASCAL
DoMenu( HWND hWnd
)
1085 if (!TestWinStyle(hWnd
, WS_SYSMENU
))
1088 hDC
= GetWindowDC( hWnd
);
1093 DrawSysMenu( hDC
, hWnd
, TRUE
) ;
1097 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1108 GetIconRect( hWnd
, &rcIcon
) ;
1109 GetWindowRect( hWnd
, &rc
) ;
1110 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1112 ClientToScreen( hWnd
, &pt
) ;
1113 ClientToScreen( hWnd
, (LPPOINT
)&rc
.right
) ;
1115 dw
= GetWindowLong( hWnd
, GWL_STYLE
) ;
1116 SetWindowLong( hWnd
, GWL_STYLE
, dw
| WS_SYSMENU
) ;
1118 hMenu
= GetSystemMenu( hWnd
, FALSE
) ;
1119 SetupSystemMenu( hWnd
, hMenu
) ;
1121 SetWindowLong( hWnd
, GWL_STYLE
, dw
) ;
1123 TrackPopupMenu( hMenu
, 0, //TPM_LEFTALIGN,
1130 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
1131 ReleaseDC( hWnd
, hDC
) ;
1137 // SetupSystemMenu( HWND hWnd, HMENU hMenu )
1139 // Enables/Disables the appropriate menu items on the
1140 // menu passed for the window passed.
1142 void PASCAL
SetupSystemMenu( HWND hWnd
, HMENU hMenu
)
1150 // Assume all should be grayed.
1152 wSize
= wMove
= wMinBox
= wMaxBox
= wRestore
= MF_GRAYED
;
1154 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
) || IsIconic( hWnd
))
1155 wMaxBox
= MF_ENABLED
;
1157 if (TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1158 wMinBox
= MF_ENABLED
;
1160 if (IsZoomed( hWnd
))
1161 wRestore
= MF_ENABLED
;
1163 if (TestWinStyle( hWnd
, WS_THICKFRAME
) &&
1164 !(IsIconic( hWnd
) || IsZoomed( hWnd
)))
1165 wSize
= MF_ENABLED
;
1167 if (!IsZoomed( hWnd
) &&
1168 !IsIconic( hWnd
) &&
1169 TestWinStyle( hWnd
, WS_CAPTION
) )
1170 wMove
= MF_ENABLED
;
1172 EnableMenuItem( hMenu
, SC_MOVE
, wMove
) ;
1173 EnableMenuItem( hMenu
, SC_SIZE
, wSize
) ;
1174 EnableMenuItem( hMenu
, SC_MINIMIZE
, wMinBox
) ;
1175 EnableMenuItem( hMenu
, SC_MAXIMIZE
, wMaxBox
) ;
1176 EnableMenuItem( hMenu
, SC_RESTORE
, wRestore
) ;
1178 } // SetupSystemMenu()
1180 // GetCaptionRect( HWND hWnd, LPRECT lprc )
1182 // calcluales the rectangle of the mini-caption in screen coords.
1184 BOOL PASCAL
GetCaptionRect( HWND hWnd
, LPRECT lprc
)
1188 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1190 if (!HASCAPTION( hWnd
))
1192 SetRectEmpty( lprc
) ;
1196 GetWindowRect( hWnd
, lprc
) ;
1198 // the window might have other non-client components like
1201 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
1203 lprc
->left
+= GetSystemMetrics( SM_CXFRAME
) ;
1204 lprc
->top
+= GetSystemMetrics( SM_CYFRAME
) ;
1205 lprc
->right
-= GetSystemMetrics( SM_CXFRAME
) ;
1206 lprc
->bottom
-= GetSystemMetrics( SM_CYFRAME
) ;
1209 if (TestWinStyle( hWnd
, DS_MODALFRAME
)) // if it's a dialog box
1211 lprc
->left
+= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1212 lprc
->top
+= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1213 lprc
->right
-= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1214 lprc
->bottom
-= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1217 if (TestWinStyle( hWnd
, WS_BORDER
))
1219 lprc
->left
+= GetSystemMetrics( SM_CXBORDER
) ;
1220 lprc
->top
+= GetSystemMetrics( SM_CYBORDER
) ;
1221 lprc
->right
-= GetSystemMetrics( SM_CXBORDER
) ;
1222 lprc
->bottom
-= GetSystemMetrics( SM_CYBORDER
) ;
1225 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1226 lprc
->right
= lprc
->left
+ nCapSize
;
1228 lprc
->bottom
= lprc
->top
+ nCapSize
;
1231 } // GetCaptionRect()
1233 // GetIconRect( HWND hWnd, LPRECT lprc )
1235 // Calculates the rect of the icon in screen coordinates.
1237 BOOL PASCAL
GetIconRect( HWND hWnd
, LPRECT lprc
)
1242 fMenu
= TestWinStyle( hWnd
, WS_SYSMENU
) ;
1243 fVert
= TestWinStyle( hWnd
, IBS_VERTCAPTION
) ;
1245 if (!GetCaptionRect( hWnd
, lprc
)) // window coords
1250 SetRectEmpty( lprc
) ;
1254 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1257 lprc
->bottom
= lprc
->top
+ nCapSize
;
1259 lprc
->right
= lprc
->left
+ nCapSize
;
1268 // GetMinButtonRect()
1270 // Calculates the rect of the minimize button in screen
1273 // For horizontal captions, we have the following situation ('Y' is minimize
1274 // and '^' is maximize or restore):
1276 // +---------------------------------+
1278 // +---------------------------------+
1279 // | |.......| <-- This is the width (nSize)
1281 // For vertical captions, we have the following:
1291 // |--| . <-- This is the height of the rectangle (nSize)
1295 // In order to figure out where the minimize button goes, we first need
1296 // to know if there is a maximize button. If so, use GetMaxButtonRect()
1299 BOOL PASCAL
GetMinButtonRect( HWND hWnd
, LPRECT lprc
)
1301 if (!TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1303 SetRectEmpty( lprc
) ;
1307 // The minimize button can be in either position 1 or 2. If there
1308 // is a maximize button, it's in position 2.
1310 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1311 return GetButtonRect( hWnd
, 2, lprc
) ;
1313 return GetButtonRect( hWnd
, 1, lprc
) ;
1316 // GetMaxButtonRect()
1318 // Calculates the rect of the maximize button in screen
1321 // The maximize button, if present, is always to the far right
1324 BOOL PASCAL
GetMaxButtonRect( HWND hWnd
, LPRECT lprc
)
1326 //The maximize button can only be in position 1.
1328 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1329 return GetButtonRect( hWnd
, 1, lprc
) ;
1332 SetRectEmpty( lprc
) ;
1337 // Get the rect where a button would go.
1339 // This function does not care if it's a min or max, just whether
1340 // it is the first from the right/bottom or second from the right/bottom
1343 BOOL PASCAL
GetButtonRect( HWND hWnd
, UINT nPos
, LPRECT lprc
)
1347 if (!GetCaptionRect( hWnd
, lprc
)) //window coords
1350 nSize
= GETCAPTIONSIZE( hWnd
) ;
1352 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1354 lprc
->bottom
-= nSize
* (nPos
-1) ;
1355 lprc
->top
= lprc
->bottom
- nSize
+ 1 ;
1359 lprc
->right
-= nSize
* (nPos
-1) ;
1360 lprc
->left
= lprc
->right
- nSize
+ 1 ;
1364 } // GetButtonRect()
1366 // DrawButton( HDC hDC, HWND hWnd, BOOL fMin, BOOL fDepressed )
1368 // Draws either the min, max, or restore buttons. If fMin is FALSE then it
1369 // will draw either the Max or Restore button. If fDepressed is TRUE it will
1370 // draw the button in a down state.
1372 void PASCAL
DrawButton( HDC hDC
, HWND hWnd
, BOOL fMin
, BOOL fDepressed
)
1376 COLORREF rgbWindowFrame
;
1382 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1384 // If you look at the standard Windows' min/max buttons, you will notice
1385 // that they have two pixels of 'shadow' to the bottom and right. Since
1386 // our buttons can be really, really small, we only want one pixel of
1387 // shadow when they are small. I arbitrarily decided that if the
1388 // caption size is greater than or equal to 20 we will use two
1389 // pixels. That's what this THREASHOLD stuff does.
1391 #define THRESHOLD 20
1392 nOffset
= (nCapSize
>= THRESHOLD
) ? 2 : 1 ;
1397 hDC
= GetWindowDC( hWnd
) ;
1404 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1407 GetMinButtonRect( hWnd
, &rcButton
) ;
1409 GetMaxButtonRect( hWnd
, &rcButton
) ;
1411 GetWindowRect( hWnd
, &rc
) ;
1412 OffsetRect( &rcButton
, -rc
.left
, -rc
.top
) ;
1415 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1417 rc
= rcButton
; //separator line
1418 rc
.bottom
= --rc
.top
+ 1 ;
1423 rc
= rcButton
; //separator line
1424 rc
.right
= --rc
.left
+ 1 ;
1428 //Draw separator line
1429 SetBkColor( hDC
, rgbWindowFrame
) ;
1430 DRAWFASTRECT( hDC
, &rc
) ;
1433 SetBkColor( hDC
, RGBLTGRAY
) ;
1434 DRAWFASTRECT( hDC
, &rcButton
) ;
1438 //The normal min/max buttons have one pixel on the top and left
1439 //sides for the highlight, and two pixels on the bottom and
1440 //right side for the shadow.
1442 //When our caption is 'small' we only use one pixel on all
1445 SetBkColor( hDC
, RGBWHITE
) ;
1448 rc
.right
= rc
.left
+ 1 ;
1449 DRAWFASTRECT( hDC
, &rc
) ;
1453 rc
.bottom
= rc
.top
+ 1 ;
1454 DRAWFASTRECT( hDC
, &rc
) ;
1456 SetBkColor( hDC
, RGBGRAY
) ;
1459 rc
.left
= rc
.right
- 1 ;
1460 DRAWFASTRECT( hDC
, &rc
) ;
1461 if (nCapSize
> THRESHOLD
)
1465 DRAWFASTRECT( hDC
, &rc
) ;
1470 rc
.top
= rc
.bottom
- 1 ;
1471 DRAWFASTRECT( hDC
, &rc
) ;
1472 if (nCapSize
> THRESHOLD
)
1476 DRAWFASTRECT( hDC
, &rc
) ;
1481 rcButton
.right
-= nOffset
;
1482 rcButton
.bottom
-= nOffset
;
1486 //Draw depressed state
1488 SetBkColor( hDC
, RGBGRAY
) ;
1491 rc
.right
= rc
.left
+ nOffset
;
1492 DRAWFASTRECT( hDC
, &rc
) ;
1496 rc
.bottom
= rc
.top
+ nOffset
;
1497 DRAWFASTRECT( hDC
, &rc
) ;
1499 rcButton
.left
+= 2 * nOffset
;
1500 rcButton
.top
+= 2 * nOffset
;
1503 // Now draw the arrows. We do not want the
1504 // arrows to grow too large when we have a bigger than
1505 // normal caption, so we restrict their size.
1507 // rcButton now represents where we can place our
1510 // The maximum size of our arrows (i.e. the width of rcButton)
1511 // has been empirically determined to be SM_CYCAPTION / 2
1513 n
= ((GetSystemMetrics( SM_CYCAPTION
)) / 2) -
1514 (rcButton
.right
- rcButton
.left
) ;
1516 InflateRect( &rcButton
, n
/2-1, n
/2-1 ) ;
1519 DrawArrow( hDC
, &rcButton
, ARROW_DOWN
) ;
1521 if (IsZoomed( hWnd
))
1523 DrawArrow( hDC
, &rcButton
, ARROW_RESTORE
) ;
1526 DrawArrow( hDC
, &rcButton
, ARROW_UP
) ;
1529 ReleaseDC( hWnd
, hDC
) ;
1537 // Draws either a up or down arrow. The arrow is bound by the rectangle
1539 void PASCAL
DrawArrow( HDC hdc
, LPRECT lprc
, UINT uiStyle
)
1545 int nMax
= (lprc
->bottom
- lprc
->top
) >> 1 ;
1547 SetBkColor( hdc
, RGBBLACK
) ;
1549 // We draw the arrow by drawing a series of horizontal lines
1551 xTip
= lprc
->left
+ ((lprc
->right
- lprc
->left
+1) >> 1) ;
1555 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1556 for (row
= 1 ; row
<= nMax
; row
++ )
1558 rc
.left
= xTip
- row
;
1559 rc
.right
= xTip
+ row
- 1 ;
1560 rc
.top
= yTip
+ row
;
1561 rc
.bottom
= rc
.top
+ 1 ;
1562 DRAWFASTRECT( hdc
, &rc
) ;
1567 yTip
= lprc
->bottom
- ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1568 for ( row
= nMax
; row
> 0 ; row
-- )
1570 rc
.left
= xTip
- row
;
1571 rc
.right
= xTip
+ row
- 1 ;
1572 rc
.top
= yTip
- row
;
1573 rc
.bottom
= rc
.top
+ 1 ;
1574 DRAWFASTRECT( hdc
, &rc
) ;
1580 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 3) - 2;
1581 for (row
= 1 ; row
<= nMax
; row
++ )
1583 rc
.left
= xTip
- row
;
1584 rc
.right
= xTip
+ row
- 1 ;
1585 rc
.top
= yTip
+ row
;
1586 rc
.bottom
= rc
.top
+ 1 ;
1587 DRAWFASTRECT( hdc
, &rc
) ;
1590 yTip
+= (nMax
+1) * 2 ;
1591 for ( row
= nMax
; row
> 0 ; row
-- )
1593 rc
.left
= xTip
- row
;
1594 rc
.right
= xTip
+ row
- 1 ;
1595 rc
.top
= yTip
- row
;
1596 rc
.bottom
= rc
.top
+ 1 ;
1597 DRAWFASTRECT( hdc
, &rc
) ;
1604 #endif // wxUSE_ITSY_BITSY