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,_T("ibSize"),(HANDLE)i)
170 #define GETCAPTIONSIZE(h) (UINT)GetProp(h,_T("ibSize"))
171 #define FREECAPTIONSIZE(h) RemoveProp(h,_T("ibSize"))
173 #define SETMENUWASUPFLAG(h,i) (UINT)SetProp(h,_T("ibFlag"),(HANDLE)i)
174 #define GETMENUWASUPFLAG(h) (UINT)GetProp(h,_T("ibFlag"))
175 #define FREEMENUWASUPFLAG(h) RemoveProp(h,_T("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(_T("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
= (wxChar
*)GlobalAllocPtr( GHND
, (ui
+ 2) * sizeof(wxChar
) );
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 wxStrcpy( lf
.lfFaceName
, _T("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
) ;
971 GlobalFreePtr( (unsigned int) lpsz
) ;
973 GlobalFreePtr( lpsz
) ;
979 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
982 DrawButton( hDC
, hWnd
, TRUE
, FALSE
) ;
985 DrawButton( hDC
, hWnd
, FALSE
, FALSE
) ;
992 // DrawSysMenu( HDC hDC, hWnd, BOOL fInvert )
994 // Draws the little system menu icon.
996 void PASCAL
DrawSysMenu( HDC hDC
, HWND hWnd
, BOOL fInvert
)
1001 COLORREF rgbIconFace
;
1002 COLORREF rgbWindowFrame
;
1006 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1011 hDC
= GetWindowDC( hWnd
) ;
1018 rgbIconFace
= GetNearestColor( hDC
, RGBLTGRAY
) ;
1019 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1021 GetIconRect( hWnd
, &rcIcon
) ;
1022 GetWindowRect( hWnd
, &rc
) ;
1024 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1028 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1030 rc
= rcIcon
; // separator line
1031 rc
.top
= ++rc
.bottom
- 1 ;
1035 rc
= rcIcon
; // separator line
1036 rc
.left
= ++rc
.right
- 1 ;
1040 SetBkColor( hDC
, rgbIconFace
) ;
1041 DRAWFASTRECT( hDC
, &rcTemp
) ;
1043 // Draw separator line
1044 SetBkColor( hDC
, rgbWindowFrame
) ;
1045 DRAWFASTRECT( hDC
, &rc
) ;
1049 // Draw the little horizontal doo-hickey
1051 rcTemp
.top
= rcIcon
.top
+ ((nCapSize
-1) / 2) ;
1052 rcTemp
.bottom
= rcTemp
.top
+ 3 ;
1053 rcTemp
.left
= rcTemp
.left
+ 3 ;
1054 rcTemp
.right
= rcTemp
.right
- 1 ;
1056 SetBkColor( hDC
, RGBGRAY
) ;
1057 DRAWFASTRECT( hDC
, &rcTemp
) ;
1060 OffsetRect( &rc
, -1, -1 ) ;
1061 SetBkColor( hDC
, RGBBLACK
) ;
1062 DRAWFASTRECT( hDC
, &rc
) ;
1064 InflateRect( &rc
, -1, -1 ) ;
1065 SetBkColor( hDC
, RGBWHITE
) ;
1066 DRAWFASTRECT( hDC
, &rc
) ;
1070 InvertRect( hDC
, &rcIcon
) ;
1073 ReleaseDC( hWnd
, hDC
) ;
1078 // DoMenu( HWND hWnd )
1080 // Pops up the system menu.
1082 BOOL PASCAL
DoMenu( HWND hWnd
)
1091 if (!TestWinStyle(hWnd
, WS_SYSMENU
))
1094 hDC
= GetWindowDC( hWnd
);
1099 DrawSysMenu( hDC
, hWnd
, TRUE
) ;
1103 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1114 GetIconRect( hWnd
, &rcIcon
) ;
1115 GetWindowRect( hWnd
, &rc
) ;
1116 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1118 ClientToScreen( hWnd
, &pt
) ;
1119 ClientToScreen( hWnd
, (LPPOINT
)&rc
.right
) ;
1121 dw
= GetWindowLong( hWnd
, GWL_STYLE
) ;
1122 SetWindowLong( hWnd
, GWL_STYLE
, dw
| WS_SYSMENU
) ;
1124 hMenu
= GetSystemMenu( hWnd
, FALSE
) ;
1125 SetupSystemMenu( hWnd
, hMenu
) ;
1127 SetWindowLong( hWnd
, GWL_STYLE
, dw
) ;
1129 TrackPopupMenu( hMenu
, 0, //TPM_LEFTALIGN,
1136 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
1137 ReleaseDC( hWnd
, hDC
) ;
1143 // SetupSystemMenu( HWND hWnd, HMENU hMenu )
1145 // Enables/Disables the appropriate menu items on the
1146 // menu passed for the window passed.
1148 void PASCAL
SetupSystemMenu( HWND hWnd
, HMENU hMenu
)
1156 // Assume all should be grayed.
1158 wSize
= wMove
= wMinBox
= wMaxBox
= wRestore
= MF_GRAYED
;
1160 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
) || IsIconic( hWnd
))
1161 wMaxBox
= MF_ENABLED
;
1163 if (TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1164 wMinBox
= MF_ENABLED
;
1166 if (IsZoomed( hWnd
))
1167 wRestore
= MF_ENABLED
;
1169 if (TestWinStyle( hWnd
, WS_THICKFRAME
) &&
1170 !(IsIconic( hWnd
) || IsZoomed( hWnd
)))
1171 wSize
= MF_ENABLED
;
1173 if (!IsZoomed( hWnd
) &&
1174 !IsIconic( hWnd
) &&
1175 TestWinStyle( hWnd
, WS_CAPTION
) )
1176 wMove
= MF_ENABLED
;
1178 EnableMenuItem( hMenu
, SC_MOVE
, wMove
) ;
1179 EnableMenuItem( hMenu
, SC_SIZE
, wSize
) ;
1180 EnableMenuItem( hMenu
, SC_MINIMIZE
, wMinBox
) ;
1181 EnableMenuItem( hMenu
, SC_MAXIMIZE
, wMaxBox
) ;
1182 EnableMenuItem( hMenu
, SC_RESTORE
, wRestore
) ;
1184 } // SetupSystemMenu()
1186 // GetCaptionRect( HWND hWnd, LPRECT lprc )
1188 // calcluales the rectangle of the mini-caption in screen coords.
1190 BOOL PASCAL
GetCaptionRect( HWND hWnd
, LPRECT lprc
)
1194 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1196 if (!HASCAPTION( hWnd
))
1198 SetRectEmpty( lprc
) ;
1202 GetWindowRect( hWnd
, lprc
) ;
1204 // the window might have other non-client components like
1207 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
1209 lprc
->left
+= GetSystemMetrics( SM_CXFRAME
) ;
1210 lprc
->top
+= GetSystemMetrics( SM_CYFRAME
) ;
1211 lprc
->right
-= GetSystemMetrics( SM_CXFRAME
) ;
1212 lprc
->bottom
-= GetSystemMetrics( SM_CYFRAME
) ;
1215 if (TestWinStyle( hWnd
, DS_MODALFRAME
)) // if it's a dialog box
1217 lprc
->left
+= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1218 lprc
->top
+= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1219 lprc
->right
-= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1220 lprc
->bottom
-= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1223 if (TestWinStyle( hWnd
, WS_BORDER
))
1225 lprc
->left
+= GetSystemMetrics( SM_CXBORDER
) ;
1226 lprc
->top
+= GetSystemMetrics( SM_CYBORDER
) ;
1227 lprc
->right
-= GetSystemMetrics( SM_CXBORDER
) ;
1228 lprc
->bottom
-= GetSystemMetrics( SM_CYBORDER
) ;
1231 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1232 lprc
->right
= lprc
->left
+ nCapSize
;
1234 lprc
->bottom
= lprc
->top
+ nCapSize
;
1237 } // GetCaptionRect()
1239 // GetIconRect( HWND hWnd, LPRECT lprc )
1241 // Calculates the rect of the icon in screen coordinates.
1243 BOOL PASCAL
GetIconRect( HWND hWnd
, LPRECT lprc
)
1248 fMenu
= TestWinStyle( hWnd
, WS_SYSMENU
) ;
1249 fVert
= TestWinStyle( hWnd
, IBS_VERTCAPTION
) ;
1251 if (!GetCaptionRect( hWnd
, lprc
)) // window coords
1256 SetRectEmpty( lprc
) ;
1260 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1263 lprc
->bottom
= lprc
->top
+ nCapSize
;
1265 lprc
->right
= lprc
->left
+ nCapSize
;
1274 // GetMinButtonRect()
1276 // Calculates the rect of the minimize button in screen
1279 // For horizontal captions, we have the following situation ('Y' is minimize
1280 // and '^' is maximize or restore):
1282 // +---------------------------------+
1284 // +---------------------------------+
1285 // | |.......| <-- This is the width (nSize)
1287 // For vertical captions, we have the following:
1297 // |--| . <-- This is the height of the rectangle (nSize)
1301 // In order to figure out where the minimize button goes, we first need
1302 // to know if there is a maximize button. If so, use GetMaxButtonRect()
1305 BOOL PASCAL
GetMinButtonRect( HWND hWnd
, LPRECT lprc
)
1307 if (!TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1309 SetRectEmpty( lprc
) ;
1313 // The minimize button can be in either position 1 or 2. If there
1314 // is a maximize button, it's in position 2.
1316 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1317 return GetButtonRect( hWnd
, 2, lprc
) ;
1319 return GetButtonRect( hWnd
, 1, lprc
) ;
1322 // GetMaxButtonRect()
1324 // Calculates the rect of the maximize button in screen
1327 // The maximize button, if present, is always to the far right
1330 BOOL PASCAL
GetMaxButtonRect( HWND hWnd
, LPRECT lprc
)
1332 //The maximize button can only be in position 1.
1334 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1335 return GetButtonRect( hWnd
, 1, lprc
) ;
1338 SetRectEmpty( lprc
) ;
1343 // Get the rect where a button would go.
1345 // This function does not care if it's a min or max, just whether
1346 // it is the first from the right/bottom or second from the right/bottom
1349 BOOL PASCAL
GetButtonRect( HWND hWnd
, UINT nPos
, LPRECT lprc
)
1353 if (!GetCaptionRect( hWnd
, lprc
)) //window coords
1356 nSize
= GETCAPTIONSIZE( hWnd
) ;
1358 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1360 lprc
->bottom
-= nSize
* (nPos
-1) ;
1361 lprc
->top
= lprc
->bottom
- nSize
+ 1 ;
1365 lprc
->right
-= nSize
* (nPos
-1) ;
1366 lprc
->left
= lprc
->right
- nSize
+ 1 ;
1370 } // GetButtonRect()
1372 // DrawButton( HDC hDC, HWND hWnd, BOOL fMin, BOOL fDepressed )
1374 // Draws either the min, max, or restore buttons. If fMin is FALSE then it
1375 // will draw either the Max or Restore button. If fDepressed is TRUE it will
1376 // draw the button in a down state.
1378 void PASCAL
DrawButton( HDC hDC
, HWND hWnd
, BOOL fMin
, BOOL fDepressed
)
1382 COLORREF rgbWindowFrame
;
1388 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1390 // If you look at the standard Windows' min/max buttons, you will notice
1391 // that they have two pixels of 'shadow' to the bottom and right. Since
1392 // our buttons can be really, really small, we only want one pixel of
1393 // shadow when they are small. I arbitrarily decided that if the
1394 // caption size is greater than or equal to 20 we will use two
1395 // pixels. That's what this THREASHOLD stuff does.
1397 #define THRESHOLD 20
1398 nOffset
= (nCapSize
>= THRESHOLD
) ? 2 : 1 ;
1403 hDC
= GetWindowDC( hWnd
) ;
1410 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1413 GetMinButtonRect( hWnd
, &rcButton
) ;
1415 GetMaxButtonRect( hWnd
, &rcButton
) ;
1417 GetWindowRect( hWnd
, &rc
) ;
1418 OffsetRect( &rcButton
, -rc
.left
, -rc
.top
) ;
1421 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1423 rc
= rcButton
; //separator line
1424 rc
.bottom
= --rc
.top
+ 1 ;
1429 rc
= rcButton
; //separator line
1430 rc
.right
= --rc
.left
+ 1 ;
1434 //Draw separator line
1435 SetBkColor( hDC
, rgbWindowFrame
) ;
1436 DRAWFASTRECT( hDC
, &rc
) ;
1439 SetBkColor( hDC
, RGBLTGRAY
) ;
1440 DRAWFASTRECT( hDC
, &rcButton
) ;
1444 //The normal min/max buttons have one pixel on the top and left
1445 //sides for the highlight, and two pixels on the bottom and
1446 //right side for the shadow.
1448 //When our caption is 'small' we only use one pixel on all
1451 SetBkColor( hDC
, RGBWHITE
) ;
1454 rc
.right
= rc
.left
+ 1 ;
1455 DRAWFASTRECT( hDC
, &rc
) ;
1459 rc
.bottom
= rc
.top
+ 1 ;
1460 DRAWFASTRECT( hDC
, &rc
) ;
1462 SetBkColor( hDC
, RGBGRAY
) ;
1465 rc
.left
= rc
.right
- 1 ;
1466 DRAWFASTRECT( hDC
, &rc
) ;
1467 if (nCapSize
> THRESHOLD
)
1471 DRAWFASTRECT( hDC
, &rc
) ;
1476 rc
.top
= rc
.bottom
- 1 ;
1477 DRAWFASTRECT( hDC
, &rc
) ;
1478 if (nCapSize
> THRESHOLD
)
1482 DRAWFASTRECT( hDC
, &rc
) ;
1487 rcButton
.right
-= nOffset
;
1488 rcButton
.bottom
-= nOffset
;
1492 //Draw depressed state
1494 SetBkColor( hDC
, RGBGRAY
) ;
1497 rc
.right
= rc
.left
+ nOffset
;
1498 DRAWFASTRECT( hDC
, &rc
) ;
1502 rc
.bottom
= rc
.top
+ nOffset
;
1503 DRAWFASTRECT( hDC
, &rc
) ;
1505 rcButton
.left
+= 2 * nOffset
;
1506 rcButton
.top
+= 2 * nOffset
;
1509 // Now draw the arrows. We do not want the
1510 // arrows to grow too large when we have a bigger than
1511 // normal caption, so we restrict their size.
1513 // rcButton now represents where we can place our
1516 // The maximum size of our arrows (i.e. the width of rcButton)
1517 // has been empirically determined to be SM_CYCAPTION / 2
1519 n
= ((GetSystemMetrics( SM_CYCAPTION
)) / 2) -
1520 (rcButton
.right
- rcButton
.left
) ;
1522 InflateRect( &rcButton
, n
/2-1, n
/2-1 ) ;
1525 DrawArrow( hDC
, &rcButton
, ARROW_DOWN
) ;
1527 if (IsZoomed( hWnd
))
1529 DrawArrow( hDC
, &rcButton
, ARROW_RESTORE
) ;
1532 DrawArrow( hDC
, &rcButton
, ARROW_UP
) ;
1535 ReleaseDC( hWnd
, hDC
) ;
1543 // Draws either a up or down arrow. The arrow is bound by the rectangle
1545 void PASCAL
DrawArrow( HDC hdc
, LPRECT lprc
, UINT uiStyle
)
1551 int nMax
= (lprc
->bottom
- lprc
->top
) >> 1 ;
1553 SetBkColor( hdc
, RGBBLACK
) ;
1555 // We draw the arrow by drawing a series of horizontal lines
1557 xTip
= lprc
->left
+ ((lprc
->right
- lprc
->left
+1) >> 1) ;
1561 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1562 for (row
= 1 ; row
<= nMax
; row
++ )
1564 rc
.left
= xTip
- row
;
1565 rc
.right
= xTip
+ row
- 1 ;
1566 rc
.top
= yTip
+ row
;
1567 rc
.bottom
= rc
.top
+ 1 ;
1568 DRAWFASTRECT( hdc
, &rc
) ;
1573 yTip
= lprc
->bottom
- ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1574 for ( row
= nMax
; row
> 0 ; row
-- )
1576 rc
.left
= xTip
- row
;
1577 rc
.right
= xTip
+ row
- 1 ;
1578 rc
.top
= yTip
- row
;
1579 rc
.bottom
= rc
.top
+ 1 ;
1580 DRAWFASTRECT( hdc
, &rc
) ;
1586 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 3) - 2;
1587 for (row
= 1 ; row
<= nMax
; row
++ )
1589 rc
.left
= xTip
- row
;
1590 rc
.right
= xTip
+ row
- 1 ;
1591 rc
.top
= yTip
+ row
;
1592 rc
.bottom
= rc
.top
+ 1 ;
1593 DRAWFASTRECT( hdc
, &rc
) ;
1596 yTip
+= (nMax
+1) * 2 ;
1597 for ( row
= nMax
; row
> 0 ; row
-- )
1599 rc
.left
= xTip
- row
;
1600 rc
.right
= xTip
+ row
- 1 ;
1601 rc
.top
= yTip
- row
;
1602 rc
.bottom
= rc
.top
+ 1 ;
1603 DRAWFASTRECT( hdc
, &rc
) ;
1610 #endif // wxUSE_ITSY_BITSY