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"
31 #include "wx/minifram.h"
32 #include "wx/msw/private.h"
35 #include "wx/msw/gnuwin32/extra.h"
38 #if !USE_SHARED_LIBRARY
39 IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame
, wxFrame
)
42 long wxMiniFrame::MSWDefWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
44 if ((GetWindowStyleFlag() & wxTINY_CAPTION_HORIZ
) ||
45 (GetWindowStyleFlag() & wxTINY_CAPTION_VERT
))
46 return ::ibDefWindowProc((HWND
) GetHWND(), nMsg
, wParam
, lParam
);
47 else if ( m_oldWndProc
)
48 return ::CallWindowProc(CASTWNDPROC m_oldWndProc
, (HWND
) GetHWND(), (UINT
) nMsg
, (WPARAM
) wParam
, (LPARAM
) lParam
);
50 return ::DefWindowProc((HWND
) GetHWND(), nMsg
, wParam
, lParam
);
53 wxMiniFrame::~wxMiniFrame(void)
57 /////////////////////////////////////////////////////////////////////////
59 // Project: ItsyBitsy window support module
63 // ItsyBitsy is a support module that allows you to create windows
64 // that look and act very much like a popup window witha system
65 // menu and caption bar, except everything is scaled to about 2/3
68 // For documentation on how to use ItsyBits, read the document
72 // 9/27/91 Charlie Kindel (cek/ckindel)
73 // Wrote and documented it.
76 // 2/23/93 cek Added minimize/maximize buttons.
77 // 3/18/93 cek Fixed system menu bug where system menu
78 // popped back up if you clicked on the
79 // icon again while it was up.
80 // 3/24/93 cek More comments. Fixed DS_MODALDIALOG style
81 // problem. Use auto precompiled headers
84 //////////////////////////////////////////////////////////////////////////
91 #if !defined( __WATCOMC__ ) && !defined( __MWERKS__ )
100 // Some mildly useful macros for the standard 16 colors
101 #define RGBBLACK RGB(0,0,0)
102 #define RGBRED RGB(128,0,0)
103 #define RGBGREEN RGB(0,128,0)
104 #define RGBBLUE RGB(0,0,128)
106 #define RGBBROWN RGB(128,128,0)
107 #define RGBMAGENTA RGB(128,0,128)
108 #define RGBCYAN RGB(0,128,128)
109 #define RGBLTGRAY RGB(192,192,192)
111 #define RGBGRAY RGB(128,128,128)
112 #define RGBLTRED RGB(255,0,0)
113 #define RGBLTGREEN RGB(0,255,0)
114 #define RGBLTBLUE RGB(0,0,255)
116 #define RGBYELLOW RGB(255,255,0)
117 #define RGBLTMAGENTA RGB(255,0,255)
118 #define RGBLTCYAN RGB(0,255,255)
119 #define RGBWHITE RGB(255,255,255)
122 #ifndef GlobalAllocPtr
123 #define GlobalPtrHandle(lp) \
124 ((HGLOBAL)GlobalHandle(lp))
126 #define GlobalLockPtr(lp) \
127 ((BOOL)GlobalLock(GlobalPtrHandle(lp)))
128 #define GlobalUnlockPtr(lp) \
129 GlobalUnlock(GlobalPtrHandle(lp))
131 #define GlobalAllocPtr(flags, cb) \
132 (GlobalLock(GlobalAlloc((flags), (cb))))
133 #define GlobalReAllocPtr(lp, cbNew, flags) \
134 (GlobalUnlockPtr(lp), GlobalLock(GlobalReAlloc(GlobalPtrHandle(lp) , (cbNew), (flags))))
135 #define GlobalFreePtr(lp) \
136 (GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp)))
139 #if defined(__BORLANDC__) || defined(__WATCOMC__)
140 #define max(a,b) (((a) > (b)) ? (a) : (b))
141 #define min(a,b) (((a) < (b)) ? (a) : (b))
144 // CAPTIONXY is the default size of the system menu icon. This
145 // determines the height/width of the caption.
147 // The value that results from the following formula works out
148 // nicely for the veritcal caption on VGA, 8514 (Large Fonts),
149 // 8514 (Small Fonts), XGA (Small Fonts), XGA (Large Fonts),
150 // and TIGA (Small Fonts). It may not be good on other displays.
152 // The problem is that TT fonts turn into bitmap fonts when they
153 // are sized below a certain threshold. The idea is to make the
154 // size of the caption just big enough to get the smallest TT
155 // (scalable) font to fit.
157 #define CAPTIONXY (GetSystemMetrics( SM_CYCAPTION ) / 2 + 1)
159 #define TestWinStyle( hWnd, dwStyleBit ) \
160 (((DWORD)GetWindowLong( hWnd, GWL_STYLE ) & (DWORD)dwStyleBit) ? TRUE : FALSE )
161 #define HASCAPTION( hwnd ) (TestWinStyle( hwnd, IBS_VERTCAPTION ) ||\
162 TestWinStyle( hwnd, IBS_HORZCAPTION ))
164 #define SETCAPTIONSIZE(h,i) (UINT)SetProp(h,"ibSize",(HANDLE)i)
165 #define GETCAPTIONSIZE(h) (UINT)GetProp(h,"ibSize")
166 #define FREECAPTIONSIZE(h) RemoveProp(h,"ibSize")
168 #define SETMENUWASUPFLAG(h,i) (UINT)SetProp(h,"ibFlag",(HANDLE)i)
169 #define GETMENUWASUPFLAG(h) (UINT)GetProp(h,"ibFlag")
170 #define FREEMENUWASUPFLAG(h) RemoveProp(h,"ibFlag")
172 /////////////////////////////////////////////////////////////////////
173 // Little known fact:
174 // ExtTextOut() is the fastest way to draw a filled rectangle
175 // in Windows (if you don't want dithered colors or borders).
177 // Unfortunately there is a bug in the Windows 3.0 8514 driver
178 // in using ExtTextOut() to a memory DC. If you are drawing
179 // to an off screen bitmap, then blitting that bitmap to the
180 // display, do not #define wxUSE_EXTTEXTOUT below.
182 // The following macro (DRAWFASTRECT) draws a filled rectangle
183 // with no border and a solid color. It uses the current back-
184 // ground color as the fill color.
185 //////////////////////////////////////////////////////////////////////
186 #define wxUSE_EXTTEXTOUT
187 #ifdef wxUSE_EXTTEXTOUT
188 #define DRAWFASTRECT(hdc,lprc) ExtTextOut(hdc,0,0,ETO_OPAQUE,lprc,NULL,0,NULL)
190 #define DRAWFASTRECT(hdc,lprc) {\
191 HBRUSH hbr = CreateSolidBrush( GetBkColor( hdc ) ) ;\
192 hbr = SelectObject(hdc, hbr) ;\
193 PatBlt(hdc,(lprc)->left,(lprc)->top,(lprc)->right-(lprc)->left,(lprc)->bottom-(lprc)->top,PATCOPY) ;\
194 hbr = SelectObject(hdc, hbr) ;\
195 DeleteObject( hbr ) ;\
199 // The DrawArrow function takes the following to indicate what
200 // kind of arrow to draw.
204 #define ARROW_RESTORE 2
206 BOOL PASCAL
DepressMinMaxButton( HWND hWnd
, UINT uiHT
, LPRECT
) ;
207 BOOL PASCAL
DoMenu( HWND hWnd
) ;
208 void PASCAL
SetupSystemMenu( HWND hWnd
, HMENU hMenu
) ;
209 BOOL PASCAL
GetCaptionRect( HWND hWnd
, LPRECT lprc
) ;
210 BOOL PASCAL
GetIconRect( HWND hWnd
, LPRECT lprc
) ;
211 BOOL PASCAL
GetButtonRect( HWND hWnd
, UINT nPos
, LPRECT lprc
) ;
212 BOOL PASCAL
GetMinButtonRect( HWND hWnd
, LPRECT lprc
) ;
213 BOOL PASCAL
GetMaxButtonRect( HWND hWnd
, LPRECT lprc
) ;
214 BOOL PASCAL
DrawCaption( HDC hDC
, HWND hWnd
, LPRECT lprc
,
215 BOOL fVert
, BOOL fSysMenu
,
216 BOOL fMin
, BOOL fMax
, BOOL fActive
) ;
217 void PASCAL
DrawSysMenu( HDC hDC
, HWND hWnd
, BOOL fInvert
) ;
218 void PASCAL
DrawButton( HDC hDC
, HWND hWnd
, BOOL fMin
, BOOL fDepressed
) ;
219 void PASCAL
DrawArrow( HDC hdc
, LPRECT lprc
, UINT uiStyle
) ;
225 ///////////////////////////////////////////////////////////////////////
226 // External/Public functions
227 ///////////////////////////////////////////////////////////////////////
229 /////////////////////////////////////////////////////////////////
230 // UINT WINAPI ibGetCaptionSize( HWND hWnd )
234 // Gets the size of the caption (height if horz, width if
239 ///////////////////////////////////////////////////////////////
240 UINT WINAPI
ibGetCaptionSize( HWND hWnd
)
242 return GETCAPTIONSIZE( hWnd
) + 1 ;
243 } // ibSetCaptionSize()
245 /////////////////////////////////////////////////////////////////
246 // UINT WINAPI ibSetCaptionSize( HWND hWnd, UINT nSize )
250 // Changes the size of the caption (height if horz, width if
255 //////////////////////////////////////////////////////////////////
256 UINT WINAPI
ibSetCaptionSize( HWND hWnd
, UINT nSize
)
264 ui
= SETCAPTIONSIZE( hWnd
, nSize
) ;
266 // Once we change the window style, we need a WM_NCCALCRECT
269 // SWP_FRAMECHANGED is not documented in the 3.1 SDK docs,
270 // but *is* in WINDOWS.H.
272 SetWindowPos( hWnd
, NULL
, 0, 0, 0, 0, SWP_FRAMECHANGED
|
273 SWP_NOSIZE
| SWP_NOMOVE
|
274 SWP_NOACTIVATE
| SWP_NOZORDER
) ;
278 } // ibSetCaptionSize()
280 /////////////////////////////////////////////////////////////////
281 // LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam )
285 // This function should be called instead of DefWindowProc() for
286 // windows that want to have itsybitsy captions.
290 //////////////////////////////////////////////////////////////////
291 LRESULT WINAPI
ibDefWindowProc( HWND hWnd
, UINT uiMsg
, WPARAM wParam
, LPARAM lParam
)
300 // was hit then pop up the menu
302 if (HASCAPTION( hWnd
) && (wParam
== VK_SPACE
))
316 DWORD dw
= GetWindowLong( hWnd
, GWL_STYLE
) ;
318 // Fool DefWindowProc into thinking we do not have
319 // a system menu. Otherwise it will try to
322 SetWindowLong( hWnd
, GWL_STYLE
, dw
&~WS_SYSMENU
) ;
323 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
324 SetWindowLong( hWnd
, GWL_STYLE
, dw
) ;
330 // The menu that is poped up for the system menu with
331 // TrackPopupMenu() sends it's notifications as WM_COMMAND
332 // messages. We need to translate these into
333 // WM_SYSCOMMAND messages. All standard WM_SYSCOMMAND
334 // ids are greater than 0xF000.
336 // This could be a possible cause of confusion if the
337 // itsybitsy window had children that used SC_MOVE or SC_CLOSE
338 // as their IDs. Take note and be careful.
340 // Also, because ibDefWindowProc looks at WM_COMMAND messages,
341 // you will need to be careful to call ibDefWindowProc() for
342 // any wm_command messages that you would normally ignore.
343 // Otherwise the system menu won't work.
345 if (wParam
>= 0xF000)
346 // Call PostMessage() here instead of SendMessage!
348 // Our menu was created by TrackPopupMenu(). TPM() does
349 // not return until after the menu has been destroyed
350 // (and thus the command associated with the menu selection
351 // sent). Therefore when we get here, we are still
352 // *inside* TPM(). If we Send WM_SYSCOMMAND, SC_CLOSE
353 // to the window, the window will be destroyed before
354 // TPM() returns to our code within DoMenu() below. Wel...
355 // We do stuff with the window handle after DoMenu()
356 // returns (namely GetProp()). Since the window has
357 // been destroyed,this is bad.
358 PostMessage( hWnd
, WM_SYSCOMMAND
, wParam
, lParam
) ;
360 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
362 case WM_GETMINMAXINFO
:
364 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
365 if (HASCAPTION( hWnd
) && TestWinStyle( hWnd
, WS_THICKFRAME
))
367 LPPOINT lppt
= (LPPOINT
)lParam
;
372 int cx
, cy
; // window frame/border width
374 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
376 cx
= GetSystemMetrics( SM_CXFRAME
) ;
377 cy
= GetSystemMetrics( SM_CYFRAME
) ;
379 else if (TestWinStyle(hWnd
, WS_BORDER
))
381 cx
= GetSystemMetrics( SM_CXBORDER
) ;
382 cy
= GetSystemMetrics( SM_CYBORDER
) ;
386 // VZ: I don't know what should be here, but the vars must
388 wxFAIL_MSG("don't know how to initialize cx, cy");
393 GetIconRect( hWnd
, &rcMenu
) ;
394 GetMinButtonRect( hWnd
, &rcMin
) ;
395 GetMaxButtonRect( hWnd
, &rcMax
) ;
396 nX
= (rcMenu
.right
-rcMenu
.left
) +
397 (rcMin
.right
-rcMin
.left
) +
398 (rcMin
.right
-rcMin
.left
) ;
401 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
) )
403 lppt
[3].x
= nCapSize
+ cx
* 2 - 1 ;
404 lppt
[3].y
= nX
+ (2* nCapSize
) ;
408 lppt
[3].x
= nX
+ (2* nCapSize
) ;
409 lppt
[3].y
= nCapSize
+ cy
* 2 - 1 ;
412 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
416 /////////////////////////////////////////////////////////////////////
417 // Non-client area messages. These are used to allow the
418 // minature caption bar to be handled correctly.
424 // We have two things that we need to store somewhere:
425 // 1) The caption height (width).
426 // and 2) A flag indicating whether the sysmenu was
429 // CAPTIONXY is a macro that calls GetSystemMetrics.
431 SETCAPTIONSIZE( hWnd
, CAPTIONXY
) ;
433 // Set our flag that tells us whether the system menu was
436 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
438 // Are we in 3.1? If so we have some neat features
439 // we can use like rotated TrueType fonts.
441 fWin31
= (BOOL
)(LOWORD( GetVersion() ) >= 0x030A) ;
443 // If IBS_????CAPTION was specified and the WS_DLGFRAME (or
444 // WS_DLGFRAME 'cause it == WS_CAPTION | WS_BORDER)
445 // was specified the creator made a mistake. Things get really
446 // ugly if DefWindowProc sees WS_DLGFRAME, so we strip
447 // the WS_DLGFRAME part off!
449 dwStyle
= GetWindowLong( hWnd
, GWL_STYLE
) ;
450 if ((dwStyle
& IBS_VERTCAPTION
|| dwStyle
& IBS_HORZCAPTION
) &&
451 dwStyle
& WS_DLGFRAME
)
453 dwStyle
&= (DWORD
)~WS_DLGFRAME
;
454 SetWindowLong( hWnd
, GWL_STYLE
, dwStyle
) ;
457 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
460 // We store the caption size in a window prop. so we
461 // must remove props.
463 FREECAPTIONSIZE( hWnd
) ;
464 FREEMENUWASUPFLAG( hWnd
) ;
465 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
468 // This is sent when the window manager wants to find out
469 // how big our client area is to be. If we have a mini-caption
470 // then we trap this message and calculate the cleint area rect,
471 // which is the client area rect calculated by DefWindowProc()
472 // minus the width/height of the mini-caption bar
474 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
475 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
))
477 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
479 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
) )
480 ((LPRECT
)lParam
)->left
+= nCapSize
;
482 ((LPRECT
)lParam
)->top
+= nCapSize
;
487 // This message is sent whenever the mouse moves over us.
488 // We will depend on DefWindowProc for everything unless
489 // there is a mini-caption, in which case we will
490 // return HTCAPTION or HTSYSMENU. When the user clicks
491 // or double clicks, NC_LBUTTON/ message are sent with
492 // wParam equal to what we return here.
493 // This means that this is an ideal place to figure out
496 // let defwindowproc handle the standard borders etc...
498 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
499 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
) && lRet
== HTNOWHERE
)
507 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
509 // if DefWindowProc returned HTCAPTION then we have to
510 // refine the area and return HTSYSMENU if appropriate
512 pt
.x
= LOWORD( lParam
) ;
513 pt
.y
= HIWORD( lParam
) ;
515 GetCaptionRect( hWnd
, &rc
) ; // window coords
516 if (PtInRect( &rc
, pt
))
520 // rely on the fact that Get???Rect() return an invalid
521 // (empty) rectangle if the menu/buttons don't exist
523 GetIconRect( hWnd
, &rcMenu
) ;
524 GetMinButtonRect( hWnd
, &rcMinButton
) ;
525 GetMaxButtonRect( hWnd
, &rcMaxButton
) ;
527 if (PtInRect( &rcMenu
, pt
))
530 if (PtInRect( &rcMinButton
, pt
))
533 if (PtInRect( &rcMaxButton
, pt
))
537 if (lRet
!= HTSYSMENU
)
538 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
541 case WM_NCLBUTTONDBLCLK
:
542 // Windows recieve WM_NC?BUTTONDBLCLK messages whether they
543 // have CS_DBLCLKS or not. We watch for one of these
544 // to see if the user double clicked on the system menu (to
545 // close the window) or on the caption (to maximize the window).
547 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
) && wParam
== HTSYSMENU
)
549 SendMessage( hWnd
, WM_CLOSE
, 0, 0L ) ;
552 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
554 case WM_NCLBUTTONDOWN
:
558 // If we're iconic or we don't have a caption then
559 // DefWindowProc will do the job just fine.
561 if (IsIconic( hWnd
) || !HASCAPTION( hWnd
))
562 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
564 // Here's were we handle the system menu, the min and max buttons.
565 // If you wanted to change the behavior of the min/max buttons
566 // do something like swap tool palettes or something, you
567 // would change the SendMessage() calls below.
572 if (GETMENUWASUPFLAG( hWnd
) == FALSE
&& DoMenu( hWnd
))
573 SETMENUWASUPFLAG( hWnd
, TRUE
) ;
575 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
579 GetMinButtonRect( hWnd
, &rc
) ;
580 // Note that DepressMinMaxButton() goes into
581 // a PeekMessage() loop waiting for the mouse
584 if (DepressMinMaxButton( hWnd
, wParam
, &rc
))
585 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_MINIMIZE
, lParam
) ;
589 GetMaxButtonRect( hWnd
, &rc
) ;
590 // Note that DepressMinMaxButton() goes into
591 // a PeekMessage() loop waiting for the mouse
594 if (DepressMinMaxButton( hWnd
, wParam
, &rc
))
597 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_RESTORE
, lParam
) ;
599 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_MAXIMIZE
, lParam
) ;
604 // Well, it appears as though the user clicked somewhere other
605 // than the buttons. We let DefWindowProc do it's magic.
606 // This is where things like dragging and sizing the
609 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
616 if (IsIconic( hWnd
))
617 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
619 // Paint the non-client area here. We will call DefWindowProc
620 // after we are done so it can paint the borders and so
623 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
624 if (HASCAPTION( hWnd
))
628 HDC hDC
= GetWindowDC( hWnd
) ;
631 GetCaptionRect( hWnd
, &rcCap
) ; // Convert to window coords
632 GetWindowRect( hWnd
, &rc
) ;
633 OffsetRect( &rcCap
, -rc
.left
, -rc
.top
) ;
635 if (uiMsg
== WM_NCPAINT
)
636 fActive
= (hWnd
== GetActiveWindow()) ;
640 DrawCaption( hDC
, hWnd
, &rcCap
,
641 TestWinStyle(hWnd
, IBS_VERTCAPTION
),
642 TestWinStyle(hWnd
, WS_SYSMENU
),
643 TestWinStyle(hWnd
, WS_MINIMIZEBOX
),
644 TestWinStyle(hWnd
, WS_MAXIMIZEBOX
),
647 ReleaseDC( hWnd
, hDC
) ;
653 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
658 } // ibDefWindowProc()
660 // ibAdjustWindowRect( HWND hWnd, LPRECT lprc )
662 // Does the same thing as the USER function AdjustWindowRect(),
663 // but knows about itsybitsy windows. AdjustWindowRect() is
664 // bogus for stuff like this.
666 void WINAPI
ibAdjustWindowRect( HWND hWnd
, LPRECT lprc
)
668 short cx
= 0, cy
= 0 ;
671 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
673 // First check Windows's styles, then our own.
675 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
677 cx
= GetSystemMetrics( SM_CXFRAME
) ;
678 cy
= GetSystemMetrics( SM_CYFRAME
) ;
681 if (TestWinStyle(hWnd
, DS_MODALFRAME
))
683 cx
= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
684 cy
= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
687 if (TestWinStyle(hWnd
, WS_BORDER
))
689 cx
= GetSystemMetrics( SM_CXBORDER
) ;
690 cy
= GetSystemMetrics( SM_CYBORDER
) ;
693 InflateRect( lprc
, cx
, cy
) ;
695 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
696 lprc
->left
-= nCapSize
;
698 if (TestWinStyle( hWnd
, IBS_HORZCAPTION
))
699 lprc
->top
-= nCapSize
;
701 } // ibAdjustWindowRect()
704 ///////////////////////////////////////////////////////////////////////
705 // Internal functions
706 ///////////////////////////////////////////////////////////////////////
708 // DepressMinMaxButton()
710 // This function is called when the user has pressed either the min or
711 // max button (i.e. WM_NCLBUTTONDOWN). We go into a Peekmessage() loop,
712 // waiting for the mouse to come back up. This allows us to make the
713 // button change up/down state like a real button does.
715 // lprc points to the rectangle that describes the button the
716 // user has clicked on.
718 BOOL PASCAL
DepressMinMaxButton( HWND hWnd
, UINT uiHT
, LPRECT lprc
)
720 BOOL fDepressed
= TRUE
;
723 // Draw button in down state
724 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
) ;
729 if (PeekMessage((LPMSG
)&msg
, NULL
, WM_MOUSEFIRST
, WM_MOUSELAST
, PM_REMOVE
))
735 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, !fDepressed
) ;
737 return PtInRect( lprc
, msg
.pt
) ;
740 if (PtInRect( lprc
, msg
.pt
))
743 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
= TRUE
) ;
748 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
= FALSE
) ;
755 } // DepressMinMaxButton()
757 // DrawCaption( HDC hDC, HWND hWnd, LPRECT lprc,
758 // BOOL fVert, BOOL fSysMenu, BOOL fActive )
760 // This function draws an itsy bitsy caption bar with or
761 // without system menu to the dc specified by hDC. The
762 // caption is drawn to fit within the lprc RECT and is
763 // drawn//withOut/ borders.
765 BOOL PASCAL
DrawCaption( HDC hDC
, HWND hWnd
, LPRECT lprc
,
766 BOOL fVert
, BOOL fSysMenu
, BOOL fMin
,
767 BOOL fMax
, BOOL fActive
)
771 COLORREF rgbCaptionBG
;
773 COLORREF rgbWindowFrame
;
778 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
782 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
784 // if we have focus use the active caption color
785 // otherwise use the inactive caption color
789 rgbText
= GetSysColor( COLOR_CAPTIONTEXT
) ;
790 rgbCaptionBG
= GetSysColor( COLOR_ACTIVECAPTION
) ;
795 rgbText
= GetSysColor( COLOR_INACTIVECAPTIONTEXT
) ;
797 rgbText
= GetSysColor( COLOR_CAPTIONTEXT
) ;
799 rgbCaptionBG
= GetSysColor( COLOR_INACTIVECAPTION
) ;
802 SetBkMode( hDC
, TRANSPARENT
) ;
803 SelectObject( hDC
, GetStockObject( NULL_BRUSH
) ) ;
804 SelectObject( hDC
, GetStockObject( NULL_PEN
) ) ;
811 rcCap
.top
+= nCapSize
;
813 rcCap
.left
+= nCapSize
;
819 rcCap
.bottom
-= nCapSize
;
821 rcCap
.right
-= nCapSize
;
827 rcCap
.bottom
-= nCapSize
;
829 rcCap
.right
-= nCapSize
;
834 rc
.left
= lprc
->right
- 1 ;
835 rc
.right
= lprc
->right
;
837 rc
.bottom
= lprc
->bottom
;
841 rc
.left
= lprc
->left
;
842 rc
.right
= lprc
->right
;
843 rc
.bottom
= lprc
->bottom
;
844 rc
.top
= rc
.bottom
- 1 ;
847 SetBkColor( hDC
, rgbWindowFrame
) ;
848 DRAWFASTRECT( hDC
, &rc
) ;
850 hbrCaption
= CreateSolidBrush( rgbCaptionBG
) ;
851 hbrCaption
= (HBRUSH
) SelectObject( hDC
, hbrCaption
) ;
852 SelectObject( hDC
, (HPEN
) GetStockObject( NULL_PEN
) ) ;
854 Rectangle( hDC
, rcCap
.left
, rcCap
.top
, rcCap
.right
, rcCap
.bottom
+ 1 ) ;
856 Rectangle( hDC
, rcCap
.left
, rcCap
.top
, rcCap
.right
+1, rcCap
.bottom
) ;
857 hbrCaption
= (HBRUSH
) SelectObject( hDC
, hbrCaption
) ;
858 DeleteObject( hbrCaption
) ;
861 // Draw caption text here. Only do it in 3.1 'cause 3.1 gives
864 ui
= GetWindowTextLength( hWnd
) ;
875 lpsz
= (char*)GlobalAllocPtr( GHND
, ui
+ 2 );
880 GetWindowText( hWnd
, lpsz
, ui
+ 1 ) ;
881 nBkMode
= SetBkMode( hDC
, TRANSPARENT
) ;
882 rgbText
= SetTextColor( hDC
, rgbText
) ;
884 memset( &lf
, '\0', sizeof(LOGFONT
) ) ;
886 lf
.lfHeight
= -(int)(nCapSize
- 3) ;
887 lf
.lfCharSet
= ANSI_CHARSET
;
888 lf
.lfQuality
= DEFAULT_QUALITY
;
889 lf
.lfClipPrecision
= CLIP_LH_ANGLES
| CLIP_STROKE_PRECIS
;
892 lf
.lfWeight
= FW_BOLD
;
897 // Can only rotate true type fonts (well, ok, we could
898 // try and use "modern").
899 strcpy( lf
.lfFaceName
, "Arial" ) ;
900 lf
.lfPitchAndFamily
= FF_SWISS
| 0x04;
901 lf
.lfEscapement
= 900 ;
903 // Note: The Win 3.1 documentation for CreateFont() say's
904 // that the lfOrientation member is ignored. It appears,
905 // that on Windows 16 3.1 this is true, but when running
906 // as a 16 bit WinApp on WindowsNT 3.1 the lfOrientation
907 // must be set or the text does not rotate!
909 lf
.lfOrientation
= 900 ;
911 hFont
= CreateFontIndirect( &lf
) ;
912 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
914 GetTextExtentPoint( hDC
, lpsz
, ui
, &Size
) ;
915 cx
= rcCap
.bottom
- ((rcCap
.bottom
- rcCap
.top
- Size
.cx
) / 2) ;
916 cy
= rcCap
.left
- 1 + ((rcCap
.right
- rcCap
.left
- Size
.cy
) / 2) ;
918 // Make sure we got a rotatable font back.
920 GetTextMetrics( hDC
, &tm
) ;
921 if (tm
.tmPitchAndFamily
& TMPF_VECTOR
||
922 tm
.tmPitchAndFamily
& TMPF_TRUETYPE
)
926 min( (long)cx
, rcCap
.bottom
),
931 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
932 DeleteObject( hFont
) ;
936 // Use small fonts always for the horizontal. Cause it looks
937 // more like "System" than Arial.
939 lf
.lfPitchAndFamily
= FF_SWISS
;
941 hFont
= CreateFontIndirect( &lf
) ;
942 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
944 GetTextExtentPoint( hDC
, lpsz
, ui
, &Size
) ;
945 cx
= rcCap
.left
+ ((rcCap
.right
- rcCap
.left
- Size
.cx
) / 2) ;
946 cy
= rcCap
.top
+ ((rcCap
.bottom
- rcCap
.top
- Size
.cy
) / 2) ;
948 // Figger out how big the string is
951 max( (long)cx
, rcCap
.left
),
956 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
957 DeleteObject( hFont
) ;
962 rgbText
= SetTextColor( hDC
, rgbText
) ;
963 SetBkMode( hDC
, nBkMode
) ;
965 GlobalFreePtr( lpsz
) ;
970 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
973 DrawButton( hDC
, hWnd
, TRUE
, FALSE
) ;
976 DrawButton( hDC
, hWnd
, FALSE
, FALSE
) ;
983 // DrawSysMenu( HDC hDC, hWnd, BOOL fInvert )
985 // Draws the little system menu icon.
987 void PASCAL
DrawSysMenu( HDC hDC
, HWND hWnd
, BOOL fInvert
)
992 COLORREF rgbIconFace
;
993 COLORREF rgbWindowFrame
;
997 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1002 hDC
= GetWindowDC( hWnd
) ;
1009 rgbIconFace
= GetNearestColor( hDC
, RGBLTGRAY
) ;
1010 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1012 GetIconRect( hWnd
, &rcIcon
) ;
1013 GetWindowRect( hWnd
, &rc
) ;
1015 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1019 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1021 rc
= rcIcon
; // separator line
1022 rc
.top
= ++rc
.bottom
- 1 ;
1026 rc
= rcIcon
; // separator line
1027 rc
.left
= ++rc
.right
- 1 ;
1031 SetBkColor( hDC
, rgbIconFace
) ;
1032 DRAWFASTRECT( hDC
, &rcTemp
) ;
1034 // Draw separator line
1035 SetBkColor( hDC
, rgbWindowFrame
) ;
1036 DRAWFASTRECT( hDC
, &rc
) ;
1040 // Draw the little horizontal doo-hickey
1042 rcTemp
.top
= rcIcon
.top
+ ((nCapSize
-1) / 2) ;
1043 rcTemp
.bottom
= rcTemp
.top
+ 3 ;
1044 rcTemp
.left
= rcTemp
.left
+ 3 ;
1045 rcTemp
.right
= rcTemp
.right
- 1 ;
1047 SetBkColor( hDC
, RGBGRAY
) ;
1048 DRAWFASTRECT( hDC
, &rcTemp
) ;
1051 OffsetRect( &rc
, -1, -1 ) ;
1052 SetBkColor( hDC
, RGBBLACK
) ;
1053 DRAWFASTRECT( hDC
, &rc
) ;
1055 InflateRect( &rc
, -1, -1 ) ;
1056 SetBkColor( hDC
, RGBWHITE
) ;
1057 DRAWFASTRECT( hDC
, &rc
) ;
1061 InvertRect( hDC
, &rcIcon
) ;
1064 ReleaseDC( hWnd
, hDC
) ;
1069 // DoMenu( HWND hWnd )
1071 // Pops up the system menu.
1073 BOOL PASCAL
DoMenu( HWND hWnd
)
1082 if (!TestWinStyle(hWnd
, WS_SYSMENU
))
1085 hDC
= GetWindowDC( hWnd
);
1090 DrawSysMenu( hDC
, hWnd
, TRUE
) ;
1094 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1105 GetIconRect( hWnd
, &rcIcon
) ;
1106 GetWindowRect( hWnd
, &rc
) ;
1107 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1109 ClientToScreen( hWnd
, &pt
) ;
1110 ClientToScreen( hWnd
, (LPPOINT
)&rc
.right
) ;
1112 dw
= GetWindowLong( hWnd
, GWL_STYLE
) ;
1113 SetWindowLong( hWnd
, GWL_STYLE
, dw
| WS_SYSMENU
) ;
1115 hMenu
= GetSystemMenu( hWnd
, FALSE
) ;
1116 SetupSystemMenu( hWnd
, hMenu
) ;
1118 SetWindowLong( hWnd
, GWL_STYLE
, dw
) ;
1120 TrackPopupMenu( hMenu
, 0, //TPM_LEFTALIGN,
1127 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
1128 ReleaseDC( hWnd
, hDC
) ;
1134 // SetupSystemMenu( HWND hWnd, HMENU hMenu )
1136 // Enables/Disables the appropriate menu items on the
1137 // menu passed for the window passed.
1139 void PASCAL
SetupSystemMenu( HWND hWnd
, HMENU hMenu
)
1147 // Assume all should be grayed.
1149 wSize
= wMove
= wMinBox
= wMaxBox
= wRestore
= MF_GRAYED
;
1151 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
) || IsIconic( hWnd
))
1152 wMaxBox
= MF_ENABLED
;
1154 if (TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1155 wMinBox
= MF_ENABLED
;
1157 if (IsZoomed( hWnd
))
1158 wRestore
= MF_ENABLED
;
1160 if (TestWinStyle( hWnd
, WS_THICKFRAME
) &&
1161 !(IsIconic( hWnd
) || IsZoomed( hWnd
)))
1162 wSize
= MF_ENABLED
;
1164 if (!IsZoomed( hWnd
) &&
1165 !IsIconic( hWnd
) &&
1166 TestWinStyle( hWnd
, WS_CAPTION
) )
1167 wMove
= MF_ENABLED
;
1169 EnableMenuItem( hMenu
, SC_MOVE
, wMove
) ;
1170 EnableMenuItem( hMenu
, SC_SIZE
, wSize
) ;
1171 EnableMenuItem( hMenu
, SC_MINIMIZE
, wMinBox
) ;
1172 EnableMenuItem( hMenu
, SC_MAXIMIZE
, wMaxBox
) ;
1173 EnableMenuItem( hMenu
, SC_RESTORE
, wRestore
) ;
1175 } // SetupSystemMenu()
1177 // GetCaptionRect( HWND hWnd, LPRECT lprc )
1179 // calcluales the rectangle of the mini-caption in screen coords.
1181 BOOL PASCAL
GetCaptionRect( HWND hWnd
, LPRECT lprc
)
1185 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1187 if (!HASCAPTION( hWnd
))
1189 SetRectEmpty( lprc
) ;
1193 GetWindowRect( hWnd
, lprc
) ;
1195 // the window might have other non-client components like
1198 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
1200 lprc
->left
+= GetSystemMetrics( SM_CXFRAME
) ;
1201 lprc
->top
+= GetSystemMetrics( SM_CYFRAME
) ;
1202 lprc
->right
-= GetSystemMetrics( SM_CXFRAME
) ;
1203 lprc
->bottom
-= GetSystemMetrics( SM_CYFRAME
) ;
1206 if (TestWinStyle( hWnd
, DS_MODALFRAME
)) // if it's a dialog box
1208 lprc
->left
+= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1209 lprc
->top
+= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1210 lprc
->right
-= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1211 lprc
->bottom
-= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1214 if (TestWinStyle( hWnd
, WS_BORDER
))
1216 lprc
->left
+= GetSystemMetrics( SM_CXBORDER
) ;
1217 lprc
->top
+= GetSystemMetrics( SM_CYBORDER
) ;
1218 lprc
->right
-= GetSystemMetrics( SM_CXBORDER
) ;
1219 lprc
->bottom
-= GetSystemMetrics( SM_CYBORDER
) ;
1222 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1223 lprc
->right
= lprc
->left
+ nCapSize
;
1225 lprc
->bottom
= lprc
->top
+ nCapSize
;
1228 } // GetCaptionRect()
1230 // GetIconRect( HWND hWnd, LPRECT lprc )
1232 // Calculates the rect of the icon in screen coordinates.
1234 BOOL PASCAL
GetIconRect( HWND hWnd
, LPRECT lprc
)
1239 fMenu
= TestWinStyle( hWnd
, WS_SYSMENU
) ;
1240 fVert
= TestWinStyle( hWnd
, IBS_VERTCAPTION
) ;
1242 if (!GetCaptionRect( hWnd
, lprc
)) // window coords
1247 SetRectEmpty( lprc
) ;
1251 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1254 lprc
->bottom
= lprc
->top
+ nCapSize
;
1256 lprc
->right
= lprc
->left
+ nCapSize
;
1265 // GetMinButtonRect()
1267 // Calculates the rect of the minimize button in screen
1270 // For horizontal captions, we have the following situation ('Y' is minimize
1271 // and '^' is maximize or restore):
1273 // +---------------------------------+
1275 // +---------------------------------+
1276 // | |.......| <-- This is the width (nSize)
1278 // For vertical captions, we have the following:
1288 // |--| . <-- This is the height of the rectangle (nSize)
1292 // In order to figure out where the minimize button goes, we first need
1293 // to know if there is a maximize button. If so, use GetMaxButtonRect()
1296 BOOL PASCAL
GetMinButtonRect( HWND hWnd
, LPRECT lprc
)
1298 if (!TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1300 SetRectEmpty( lprc
) ;
1304 // The minimize button can be in either position 1 or 2. If there
1305 // is a maximize button, it's in position 2.
1307 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1308 return GetButtonRect( hWnd
, 2, lprc
) ;
1310 return GetButtonRect( hWnd
, 1, lprc
) ;
1313 // GetMaxButtonRect()
1315 // Calculates the rect of the maximize button in screen
1318 // The maximize button, if present, is always to the far right
1321 BOOL PASCAL
GetMaxButtonRect( HWND hWnd
, LPRECT lprc
)
1323 //The maximize button can only be in position 1.
1325 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1326 return GetButtonRect( hWnd
, 1, lprc
) ;
1329 SetRectEmpty( lprc
) ;
1334 // Get the rect where a button would go.
1336 // This function does not care if it's a min or max, just whether
1337 // it is the first from the right/bottom or second from the right/bottom
1340 BOOL PASCAL
GetButtonRect( HWND hWnd
, UINT nPos
, LPRECT lprc
)
1344 if (!GetCaptionRect( hWnd
, lprc
)) //window coords
1347 nSize
= GETCAPTIONSIZE( hWnd
) ;
1349 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1351 lprc
->bottom
-= nSize
* (nPos
-1) ;
1352 lprc
->top
= lprc
->bottom
- nSize
+ 1 ;
1356 lprc
->right
-= nSize
* (nPos
-1) ;
1357 lprc
->left
= lprc
->right
- nSize
+ 1 ;
1361 } // GetButtonRect()
1363 // DrawButton( HDC hDC, HWND hWnd, BOOL fMin, BOOL fDepressed )
1365 // Draws either the min, max, or restore buttons. If fMin is FALSE then it
1366 // will draw either the Max or Restore button. If fDepressed is TRUE it will
1367 // draw the button in a down state.
1369 void PASCAL
DrawButton( HDC hDC
, HWND hWnd
, BOOL fMin
, BOOL fDepressed
)
1373 COLORREF rgbWindowFrame
;
1379 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1381 // If you look at the standard Windows' min/max buttons, you will notice
1382 // that they have two pixels of 'shadow' to the bottom and right. Since
1383 // our buttons can be really, really small, we only want one pixel of
1384 // shadow when they are small. I arbitrarily decided that if the
1385 // caption size is greater than or equal to 20 we will use two
1386 // pixels. That's what this THREASHOLD stuff does.
1388 #define THRESHOLD 20
1389 nOffset
= (nCapSize
>= THRESHOLD
) ? 2 : 1 ;
1394 hDC
= GetWindowDC( hWnd
) ;
1401 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1404 GetMinButtonRect( hWnd
, &rcButton
) ;
1406 GetMaxButtonRect( hWnd
, &rcButton
) ;
1408 GetWindowRect( hWnd
, &rc
) ;
1409 OffsetRect( &rcButton
, -rc
.left
, -rc
.top
) ;
1412 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1414 rc
= rcButton
; //separator line
1415 rc
.bottom
= --rc
.top
+ 1 ;
1420 rc
= rcButton
; //separator line
1421 rc
.right
= --rc
.left
+ 1 ;
1425 //Draw separator line
1426 SetBkColor( hDC
, rgbWindowFrame
) ;
1427 DRAWFASTRECT( hDC
, &rc
) ;
1430 SetBkColor( hDC
, RGBLTGRAY
) ;
1431 DRAWFASTRECT( hDC
, &rcButton
) ;
1435 //The normal min/max buttons have one pixel on the top and left
1436 //sides for the highlight, and two pixels on the bottom and
1437 //right side for the shadow.
1439 //When our caption is 'small' we only use one pixel on all
1442 SetBkColor( hDC
, RGBWHITE
) ;
1445 rc
.right
= rc
.left
+ 1 ;
1446 DRAWFASTRECT( hDC
, &rc
) ;
1450 rc
.bottom
= rc
.top
+ 1 ;
1451 DRAWFASTRECT( hDC
, &rc
) ;
1453 SetBkColor( hDC
, RGBGRAY
) ;
1456 rc
.left
= rc
.right
- 1 ;
1457 DRAWFASTRECT( hDC
, &rc
) ;
1458 if (nCapSize
> THRESHOLD
)
1462 DRAWFASTRECT( hDC
, &rc
) ;
1467 rc
.top
= rc
.bottom
- 1 ;
1468 DRAWFASTRECT( hDC
, &rc
) ;
1469 if (nCapSize
> THRESHOLD
)
1473 DRAWFASTRECT( hDC
, &rc
) ;
1478 rcButton
.right
-= nOffset
;
1479 rcButton
.bottom
-= nOffset
;
1483 //Draw depressed state
1485 SetBkColor( hDC
, RGBGRAY
) ;
1488 rc
.right
= rc
.left
+ nOffset
;
1489 DRAWFASTRECT( hDC
, &rc
) ;
1493 rc
.bottom
= rc
.top
+ nOffset
;
1494 DRAWFASTRECT( hDC
, &rc
) ;
1496 rcButton
.left
+= 2 * nOffset
;
1497 rcButton
.top
+= 2 * nOffset
;
1500 // Now draw the arrows. We do not want the
1501 // arrows to grow too large when we have a bigger than
1502 // normal caption, so we restrict their size.
1504 // rcButton now represents where we can place our
1507 // The maximum size of our arrows (i.e. the width of rcButton)
1508 // has been empirically determined to be SM_CYCAPTION / 2
1510 n
= ((GetSystemMetrics( SM_CYCAPTION
)) / 2) -
1511 (rcButton
.right
- rcButton
.left
) ;
1513 InflateRect( &rcButton
, n
/2-1, n
/2-1 ) ;
1516 DrawArrow( hDC
, &rcButton
, ARROW_DOWN
) ;
1518 if (IsZoomed( hWnd
))
1520 DrawArrow( hDC
, &rcButton
, ARROW_RESTORE
) ;
1523 DrawArrow( hDC
, &rcButton
, ARROW_UP
) ;
1526 ReleaseDC( hWnd
, hDC
) ;
1534 // Draws either a up or down arrow. The arrow is bound by the rectangle
1536 void PASCAL
DrawArrow( HDC hdc
, LPRECT lprc
, UINT uiStyle
)
1542 int nMax
= (lprc
->bottom
- lprc
->top
) >> 1 ;
1544 SetBkColor( hdc
, RGBBLACK
) ;
1546 // We draw the arrow by drawing a series of horizontal lines
1548 xTip
= lprc
->left
+ ((lprc
->right
- lprc
->left
+1) >> 1) ;
1552 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1553 for (row
= 1 ; row
<= nMax
; row
++ )
1555 rc
.left
= xTip
- row
;
1556 rc
.right
= xTip
+ row
- 1 ;
1557 rc
.top
= yTip
+ row
;
1558 rc
.bottom
= rc
.top
+ 1 ;
1559 DRAWFASTRECT( hdc
, &rc
) ;
1564 yTip
= lprc
->bottom
- ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1565 for ( row
= nMax
; row
> 0 ; row
-- )
1567 rc
.left
= xTip
- row
;
1568 rc
.right
= xTip
+ row
- 1 ;
1569 rc
.top
= yTip
- row
;
1570 rc
.bottom
= rc
.top
+ 1 ;
1571 DRAWFASTRECT( hdc
, &rc
) ;
1577 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 3) - 2;
1578 for (row
= 1 ; row
<= nMax
; row
++ )
1580 rc
.left
= xTip
- row
;
1581 rc
.right
= xTip
+ row
- 1 ;
1582 rc
.top
= yTip
+ row
;
1583 rc
.bottom
= rc
.top
+ 1 ;
1584 DRAWFASTRECT( hdc
, &rc
) ;
1587 yTip
+= (nMax
+1) * 2 ;
1588 for ( row
= nMax
; row
> 0 ; row
-- )
1590 rc
.left
= xTip
- row
;
1591 rc
.right
= xTip
+ row
- 1 ;
1592 rc
.top
= yTip
- row
;
1593 rc
.bottom
= rc
.top
+ 1 ;
1594 DRAWFASTRECT( hdc
, &rc
) ;
1601 #endif // wxUSE_ITSY_BITSY