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"
23 #include "wx/window.h"
24 #include "wx/msw/private.h"
35 #include "wx/minifram.h"
39 #include "wx/msw/gnuwin32/extra.h"
43 #if !USE_SHARED_LIBRARY
44 IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame
, wxFrame
)
47 long wxMiniFrame::MSWDefWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
49 if ((GetWindowStyleFlag() & wxTINY_CAPTION_HORIZ
) ||
50 (GetWindowStyleFlag() & wxTINY_CAPTION_VERT
))
51 return ::ibDefWindowProc((HWND
) GetHWND(), nMsg
, wParam
, lParam
);
52 else if ( m_oldWndProc
)
53 return ::CallWindowProc(CASTWNDPROC m_oldWndProc
, (HWND
) GetHWND(), (UINT
) nMsg
, (WPARAM
) wParam
, (LPARAM
) lParam
);
55 return ::DefWindowProc((HWND
) GetHWND(), nMsg
, wParam
, lParam
);
58 wxMiniFrame::~wxMiniFrame(void)
62 /////////////////////////////////////////////////////////////////////////
64 // Project: ItsyBitsy window support module
68 // ItsyBitsy is a support module that allows you to create windows
69 // that look and act very much like a popup window witha system
70 // menu and caption bar, except everything is scaled to about 2/3
73 // For documentation on how to use ItsyBits, read the document
77 // 9/27/91 Charlie Kindel (cek/ckindel)
78 // Wrote and documented it.
81 // 2/23/93 cek Added minimize/maximize buttons.
82 // 3/18/93 cek Fixed system menu bug where system menu
83 // popped back up if you clicked on the
84 // icon again while it was up.
85 // 3/24/93 cek More comments. Fixed DS_MODALDIALOG style
86 // problem. Use auto precompiled headers
89 //////////////////////////////////////////////////////////////////////////
91 #include "wx/window.h"
92 #include "wx/msw/private.h"
96 #if !defined( __WATCOMC__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__)
105 // Some mildly useful macros for the standard 16 colors
106 #define RGBBLACK RGB(0,0,0)
107 #define RGBRED RGB(128,0,0)
108 #define RGBGREEN RGB(0,128,0)
109 #define RGBBLUE RGB(0,0,128)
111 #define RGBBROWN RGB(128,128,0)
112 #define RGBMAGENTA RGB(128,0,128)
113 #define RGBCYAN RGB(0,128,128)
114 #define RGBLTGRAY RGB(192,192,192)
116 #define RGBGRAY RGB(128,128,128)
117 #define RGBLTRED RGB(255,0,0)
118 #define RGBLTGREEN RGB(0,255,0)
119 #define RGBLTBLUE RGB(0,0,255)
121 #define RGBYELLOW RGB(255,255,0)
122 #define RGBLTMAGENTA RGB(255,0,255)
123 #define RGBLTCYAN RGB(0,255,255)
124 #define RGBWHITE RGB(255,255,255)
127 #ifndef GlobalAllocPtr
128 #define GlobalPtrHandle(lp) \
129 ((HGLOBAL)GlobalHandle(lp))
131 #define GlobalLockPtr(lp) \
132 ((BOOL)GlobalLock(GlobalPtrHandle(lp)))
133 #define GlobalUnlockPtr(lp) \
134 GlobalUnlock(GlobalPtrHandle(lp))
136 #define GlobalAllocPtr(flags, cb) \
137 (GlobalLock(GlobalAlloc((flags), (cb))))
138 #define GlobalReAllocPtr(lp, cbNew, flags) \
139 (GlobalUnlockPtr(lp), GlobalLock(GlobalReAlloc(GlobalPtrHandle(lp) , (cbNew), (flags))))
140 #define GlobalFreePtr(lp) \
141 (GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp)))
144 #if defined(__BORLANDC__) || defined(__WATCOMC__)
145 #define max(a,b) (((a) > (b)) ? (a) : (b))
146 #define min(a,b) (((a) < (b)) ? (a) : (b))
149 // CAPTIONXY is the default size of the system menu icon. This
150 // determines the height/width of the caption.
152 // The value that results from the following formula works out
153 // nicely for the veritcal caption on VGA, 8514 (Large Fonts),
154 // 8514 (Small Fonts), XGA (Small Fonts), XGA (Large Fonts),
155 // and TIGA (Small Fonts). It may not be good on other displays.
157 // The problem is that TT fonts turn into bitmap fonts when they
158 // are sized below a certain threshold. The idea is to make the
159 // size of the caption just big enough to get the smallest TT
160 // (scalable) font to fit.
162 #define CAPTIONXY (GetSystemMetrics( SM_CYCAPTION ) / 2 + 1)
164 #define TestWinStyle( hWnd, dwStyleBit ) \
165 (((DWORD)GetWindowLong( hWnd, GWL_STYLE ) & (DWORD)dwStyleBit) ? TRUE : FALSE )
166 #define HASCAPTION( hwnd ) (TestWinStyle( hwnd, IBS_VERTCAPTION ) ||\
167 TestWinStyle( hwnd, IBS_HORZCAPTION ))
169 #define SETCAPTIONSIZE(h,i) (UINT)SetProp(h,"ibSize",(HANDLE)i)
170 #define GETCAPTIONSIZE(h) (UINT)GetProp(h,"ibSize")
171 #define FREECAPTIONSIZE(h) RemoveProp(h,"ibSize")
173 #define SETMENUWASUPFLAG(h,i) (UINT)SetProp(h,"ibFlag",(HANDLE)i)
174 #define GETMENUWASUPFLAG(h) (UINT)GetProp(h,"ibFlag")
175 #define FREEMENUWASUPFLAG(h) RemoveProp(h,"ibFlag")
177 /////////////////////////////////////////////////////////////////////
178 // Little known fact:
179 // ExtTextOut() is the fastest way to draw a filled rectangle
180 // in Windows (if you don't want dithered colors or borders).
182 // Unfortunately there is a bug in the Windows 3.0 8514 driver
183 // in using ExtTextOut() to a memory DC. If you are drawing
184 // to an off screen bitmap, then blitting that bitmap to the
185 // display, do not #define wxUSE_EXTTEXTOUT below.
187 // The following macro (DRAWFASTRECT) draws a filled rectangle
188 // with no border and a solid color. It uses the current back-
189 // ground color as the fill color.
190 //////////////////////////////////////////////////////////////////////
191 #define wxUSE_EXTTEXTOUT
192 #ifdef wxUSE_EXTTEXTOUT
193 #define DRAWFASTRECT(hdc,lprc) ExtTextOut(hdc,0,0,ETO_OPAQUE,lprc,NULL,0,NULL)
195 #define DRAWFASTRECT(hdc,lprc) {\
196 HBRUSH hbr = CreateSolidBrush( GetBkColor( hdc ) ) ;\
197 hbr = SelectObject(hdc, hbr) ;\
198 PatBlt(hdc,(lprc)->left,(lprc)->top,(lprc)->right-(lprc)->left,(lprc)->bottom-(lprc)->top,PATCOPY) ;\
199 hbr = SelectObject(hdc, hbr) ;\
200 DeleteObject( hbr ) ;\
204 // The DrawArrow function takes the following to indicate what
205 // kind of arrow to draw.
209 #define ARROW_RESTORE 2
211 BOOL PASCAL
DepressMinMaxButton( HWND hWnd
, UINT uiHT
, LPRECT
) ;
212 BOOL PASCAL
DoMenu( HWND hWnd
) ;
213 void PASCAL
SetupSystemMenu( HWND hWnd
, HMENU hMenu
) ;
214 BOOL PASCAL
GetCaptionRect( HWND hWnd
, LPRECT lprc
) ;
215 BOOL PASCAL
GetIconRect( HWND hWnd
, LPRECT lprc
) ;
216 BOOL PASCAL
GetButtonRect( HWND hWnd
, UINT nPos
, LPRECT lprc
) ;
217 BOOL PASCAL
GetMinButtonRect( HWND hWnd
, LPRECT lprc
) ;
218 BOOL PASCAL
GetMaxButtonRect( HWND hWnd
, LPRECT lprc
) ;
219 BOOL PASCAL
DrawCaption( HDC hDC
, HWND hWnd
, LPRECT lprc
,
220 BOOL fVert
, BOOL fSysMenu
,
221 BOOL fMin
, BOOL fMax
, BOOL fActive
) ;
222 void PASCAL
DrawSysMenu( HDC hDC
, HWND hWnd
, BOOL fInvert
) ;
223 void PASCAL
DrawButton( HDC hDC
, HWND hWnd
, BOOL fMin
, BOOL fDepressed
) ;
224 void PASCAL
DrawArrow( HDC hdc
, LPRECT lprc
, UINT uiStyle
) ;
230 ///////////////////////////////////////////////////////////////////////
231 // External/Public functions
232 ///////////////////////////////////////////////////////////////////////
234 /////////////////////////////////////////////////////////////////
235 // UINT WINAPI ibGetCaptionSize( HWND hWnd )
239 // Gets the size of the caption (height if horz, width if
244 ///////////////////////////////////////////////////////////////
245 UINT WINAPI
ibGetCaptionSize( HWND hWnd
)
247 return GETCAPTIONSIZE( hWnd
) + 1 ;
248 } // ibSetCaptionSize()
250 /////////////////////////////////////////////////////////////////
251 // UINT WINAPI ibSetCaptionSize( HWND hWnd, UINT nSize )
255 // Changes the size of the caption (height if horz, width if
260 //////////////////////////////////////////////////////////////////
261 UINT WINAPI
ibSetCaptionSize( HWND hWnd
, UINT nSize
)
269 ui
= SETCAPTIONSIZE( hWnd
, nSize
) ;
271 // Once we change the window style, we need a WM_NCCALCRECT
274 // SWP_FRAMECHANGED is not documented in the 3.1 SDK docs,
275 // but *is* in WINDOWS.H.
277 SetWindowPos( hWnd
, NULL
, 0, 0, 0, 0, SWP_FRAMECHANGED
|
278 SWP_NOSIZE
| SWP_NOMOVE
|
279 SWP_NOACTIVATE
| SWP_NOZORDER
) ;
283 } // ibSetCaptionSize()
285 /////////////////////////////////////////////////////////////////
286 // LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam )
290 // This function should be called instead of DefWindowProc() for
291 // windows that want to have itsybitsy captions.
295 //////////////////////////////////////////////////////////////////
296 LRESULT WINAPI
ibDefWindowProc( HWND hWnd
, UINT uiMsg
, WPARAM wParam
, LPARAM lParam
)
305 // was hit then pop up the menu
307 if (HASCAPTION( hWnd
) && (wParam
== VK_SPACE
))
321 DWORD dw
= GetWindowLong( hWnd
, GWL_STYLE
) ;
323 // Fool DefWindowProc into thinking we do not have
324 // a system menu. Otherwise it will try to
327 SetWindowLong( hWnd
, GWL_STYLE
, dw
&~WS_SYSMENU
) ;
328 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
329 SetWindowLong( hWnd
, GWL_STYLE
, dw
) ;
335 // The menu that is poped up for the system menu with
336 // TrackPopupMenu() sends it's notifications as WM_COMMAND
337 // messages. We need to translate these into
338 // WM_SYSCOMMAND messages. All standard WM_SYSCOMMAND
339 // ids are greater than 0xF000.
341 // This could be a possible cause of confusion if the
342 // itsybitsy window had children that used SC_MOVE or SC_CLOSE
343 // as their IDs. Take note and be careful.
345 // Also, because ibDefWindowProc looks at WM_COMMAND messages,
346 // you will need to be careful to call ibDefWindowProc() for
347 // any wm_command messages that you would normally ignore.
348 // Otherwise the system menu won't work.
350 if (wParam
>= 0xF000)
351 // Call PostMessage() here instead of SendMessage!
353 // Our menu was created by TrackPopupMenu(). TPM() does
354 // not return until after the menu has been destroyed
355 // (and thus the command associated with the menu selection
356 // sent). Therefore when we get here, we are still
357 // *inside* TPM(). If we Send WM_SYSCOMMAND, SC_CLOSE
358 // to the window, the window will be destroyed before
359 // TPM() returns to our code within DoMenu() below. Wel...
360 // We do stuff with the window handle after DoMenu()
361 // returns (namely GetProp()). Since the window has
362 // been destroyed,this is bad.
363 PostMessage( hWnd
, WM_SYSCOMMAND
, wParam
, lParam
) ;
365 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
367 case WM_GETMINMAXINFO
:
369 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
370 if (HASCAPTION( hWnd
) && TestWinStyle( hWnd
, WS_THICKFRAME
))
372 LPPOINT lppt
= (LPPOINT
)lParam
;
377 int cx
, cy
; // window frame/border width
379 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
381 cx
= GetSystemMetrics( SM_CXFRAME
) ;
382 cy
= GetSystemMetrics( SM_CYFRAME
) ;
384 else if (TestWinStyle(hWnd
, WS_BORDER
))
386 cx
= GetSystemMetrics( SM_CXBORDER
) ;
387 cy
= GetSystemMetrics( SM_CYBORDER
) ;
391 // VZ: I don't know what should be here, but the vars must
393 wxFAIL_MSG("don't know how to initialize cx, cy");
398 GetIconRect( hWnd
, &rcMenu
) ;
399 GetMinButtonRect( hWnd
, &rcMin
) ;
400 GetMaxButtonRect( hWnd
, &rcMax
) ;
401 nX
= (rcMenu
.right
-rcMenu
.left
) +
402 (rcMin
.right
-rcMin
.left
) +
403 (rcMin
.right
-rcMin
.left
) ;
406 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
) )
408 lppt
[3].x
= nCapSize
+ cx
* 2 - 1 ;
409 lppt
[3].y
= nX
+ (2* nCapSize
) ;
413 lppt
[3].x
= nX
+ (2* nCapSize
) ;
414 lppt
[3].y
= nCapSize
+ cy
* 2 - 1 ;
417 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
421 /////////////////////////////////////////////////////////////////////
422 // Non-client area messages. These are used to allow the
423 // minature caption bar to be handled correctly.
429 // We have two things that we need to store somewhere:
430 // 1) The caption height (width).
431 // and 2) A flag indicating whether the sysmenu was
434 // CAPTIONXY is a macro that calls GetSystemMetrics.
436 SETCAPTIONSIZE( hWnd
, CAPTIONXY
) ;
438 // Set our flag that tells us whether the system menu was
441 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
443 // Are we in 3.1? If so we have some neat features
444 // we can use like rotated TrueType fonts.
446 fWin31
= (BOOL
)(LOWORD( GetVersion() ) >= 0x030A) ;
448 // If IBS_????CAPTION was specified and the WS_DLGFRAME (or
449 // WS_DLGFRAME 'cause it == WS_CAPTION | WS_BORDER)
450 // was specified the creator made a mistake. Things get really
451 // ugly if DefWindowProc sees WS_DLGFRAME, so we strip
452 // the WS_DLGFRAME part off!
454 dwStyle
= GetWindowLong( hWnd
, GWL_STYLE
) ;
455 if ((dwStyle
& IBS_VERTCAPTION
|| dwStyle
& IBS_HORZCAPTION
) &&
456 dwStyle
& WS_DLGFRAME
)
458 dwStyle
&= (DWORD
)~WS_DLGFRAME
;
459 SetWindowLong( hWnd
, GWL_STYLE
, dwStyle
) ;
462 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
465 // We store the caption size in a window prop. so we
466 // must remove props.
468 FREECAPTIONSIZE( hWnd
) ;
469 FREEMENUWASUPFLAG( hWnd
) ;
470 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
473 // This is sent when the window manager wants to find out
474 // how big our client area is to be. If we have a mini-caption
475 // then we trap this message and calculate the cleint area rect,
476 // which is the client area rect calculated by DefWindowProc()
477 // minus the width/height of the mini-caption bar
479 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
480 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
))
482 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
484 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
) )
485 ((LPRECT
)lParam
)->left
+= nCapSize
;
487 ((LPRECT
)lParam
)->top
+= nCapSize
;
492 // This message is sent whenever the mouse moves over us.
493 // We will depend on DefWindowProc for everything unless
494 // there is a mini-caption, in which case we will
495 // return HTCAPTION or HTSYSMENU. When the user clicks
496 // or double clicks, NC_LBUTTON/ message are sent with
497 // wParam equal to what we return here.
498 // This means that this is an ideal place to figure out
501 // let defwindowproc handle the standard borders etc...
503 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
504 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
) && lRet
== HTNOWHERE
)
512 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
514 // if DefWindowProc returned HTCAPTION then we have to
515 // refine the area and return HTSYSMENU if appropriate
517 pt
.x
= LOWORD( lParam
) ;
518 pt
.y
= HIWORD( lParam
) ;
520 GetCaptionRect( hWnd
, &rc
) ; // window coords
521 if (PtInRect( &rc
, pt
))
525 // rely on the fact that Get???Rect() return an invalid
526 // (empty) rectangle if the menu/buttons don't exist
528 GetIconRect( hWnd
, &rcMenu
) ;
529 GetMinButtonRect( hWnd
, &rcMinButton
) ;
530 GetMaxButtonRect( hWnd
, &rcMaxButton
) ;
532 if (PtInRect( &rcMenu
, pt
))
535 if (PtInRect( &rcMinButton
, pt
))
538 if (PtInRect( &rcMaxButton
, pt
))
542 if (lRet
!= HTSYSMENU
)
543 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
546 case WM_NCLBUTTONDBLCLK
:
547 // Windows recieve WM_NC?BUTTONDBLCLK messages whether they
548 // have CS_DBLCLKS or not. We watch for one of these
549 // to see if the user double clicked on the system menu (to
550 // close the window) or on the caption (to maximize the window).
552 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
) && wParam
== HTSYSMENU
)
554 SendMessage( hWnd
, WM_CLOSE
, 0, 0L ) ;
557 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
559 case WM_NCLBUTTONDOWN
:
563 // If we're iconic or we don't have a caption then
564 // DefWindowProc will do the job just fine.
566 if (IsIconic( hWnd
) || !HASCAPTION( hWnd
))
567 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
569 // Here's were we handle the system menu, the min and max buttons.
570 // If you wanted to change the behavior of the min/max buttons
571 // do something like swap tool palettes or something, you
572 // would change the SendMessage() calls below.
577 if (GETMENUWASUPFLAG( hWnd
) == FALSE
&& DoMenu( hWnd
))
578 SETMENUWASUPFLAG( hWnd
, TRUE
) ;
580 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
584 GetMinButtonRect( hWnd
, &rc
) ;
585 // Note that DepressMinMaxButton() goes into
586 // a PeekMessage() loop waiting for the mouse
589 if (DepressMinMaxButton( hWnd
, wParam
, &rc
))
590 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_MINIMIZE
, lParam
) ;
594 GetMaxButtonRect( hWnd
, &rc
) ;
595 // Note that DepressMinMaxButton() goes into
596 // a PeekMessage() loop waiting for the mouse
599 if (DepressMinMaxButton( hWnd
, wParam
, &rc
))
602 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_RESTORE
, lParam
) ;
604 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_MAXIMIZE
, lParam
) ;
609 // Well, it appears as though the user clicked somewhere other
610 // than the buttons. We let DefWindowProc do it's magic.
611 // This is where things like dragging and sizing the
614 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
621 if (IsIconic( hWnd
))
622 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
624 // Paint the non-client area here. We will call DefWindowProc
625 // after we are done so it can paint the borders and so
628 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
629 if (HASCAPTION( hWnd
))
633 HDC hDC
= GetWindowDC( hWnd
) ;
636 GetCaptionRect( hWnd
, &rcCap
) ; // Convert to window coords
637 GetWindowRect( hWnd
, &rc
) ;
638 OffsetRect( &rcCap
, -rc
.left
, -rc
.top
) ;
640 if (uiMsg
== WM_NCPAINT
)
641 fActive
= (hWnd
== GetActiveWindow()) ;
645 DrawCaption( hDC
, hWnd
, &rcCap
,
646 TestWinStyle(hWnd
, IBS_VERTCAPTION
),
647 TestWinStyle(hWnd
, WS_SYSMENU
),
648 TestWinStyle(hWnd
, WS_MINIMIZEBOX
),
649 TestWinStyle(hWnd
, WS_MAXIMIZEBOX
),
652 ReleaseDC( hWnd
, hDC
) ;
658 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
663 } // ibDefWindowProc()
665 // ibAdjustWindowRect( HWND hWnd, LPRECT lprc )
667 // Does the same thing as the USER function AdjustWindowRect(),
668 // but knows about itsybitsy windows. AdjustWindowRect() is
669 // bogus for stuff like this.
671 void WINAPI
ibAdjustWindowRect( HWND hWnd
, LPRECT lprc
)
673 short cx
= 0, cy
= 0 ;
676 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
678 // First check Windows's styles, then our own.
680 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
682 cx
= GetSystemMetrics( SM_CXFRAME
) ;
683 cy
= GetSystemMetrics( SM_CYFRAME
) ;
686 if (TestWinStyle(hWnd
, DS_MODALFRAME
))
688 cx
= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
689 cy
= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
692 if (TestWinStyle(hWnd
, WS_BORDER
))
694 cx
= GetSystemMetrics( SM_CXBORDER
) ;
695 cy
= GetSystemMetrics( SM_CYBORDER
) ;
698 InflateRect( lprc
, cx
, cy
) ;
700 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
701 lprc
->left
-= nCapSize
;
703 if (TestWinStyle( hWnd
, IBS_HORZCAPTION
))
704 lprc
->top
-= nCapSize
;
706 } // ibAdjustWindowRect()
709 ///////////////////////////////////////////////////////////////////////
710 // Internal functions
711 ///////////////////////////////////////////////////////////////////////
713 // DepressMinMaxButton()
715 // This function is called when the user has pressed either the min or
716 // max button (i.e. WM_NCLBUTTONDOWN). We go into a Peekmessage() loop,
717 // waiting for the mouse to come back up. This allows us to make the
718 // button change up/down state like a real button does.
720 // lprc points to the rectangle that describes the button the
721 // user has clicked on.
723 BOOL PASCAL
DepressMinMaxButton( HWND hWnd
, UINT uiHT
, LPRECT lprc
)
725 BOOL fDepressed
= TRUE
;
728 // Draw button in down state
729 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
) ;
734 if (PeekMessage((LPMSG
)&msg
, NULL
, WM_MOUSEFIRST
, WM_MOUSELAST
, PM_REMOVE
))
740 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, !fDepressed
) ;
742 return PtInRect( lprc
, msg
.pt
) ;
745 if (PtInRect( lprc
, msg
.pt
))
748 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
= TRUE
) ;
753 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
= FALSE
) ;
760 } // DepressMinMaxButton()
762 // DrawCaption( HDC hDC, HWND hWnd, LPRECT lprc,
763 // BOOL fVert, BOOL fSysMenu, BOOL fActive )
765 // This function draws an itsy bitsy caption bar with or
766 // without system menu to the dc specified by hDC. The
767 // caption is drawn to fit within the lprc RECT and is
768 // drawn//withOut/ borders.
770 BOOL PASCAL
DrawCaption( HDC hDC
, HWND hWnd
, LPRECT lprc
,
771 BOOL fVert
, BOOL fSysMenu
, BOOL fMin
,
772 BOOL fMax
, BOOL fActive
)
776 COLORREF rgbCaptionBG
;
778 COLORREF rgbWindowFrame
;
783 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
787 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
789 // if we have focus use the active caption color
790 // otherwise use the inactive caption color
794 rgbText
= GetSysColor( COLOR_CAPTIONTEXT
) ;
795 rgbCaptionBG
= GetSysColor( COLOR_ACTIVECAPTION
) ;
800 rgbText
= GetSysColor( COLOR_INACTIVECAPTIONTEXT
) ;
802 rgbText
= GetSysColor( COLOR_CAPTIONTEXT
) ;
804 rgbCaptionBG
= GetSysColor( COLOR_INACTIVECAPTION
) ;
807 SetBkMode( hDC
, TRANSPARENT
) ;
808 SelectObject( hDC
, GetStockObject( NULL_BRUSH
) ) ;
809 SelectObject( hDC
, GetStockObject( NULL_PEN
) ) ;
816 rcCap
.top
+= nCapSize
;
818 rcCap
.left
+= nCapSize
;
824 rcCap
.bottom
-= nCapSize
;
826 rcCap
.right
-= nCapSize
;
832 rcCap
.bottom
-= nCapSize
;
834 rcCap
.right
-= nCapSize
;
839 rc
.left
= lprc
->right
- 1 ;
840 rc
.right
= lprc
->right
;
842 rc
.bottom
= lprc
->bottom
;
846 rc
.left
= lprc
->left
;
847 rc
.right
= lprc
->right
;
848 rc
.bottom
= lprc
->bottom
;
849 rc
.top
= rc
.bottom
- 1 ;
852 SetBkColor( hDC
, rgbWindowFrame
) ;
853 DRAWFASTRECT( hDC
, &rc
) ;
855 hbrCaption
= CreateSolidBrush( rgbCaptionBG
) ;
856 hbrCaption
= (HBRUSH
) SelectObject( hDC
, hbrCaption
) ;
857 SelectObject( hDC
, (HPEN
) GetStockObject( NULL_PEN
) ) ;
859 Rectangle( hDC
, rcCap
.left
, rcCap
.top
, rcCap
.right
, rcCap
.bottom
+ 1 ) ;
861 Rectangle( hDC
, rcCap
.left
, rcCap
.top
, rcCap
.right
+1, rcCap
.bottom
) ;
862 hbrCaption
= (HBRUSH
) SelectObject( hDC
, hbrCaption
) ;
863 DeleteObject( hbrCaption
) ;
866 // Draw caption text here. Only do it in 3.1 'cause 3.1 gives
869 ui
= GetWindowTextLength( hWnd
) ;
880 lpsz
= (char*)GlobalAllocPtr( GHND
, ui
+ 2 );
885 GetWindowText( hWnd
, lpsz
, ui
+ 1 ) ;
886 nBkMode
= SetBkMode( hDC
, TRANSPARENT
) ;
887 rgbText
= SetTextColor( hDC
, rgbText
) ;
889 memset( &lf
, '\0', sizeof(LOGFONT
) ) ;
891 lf
.lfHeight
= -(int)(nCapSize
- 3) ;
892 lf
.lfCharSet
= ANSI_CHARSET
;
893 lf
.lfQuality
= DEFAULT_QUALITY
;
894 lf
.lfClipPrecision
= CLIP_LH_ANGLES
| CLIP_STROKE_PRECIS
;
897 lf
.lfWeight
= FW_BOLD
;
902 // Can only rotate true type fonts (well, ok, we could
903 // try and use "modern").
904 strcpy( lf
.lfFaceName
, "Arial" ) ;
905 lf
.lfPitchAndFamily
= FF_SWISS
| 0x04;
906 lf
.lfEscapement
= 900 ;
908 // Note: The Win 3.1 documentation for CreateFont() say's
909 // that the lfOrientation member is ignored. It appears,
910 // that on Windows 16 3.1 this is true, but when running
911 // as a 16 bit WinApp on WindowsNT 3.1 the lfOrientation
912 // must be set or the text does not rotate!
914 lf
.lfOrientation
= 900 ;
916 hFont
= CreateFontIndirect( &lf
) ;
917 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
919 GetTextExtentPoint( hDC
, lpsz
, ui
, &Size
) ;
920 cx
= rcCap
.bottom
- ((rcCap
.bottom
- rcCap
.top
- Size
.cx
) / 2) ;
921 cy
= rcCap
.left
- 1 + ((rcCap
.right
- rcCap
.left
- Size
.cy
) / 2) ;
923 // Make sure we got a rotatable font back.
925 GetTextMetrics( hDC
, &tm
) ;
926 if (tm
.tmPitchAndFamily
& TMPF_VECTOR
||
927 tm
.tmPitchAndFamily
& TMPF_TRUETYPE
)
931 min( (long)cx
, rcCap
.bottom
),
936 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
937 DeleteObject( hFont
) ;
941 // Use small fonts always for the horizontal. Cause it looks
942 // more like "System" than Arial.
944 lf
.lfPitchAndFamily
= FF_SWISS
;
946 hFont
= CreateFontIndirect( &lf
) ;
947 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
949 GetTextExtentPoint( hDC
, lpsz
, ui
, &Size
) ;
950 cx
= rcCap
.left
+ ((rcCap
.right
- rcCap
.left
- Size
.cx
) / 2) ;
951 cy
= rcCap
.top
+ ((rcCap
.bottom
- rcCap
.top
- Size
.cy
) / 2) ;
953 // Figger out how big the string is
956 max( (long)cx
, rcCap
.left
),
961 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
962 DeleteObject( hFont
) ;
967 rgbText
= SetTextColor( hDC
, rgbText
) ;
968 SetBkMode( hDC
, nBkMode
) ;
970 GlobalFreePtr( lpsz
) ;
975 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
978 DrawButton( hDC
, hWnd
, TRUE
, FALSE
) ;
981 DrawButton( hDC
, hWnd
, FALSE
, FALSE
) ;
988 // DrawSysMenu( HDC hDC, hWnd, BOOL fInvert )
990 // Draws the little system menu icon.
992 void PASCAL
DrawSysMenu( HDC hDC
, HWND hWnd
, BOOL fInvert
)
997 COLORREF rgbIconFace
;
998 COLORREF rgbWindowFrame
;
1002 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1007 hDC
= GetWindowDC( hWnd
) ;
1014 rgbIconFace
= GetNearestColor( hDC
, RGBLTGRAY
) ;
1015 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1017 GetIconRect( hWnd
, &rcIcon
) ;
1018 GetWindowRect( hWnd
, &rc
) ;
1020 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1024 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1026 rc
= rcIcon
; // separator line
1027 rc
.top
= ++rc
.bottom
- 1 ;
1031 rc
= rcIcon
; // separator line
1032 rc
.left
= ++rc
.right
- 1 ;
1036 SetBkColor( hDC
, rgbIconFace
) ;
1037 DRAWFASTRECT( hDC
, &rcTemp
) ;
1039 // Draw separator line
1040 SetBkColor( hDC
, rgbWindowFrame
) ;
1041 DRAWFASTRECT( hDC
, &rc
) ;
1045 // Draw the little horizontal doo-hickey
1047 rcTemp
.top
= rcIcon
.top
+ ((nCapSize
-1) / 2) ;
1048 rcTemp
.bottom
= rcTemp
.top
+ 3 ;
1049 rcTemp
.left
= rcTemp
.left
+ 3 ;
1050 rcTemp
.right
= rcTemp
.right
- 1 ;
1052 SetBkColor( hDC
, RGBGRAY
) ;
1053 DRAWFASTRECT( hDC
, &rcTemp
) ;
1056 OffsetRect( &rc
, -1, -1 ) ;
1057 SetBkColor( hDC
, RGBBLACK
) ;
1058 DRAWFASTRECT( hDC
, &rc
) ;
1060 InflateRect( &rc
, -1, -1 ) ;
1061 SetBkColor( hDC
, RGBWHITE
) ;
1062 DRAWFASTRECT( hDC
, &rc
) ;
1066 InvertRect( hDC
, &rcIcon
) ;
1069 ReleaseDC( hWnd
, hDC
) ;
1074 // DoMenu( HWND hWnd )
1076 // Pops up the system menu.
1078 BOOL PASCAL
DoMenu( HWND hWnd
)
1087 if (!TestWinStyle(hWnd
, WS_SYSMENU
))
1090 hDC
= GetWindowDC( hWnd
);
1095 DrawSysMenu( hDC
, hWnd
, TRUE
) ;
1099 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1110 GetIconRect( hWnd
, &rcIcon
) ;
1111 GetWindowRect( hWnd
, &rc
) ;
1112 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1114 ClientToScreen( hWnd
, &pt
) ;
1115 ClientToScreen( hWnd
, (LPPOINT
)&rc
.right
) ;
1117 dw
= GetWindowLong( hWnd
, GWL_STYLE
) ;
1118 SetWindowLong( hWnd
, GWL_STYLE
, dw
| WS_SYSMENU
) ;
1120 hMenu
= GetSystemMenu( hWnd
, FALSE
) ;
1121 SetupSystemMenu( hWnd
, hMenu
) ;
1123 SetWindowLong( hWnd
, GWL_STYLE
, dw
) ;
1125 TrackPopupMenu( hMenu
, 0, //TPM_LEFTALIGN,
1132 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
1133 ReleaseDC( hWnd
, hDC
) ;
1139 // SetupSystemMenu( HWND hWnd, HMENU hMenu )
1141 // Enables/Disables the appropriate menu items on the
1142 // menu passed for the window passed.
1144 void PASCAL
SetupSystemMenu( HWND hWnd
, HMENU hMenu
)
1152 // Assume all should be grayed.
1154 wSize
= wMove
= wMinBox
= wMaxBox
= wRestore
= MF_GRAYED
;
1156 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
) || IsIconic( hWnd
))
1157 wMaxBox
= MF_ENABLED
;
1159 if (TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1160 wMinBox
= MF_ENABLED
;
1162 if (IsZoomed( hWnd
))
1163 wRestore
= MF_ENABLED
;
1165 if (TestWinStyle( hWnd
, WS_THICKFRAME
) &&
1166 !(IsIconic( hWnd
) || IsZoomed( hWnd
)))
1167 wSize
= MF_ENABLED
;
1169 if (!IsZoomed( hWnd
) &&
1170 !IsIconic( hWnd
) &&
1171 TestWinStyle( hWnd
, WS_CAPTION
) )
1172 wMove
= MF_ENABLED
;
1174 EnableMenuItem( hMenu
, SC_MOVE
, wMove
) ;
1175 EnableMenuItem( hMenu
, SC_SIZE
, wSize
) ;
1176 EnableMenuItem( hMenu
, SC_MINIMIZE
, wMinBox
) ;
1177 EnableMenuItem( hMenu
, SC_MAXIMIZE
, wMaxBox
) ;
1178 EnableMenuItem( hMenu
, SC_RESTORE
, wRestore
) ;
1180 } // SetupSystemMenu()
1182 // GetCaptionRect( HWND hWnd, LPRECT lprc )
1184 // calcluales the rectangle of the mini-caption in screen coords.
1186 BOOL PASCAL
GetCaptionRect( HWND hWnd
, LPRECT lprc
)
1190 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1192 if (!HASCAPTION( hWnd
))
1194 SetRectEmpty( lprc
) ;
1198 GetWindowRect( hWnd
, lprc
) ;
1200 // the window might have other non-client components like
1203 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
1205 lprc
->left
+= GetSystemMetrics( SM_CXFRAME
) ;
1206 lprc
->top
+= GetSystemMetrics( SM_CYFRAME
) ;
1207 lprc
->right
-= GetSystemMetrics( SM_CXFRAME
) ;
1208 lprc
->bottom
-= GetSystemMetrics( SM_CYFRAME
) ;
1211 if (TestWinStyle( hWnd
, DS_MODALFRAME
)) // if it's a dialog box
1213 lprc
->left
+= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1214 lprc
->top
+= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1215 lprc
->right
-= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1216 lprc
->bottom
-= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1219 if (TestWinStyle( hWnd
, WS_BORDER
))
1221 lprc
->left
+= GetSystemMetrics( SM_CXBORDER
) ;
1222 lprc
->top
+= GetSystemMetrics( SM_CYBORDER
) ;
1223 lprc
->right
-= GetSystemMetrics( SM_CXBORDER
) ;
1224 lprc
->bottom
-= GetSystemMetrics( SM_CYBORDER
) ;
1227 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1228 lprc
->right
= lprc
->left
+ nCapSize
;
1230 lprc
->bottom
= lprc
->top
+ nCapSize
;
1233 } // GetCaptionRect()
1235 // GetIconRect( HWND hWnd, LPRECT lprc )
1237 // Calculates the rect of the icon in screen coordinates.
1239 BOOL PASCAL
GetIconRect( HWND hWnd
, LPRECT lprc
)
1244 fMenu
= TestWinStyle( hWnd
, WS_SYSMENU
) ;
1245 fVert
= TestWinStyle( hWnd
, IBS_VERTCAPTION
) ;
1247 if (!GetCaptionRect( hWnd
, lprc
)) // window coords
1252 SetRectEmpty( lprc
) ;
1256 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1259 lprc
->bottom
= lprc
->top
+ nCapSize
;
1261 lprc
->right
= lprc
->left
+ nCapSize
;
1270 // GetMinButtonRect()
1272 // Calculates the rect of the minimize button in screen
1275 // For horizontal captions, we have the following situation ('Y' is minimize
1276 // and '^' is maximize or restore):
1278 // +---------------------------------+
1280 // +---------------------------------+
1281 // | |.......| <-- This is the width (nSize)
1283 // For vertical captions, we have the following:
1293 // |--| . <-- This is the height of the rectangle (nSize)
1297 // In order to figure out where the minimize button goes, we first need
1298 // to know if there is a maximize button. If so, use GetMaxButtonRect()
1301 BOOL PASCAL
GetMinButtonRect( HWND hWnd
, LPRECT lprc
)
1303 if (!TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1305 SetRectEmpty( lprc
) ;
1309 // The minimize button can be in either position 1 or 2. If there
1310 // is a maximize button, it's in position 2.
1312 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1313 return GetButtonRect( hWnd
, 2, lprc
) ;
1315 return GetButtonRect( hWnd
, 1, lprc
) ;
1318 // GetMaxButtonRect()
1320 // Calculates the rect of the maximize button in screen
1323 // The maximize button, if present, is always to the far right
1326 BOOL PASCAL
GetMaxButtonRect( HWND hWnd
, LPRECT lprc
)
1328 //The maximize button can only be in position 1.
1330 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1331 return GetButtonRect( hWnd
, 1, lprc
) ;
1334 SetRectEmpty( lprc
) ;
1339 // Get the rect where a button would go.
1341 // This function does not care if it's a min or max, just whether
1342 // it is the first from the right/bottom or second from the right/bottom
1345 BOOL PASCAL
GetButtonRect( HWND hWnd
, UINT nPos
, LPRECT lprc
)
1349 if (!GetCaptionRect( hWnd
, lprc
)) //window coords
1352 nSize
= GETCAPTIONSIZE( hWnd
) ;
1354 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1356 lprc
->bottom
-= nSize
* (nPos
-1) ;
1357 lprc
->top
= lprc
->bottom
- nSize
+ 1 ;
1361 lprc
->right
-= nSize
* (nPos
-1) ;
1362 lprc
->left
= lprc
->right
- nSize
+ 1 ;
1366 } // GetButtonRect()
1368 // DrawButton( HDC hDC, HWND hWnd, BOOL fMin, BOOL fDepressed )
1370 // Draws either the min, max, or restore buttons. If fMin is FALSE then it
1371 // will draw either the Max or Restore button. If fDepressed is TRUE it will
1372 // draw the button in a down state.
1374 void PASCAL
DrawButton( HDC hDC
, HWND hWnd
, BOOL fMin
, BOOL fDepressed
)
1378 COLORREF rgbWindowFrame
;
1384 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1386 // If you look at the standard Windows' min/max buttons, you will notice
1387 // that they have two pixels of 'shadow' to the bottom and right. Since
1388 // our buttons can be really, really small, we only want one pixel of
1389 // shadow when they are small. I arbitrarily decided that if the
1390 // caption size is greater than or equal to 20 we will use two
1391 // pixels. That's what this THREASHOLD stuff does.
1393 #define THRESHOLD 20
1394 nOffset
= (nCapSize
>= THRESHOLD
) ? 2 : 1 ;
1399 hDC
= GetWindowDC( hWnd
) ;
1406 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1409 GetMinButtonRect( hWnd
, &rcButton
) ;
1411 GetMaxButtonRect( hWnd
, &rcButton
) ;
1413 GetWindowRect( hWnd
, &rc
) ;
1414 OffsetRect( &rcButton
, -rc
.left
, -rc
.top
) ;
1417 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1419 rc
= rcButton
; //separator line
1420 rc
.bottom
= --rc
.top
+ 1 ;
1425 rc
= rcButton
; //separator line
1426 rc
.right
= --rc
.left
+ 1 ;
1430 //Draw separator line
1431 SetBkColor( hDC
, rgbWindowFrame
) ;
1432 DRAWFASTRECT( hDC
, &rc
) ;
1435 SetBkColor( hDC
, RGBLTGRAY
) ;
1436 DRAWFASTRECT( hDC
, &rcButton
) ;
1440 //The normal min/max buttons have one pixel on the top and left
1441 //sides for the highlight, and two pixels on the bottom and
1442 //right side for the shadow.
1444 //When our caption is 'small' we only use one pixel on all
1447 SetBkColor( hDC
, RGBWHITE
) ;
1450 rc
.right
= rc
.left
+ 1 ;
1451 DRAWFASTRECT( hDC
, &rc
) ;
1455 rc
.bottom
= rc
.top
+ 1 ;
1456 DRAWFASTRECT( hDC
, &rc
) ;
1458 SetBkColor( hDC
, RGBGRAY
) ;
1461 rc
.left
= rc
.right
- 1 ;
1462 DRAWFASTRECT( hDC
, &rc
) ;
1463 if (nCapSize
> THRESHOLD
)
1467 DRAWFASTRECT( hDC
, &rc
) ;
1472 rc
.top
= rc
.bottom
- 1 ;
1473 DRAWFASTRECT( hDC
, &rc
) ;
1474 if (nCapSize
> THRESHOLD
)
1478 DRAWFASTRECT( hDC
, &rc
) ;
1483 rcButton
.right
-= nOffset
;
1484 rcButton
.bottom
-= nOffset
;
1488 //Draw depressed state
1490 SetBkColor( hDC
, RGBGRAY
) ;
1493 rc
.right
= rc
.left
+ nOffset
;
1494 DRAWFASTRECT( hDC
, &rc
) ;
1498 rc
.bottom
= rc
.top
+ nOffset
;
1499 DRAWFASTRECT( hDC
, &rc
) ;
1501 rcButton
.left
+= 2 * nOffset
;
1502 rcButton
.top
+= 2 * nOffset
;
1505 // Now draw the arrows. We do not want the
1506 // arrows to grow too large when we have a bigger than
1507 // normal caption, so we restrict their size.
1509 // rcButton now represents where we can place our
1512 // The maximum size of our arrows (i.e. the width of rcButton)
1513 // has been empirically determined to be SM_CYCAPTION / 2
1515 n
= ((GetSystemMetrics( SM_CYCAPTION
)) / 2) -
1516 (rcButton
.right
- rcButton
.left
) ;
1518 InflateRect( &rcButton
, n
/2-1, n
/2-1 ) ;
1521 DrawArrow( hDC
, &rcButton
, ARROW_DOWN
) ;
1523 if (IsZoomed( hWnd
))
1525 DrawArrow( hDC
, &rcButton
, ARROW_RESTORE
) ;
1528 DrawArrow( hDC
, &rcButton
, ARROW_UP
) ;
1531 ReleaseDC( hWnd
, hDC
) ;
1539 // Draws either a up or down arrow. The arrow is bound by the rectangle
1541 void PASCAL
DrawArrow( HDC hdc
, LPRECT lprc
, UINT uiStyle
)
1547 int nMax
= (lprc
->bottom
- lprc
->top
) >> 1 ;
1549 SetBkColor( hdc
, RGBBLACK
) ;
1551 // We draw the arrow by drawing a series of horizontal lines
1553 xTip
= lprc
->left
+ ((lprc
->right
- lprc
->left
+1) >> 1) ;
1557 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1558 for (row
= 1 ; row
<= nMax
; row
++ )
1560 rc
.left
= xTip
- row
;
1561 rc
.right
= xTip
+ row
- 1 ;
1562 rc
.top
= yTip
+ row
;
1563 rc
.bottom
= rc
.top
+ 1 ;
1564 DRAWFASTRECT( hdc
, &rc
) ;
1569 yTip
= lprc
->bottom
- ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1570 for ( row
= nMax
; row
> 0 ; row
-- )
1572 rc
.left
= xTip
- row
;
1573 rc
.right
= xTip
+ row
- 1 ;
1574 rc
.top
= yTip
- row
;
1575 rc
.bottom
= rc
.top
+ 1 ;
1576 DRAWFASTRECT( hdc
, &rc
) ;
1582 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 3) - 2;
1583 for (row
= 1 ; row
<= nMax
; row
++ )
1585 rc
.left
= xTip
- row
;
1586 rc
.right
= xTip
+ row
- 1 ;
1587 rc
.top
= yTip
+ row
;
1588 rc
.bottom
= rc
.top
+ 1 ;
1589 DRAWFASTRECT( hdc
, &rc
) ;
1592 yTip
+= (nMax
+1) * 2 ;
1593 for ( row
= nMax
; row
> 0 ; row
-- )
1595 rc
.left
= xTip
- row
;
1596 rc
.right
= xTip
+ row
- 1 ;
1597 rc
.top
= yTip
- row
;
1598 rc
.bottom
= rc
.top
+ 1 ;
1599 DRAWFASTRECT( hdc
, &rc
) ;
1606 #endif // wxUSE_ITSY_BITSY