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 #ifndef wxUSE_NORLANDER_HEADERS
40 #include "wx/msw/gnuwin32/extra.h"
45 #if !USE_SHARED_LIBRARY
46 IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame
, wxFrame
)
49 long wxMiniFrame::MSWDefWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
51 if ((GetWindowStyleFlag() & wxTINY_CAPTION_HORIZ
) ||
52 (GetWindowStyleFlag() & wxTINY_CAPTION_VERT
))
53 return ::ibDefWindowProc((HWND
) GetHWND(), nMsg
, wParam
, lParam
);
54 else if ( m_oldWndProc
)
55 return ::CallWindowProc(CASTWNDPROC m_oldWndProc
, (HWND
) GetHWND(), (UINT
) nMsg
, (WPARAM
) wParam
, (LPARAM
) lParam
);
57 return ::DefWindowProc((HWND
) GetHWND(), nMsg
, wParam
, lParam
);
60 wxMiniFrame::~wxMiniFrame(void)
64 /////////////////////////////////////////////////////////////////////////
66 // Project: ItsyBitsy window support module
70 // ItsyBitsy is a support module that allows you to create windows
71 // that look and act very much like a popup window witha system
72 // menu and caption bar, except everything is scaled to about 2/3
75 // For documentation on how to use ItsyBits, read the document
79 // 9/27/91 Charlie Kindel (cek/ckindel)
80 // Wrote and documented it.
83 // 2/23/93 cek Added minimize/maximize buttons.
84 // 3/18/93 cek Fixed system menu bug where system menu
85 // popped back up if you clicked on the
86 // icon again while it was up.
87 // 3/24/93 cek More comments. Fixed DS_MODALDIALOG style
88 // problem. Use auto precompiled headers
91 //////////////////////////////////////////////////////////////////////////
93 #include "wx/window.h"
94 #include "wx/msw/private.h"
98 #if !defined( __WATCOMC__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__)
107 // Some mildly useful macros for the standard 16 colors
108 #define RGBBLACK RGB(0,0,0)
109 #define RGBRED RGB(128,0,0)
110 #define RGBGREEN RGB(0,128,0)
111 #define RGBBLUE RGB(0,0,128)
113 #define RGBBROWN RGB(128,128,0)
114 #define RGBMAGENTA RGB(128,0,128)
115 #define RGBCYAN RGB(0,128,128)
116 #define RGBLTGRAY RGB(192,192,192)
118 #define RGBGRAY RGB(128,128,128)
119 #define RGBLTRED RGB(255,0,0)
120 #define RGBLTGREEN RGB(0,255,0)
121 #define RGBLTBLUE RGB(0,0,255)
123 #define RGBYELLOW RGB(255,255,0)
124 #define RGBLTMAGENTA RGB(255,0,255)
125 #define RGBLTCYAN RGB(0,255,255)
126 #define RGBWHITE RGB(255,255,255)
129 #ifndef GlobalAllocPtr
130 #define GlobalPtrHandle(lp) \
131 ((HGLOBAL)GlobalHandle(lp))
133 #define GlobalLockPtr(lp) \
134 ((BOOL)GlobalLock(GlobalPtrHandle(lp)))
135 #define GlobalUnlockPtr(lp) \
136 GlobalUnlock(GlobalPtrHandle(lp))
138 #define GlobalAllocPtr(flags, cb) \
139 (GlobalLock(GlobalAlloc((flags), (cb))))
140 #define GlobalReAllocPtr(lp, cbNew, flags) \
141 (GlobalUnlockPtr(lp), GlobalLock(GlobalReAlloc(GlobalPtrHandle(lp) , (cbNew), (flags))))
142 #define GlobalFreePtr(lp) \
143 (GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp)))
146 #if defined(__BORLANDC__) || defined(__WATCOMC__)
147 #define max(a,b) (((a) > (b)) ? (a) : (b))
148 #define min(a,b) (((a) < (b)) ? (a) : (b))
151 // CAPTIONXY is the default size of the system menu icon. This
152 // determines the height/width of the caption.
154 // The value that results from the following formula works out
155 // nicely for the veritcal caption on VGA, 8514 (Large Fonts),
156 // 8514 (Small Fonts), XGA (Small Fonts), XGA (Large Fonts),
157 // and TIGA (Small Fonts). It may not be good on other displays.
159 // The problem is that TT fonts turn into bitmap fonts when they
160 // are sized below a certain threshold. The idea is to make the
161 // size of the caption just big enough to get the smallest TT
162 // (scalable) font to fit.
164 #define CAPTIONXY (GetSystemMetrics( SM_CYCAPTION ) / 2 + 1)
166 #define TestWinStyle( hWnd, dwStyleBit ) \
167 (((DWORD)GetWindowLong( hWnd, GWL_STYLE ) & (DWORD)dwStyleBit) ? TRUE : FALSE )
168 #define HASCAPTION( hwnd ) (TestWinStyle( hwnd, IBS_VERTCAPTION ) ||\
169 TestWinStyle( hwnd, IBS_HORZCAPTION ))
171 #define SETCAPTIONSIZE(h,i) (UINT)SetProp(h,_T("ibSize"),(HANDLE)i)
172 #define GETCAPTIONSIZE(h) (UINT)GetProp(h,_T("ibSize"))
173 #define FREECAPTIONSIZE(h) RemoveProp(h,_T("ibSize"))
175 #define SETMENUWASUPFLAG(h,i) (UINT)SetProp(h,_T("ibFlag"),(HANDLE)i)
176 #define GETMENUWASUPFLAG(h) (UINT)GetProp(h,_T("ibFlag"))
177 #define FREEMENUWASUPFLAG(h) RemoveProp(h,_T("ibFlag"))
179 /////////////////////////////////////////////////////////////////////
180 // Little known fact:
181 // ExtTextOut() is the fastest way to draw a filled rectangle
182 // in Windows (if you don't want dithered colors or borders).
184 // Unfortunately there is a bug in the Windows 3.0 8514 driver
185 // in using ExtTextOut() to a memory DC. If you are drawing
186 // to an off screen bitmap, then blitting that bitmap to the
187 // display, do not #define wxUSE_EXTTEXTOUT below.
189 // The following macro (DRAWFASTRECT) draws a filled rectangle
190 // with no border and a solid color. It uses the current back-
191 // ground color as the fill color.
192 //////////////////////////////////////////////////////////////////////
193 #define wxUSE_EXTTEXTOUT
194 #ifdef wxUSE_EXTTEXTOUT
195 #define DRAWFASTRECT(hdc,lprc) ExtTextOut(hdc,0,0,ETO_OPAQUE,lprc,NULL,0,NULL)
197 #define DRAWFASTRECT(hdc,lprc) {\
198 HBRUSH hbr = CreateSolidBrush( GetBkColor( hdc ) ) ;\
199 hbr = SelectObject(hdc, hbr) ;\
200 PatBlt(hdc,(lprc)->left,(lprc)->top,(lprc)->right-(lprc)->left,(lprc)->bottom-(lprc)->top,PATCOPY) ;\
201 hbr = SelectObject(hdc, hbr) ;\
202 DeleteObject( hbr ) ;\
206 // The DrawArrow function takes the following to indicate what
207 // kind of arrow to draw.
211 #define ARROW_RESTORE 2
213 BOOL PASCAL
DepressMinMaxButton( HWND hWnd
, UINT uiHT
, LPRECT
) ;
214 BOOL PASCAL
DoMenu( HWND hWnd
) ;
215 void PASCAL
SetupSystemMenu( HWND hWnd
, HMENU hMenu
) ;
216 BOOL PASCAL
GetCaptionRect( HWND hWnd
, LPRECT lprc
) ;
217 BOOL PASCAL
GetIconRect( HWND hWnd
, LPRECT lprc
) ;
218 BOOL PASCAL
GetButtonRect( HWND hWnd
, UINT nPos
, LPRECT lprc
) ;
219 BOOL PASCAL
GetMinButtonRect( HWND hWnd
, LPRECT lprc
) ;
220 BOOL PASCAL
GetMaxButtonRect( HWND hWnd
, LPRECT lprc
) ;
221 BOOL PASCAL
DrawCaption( HDC hDC
, HWND hWnd
, LPRECT lprc
,
222 BOOL fVert
, BOOL fSysMenu
,
223 BOOL fMin
, BOOL fMax
, BOOL fActive
) ;
224 void PASCAL
DrawSysMenu( HDC hDC
, HWND hWnd
, BOOL fInvert
) ;
225 void PASCAL
DrawButton( HDC hDC
, HWND hWnd
, BOOL fMin
, BOOL fDepressed
) ;
226 void PASCAL
DrawArrow( HDC hdc
, LPRECT lprc
, UINT uiStyle
) ;
232 ///////////////////////////////////////////////////////////////////////
233 // External/Public functions
234 ///////////////////////////////////////////////////////////////////////
236 /////////////////////////////////////////////////////////////////
237 // UINT WINAPI ibGetCaptionSize( HWND hWnd )
241 // Gets the size of the caption (height if horz, width if
246 ///////////////////////////////////////////////////////////////
247 UINT WINAPI
ibGetCaptionSize( HWND hWnd
)
249 return GETCAPTIONSIZE( hWnd
) + 1 ;
250 } // ibSetCaptionSize()
252 /////////////////////////////////////////////////////////////////
253 // UINT WINAPI ibSetCaptionSize( HWND hWnd, UINT nSize )
257 // Changes the size of the caption (height if horz, width if
262 //////////////////////////////////////////////////////////////////
263 UINT WINAPI
ibSetCaptionSize( HWND hWnd
, UINT nSize
)
271 ui
= SETCAPTIONSIZE( hWnd
, nSize
) ;
273 // Once we change the window style, we need a WM_NCCALCRECT
276 // SWP_FRAMECHANGED is not documented in the 3.1 SDK docs,
277 // but *is* in WINDOWS.H.
279 SetWindowPos( hWnd
, NULL
, 0, 0, 0, 0, SWP_FRAMECHANGED
|
280 SWP_NOSIZE
| SWP_NOMOVE
|
281 SWP_NOACTIVATE
| SWP_NOZORDER
) ;
285 } // ibSetCaptionSize()
287 /////////////////////////////////////////////////////////////////
288 // LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam )
292 // This function should be called instead of DefWindowProc() for
293 // windows that want to have itsybitsy captions.
297 //////////////////////////////////////////////////////////////////
298 LRESULT WINAPI
ibDefWindowProc( HWND hWnd
, UINT uiMsg
, WPARAM wParam
, LPARAM lParam
)
307 // was hit then pop up the menu
309 if (HASCAPTION( hWnd
) && (wParam
== VK_SPACE
))
323 DWORD dw
= GetWindowLong( hWnd
, GWL_STYLE
) ;
325 // Fool DefWindowProc into thinking we do not have
326 // a system menu. Otherwise it will try to
329 SetWindowLong( hWnd
, GWL_STYLE
, dw
&~WS_SYSMENU
) ;
330 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
331 SetWindowLong( hWnd
, GWL_STYLE
, dw
) ;
337 // The menu that is poped up for the system menu with
338 // TrackPopupMenu() sends it's notifications as WM_COMMAND
339 // messages. We need to translate these into
340 // WM_SYSCOMMAND messages. All standard WM_SYSCOMMAND
341 // ids are greater than 0xF000.
343 // This could be a possible cause of confusion if the
344 // itsybitsy window had children that used SC_MOVE or SC_CLOSE
345 // as their IDs. Take note and be careful.
347 // Also, because ibDefWindowProc looks at WM_COMMAND messages,
348 // you will need to be careful to call ibDefWindowProc() for
349 // any wm_command messages that you would normally ignore.
350 // Otherwise the system menu won't work.
352 if (wParam
>= 0xF000)
353 // Call PostMessage() here instead of SendMessage!
355 // Our menu was created by TrackPopupMenu(). TPM() does
356 // not return until after the menu has been destroyed
357 // (and thus the command associated with the menu selection
358 // sent). Therefore when we get here, we are still
359 // *inside* TPM(). If we Send WM_SYSCOMMAND, SC_CLOSE
360 // to the window, the window will be destroyed before
361 // TPM() returns to our code within DoMenu() below. Wel...
362 // We do stuff with the window handle after DoMenu()
363 // returns (namely GetProp()). Since the window has
364 // been destroyed,this is bad.
365 PostMessage( hWnd
, WM_SYSCOMMAND
, wParam
, lParam
) ;
367 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
369 case WM_GETMINMAXINFO
:
371 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
372 if (HASCAPTION( hWnd
) && TestWinStyle( hWnd
, WS_THICKFRAME
))
374 LPPOINT lppt
= (LPPOINT
)lParam
;
379 int cx
, cy
; // window frame/border width
381 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
383 cx
= GetSystemMetrics( SM_CXFRAME
) ;
384 cy
= GetSystemMetrics( SM_CYFRAME
) ;
386 else if (TestWinStyle(hWnd
, WS_BORDER
))
388 cx
= GetSystemMetrics( SM_CXBORDER
) ;
389 cy
= GetSystemMetrics( SM_CYBORDER
) ;
393 // VZ: I don't know what should be here, but the vars must
395 wxFAIL_MSG(_T("don't know how to initialize cx, cy"));
400 GetIconRect( hWnd
, &rcMenu
) ;
401 GetMinButtonRect( hWnd
, &rcMin
) ;
402 GetMaxButtonRect( hWnd
, &rcMax
) ;
403 nX
= (rcMenu
.right
-rcMenu
.left
) +
404 (rcMin
.right
-rcMin
.left
) +
405 (rcMin
.right
-rcMin
.left
) ;
408 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
) )
410 lppt
[3].x
= nCapSize
+ cx
* 2 - 1 ;
411 lppt
[3].y
= nX
+ (2* nCapSize
) ;
415 lppt
[3].x
= nX
+ (2* nCapSize
) ;
416 lppt
[3].y
= nCapSize
+ cy
* 2 - 1 ;
419 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
423 /////////////////////////////////////////////////////////////////////
424 // Non-client area messages. These are used to allow the
425 // minature caption bar to be handled correctly.
431 // We have two things that we need to store somewhere:
432 // 1) The caption height (width).
433 // and 2) A flag indicating whether the sysmenu was
436 // CAPTIONXY is a macro that calls GetSystemMetrics.
438 SETCAPTIONSIZE( hWnd
, CAPTIONXY
) ;
440 // Set our flag that tells us whether the system menu was
443 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
445 // Are we in 3.1? If so we have some neat features
446 // we can use like rotated TrueType fonts.
448 fWin31
= (BOOL
)(LOWORD( GetVersion() ) >= 0x030A) ;
450 // If IBS_????CAPTION was specified and the WS_DLGFRAME (or
451 // WS_DLGFRAME 'cause it == WS_CAPTION | WS_BORDER)
452 // was specified the creator made a mistake. Things get really
453 // ugly if DefWindowProc sees WS_DLGFRAME, so we strip
454 // the WS_DLGFRAME part off!
456 dwStyle
= GetWindowLong( hWnd
, GWL_STYLE
) ;
457 if ((dwStyle
& IBS_VERTCAPTION
|| dwStyle
& IBS_HORZCAPTION
) &&
458 dwStyle
& WS_DLGFRAME
)
460 dwStyle
&= (DWORD
)~WS_DLGFRAME
;
461 SetWindowLong( hWnd
, GWL_STYLE
, dwStyle
) ;
464 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
467 // We store the caption size in a window prop. so we
468 // must remove props.
470 FREECAPTIONSIZE( hWnd
) ;
471 FREEMENUWASUPFLAG( hWnd
) ;
472 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
475 // This is sent when the window manager wants to find out
476 // how big our client area is to be. If we have a mini-caption
477 // then we trap this message and calculate the cleint area rect,
478 // which is the client area rect calculated by DefWindowProc()
479 // minus the width/height of the mini-caption bar
481 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
482 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
))
484 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
486 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
) )
487 ((LPRECT
)lParam
)->left
+= nCapSize
;
489 ((LPRECT
)lParam
)->top
+= nCapSize
;
494 // This message is sent whenever the mouse moves over us.
495 // We will depend on DefWindowProc for everything unless
496 // there is a mini-caption, in which case we will
497 // return HTCAPTION or HTSYSMENU. When the user clicks
498 // or double clicks, NC_LBUTTON/ message are sent with
499 // wParam equal to what we return here.
500 // This means that this is an ideal place to figure out
503 // let defwindowproc handle the standard borders etc...
505 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
506 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
) && lRet
== HTNOWHERE
)
514 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
516 // if DefWindowProc returned HTCAPTION then we have to
517 // refine the area and return HTSYSMENU if appropriate
519 pt
.x
= LOWORD( lParam
) ;
520 pt
.y
= HIWORD( lParam
) ;
522 GetCaptionRect( hWnd
, &rc
) ; // window coords
523 if (PtInRect( &rc
, pt
))
527 // rely on the fact that Get???Rect() return an invalid
528 // (empty) rectangle if the menu/buttons don't exist
530 GetIconRect( hWnd
, &rcMenu
) ;
531 GetMinButtonRect( hWnd
, &rcMinButton
) ;
532 GetMaxButtonRect( hWnd
, &rcMaxButton
) ;
534 if (PtInRect( &rcMenu
, pt
))
537 if (PtInRect( &rcMinButton
, pt
))
540 if (PtInRect( &rcMaxButton
, pt
))
544 if (lRet
!= HTSYSMENU
)
545 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
548 case WM_NCLBUTTONDBLCLK
:
549 // Windows recieve WM_NC?BUTTONDBLCLK messages whether they
550 // have CS_DBLCLKS or not. We watch for one of these
551 // to see if the user double clicked on the system menu (to
552 // close the window) or on the caption (to maximize the window).
554 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
) && wParam
== HTSYSMENU
)
556 SendMessage( hWnd
, WM_CLOSE
, 0, 0L ) ;
559 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
561 case WM_NCLBUTTONDOWN
:
565 // If we're iconic or we don't have a caption then
566 // DefWindowProc will do the job just fine.
568 if (IsIconic( hWnd
) || !HASCAPTION( hWnd
))
569 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
571 // Here's were we handle the system menu, the min and max buttons.
572 // If you wanted to change the behavior of the min/max buttons
573 // do something like swap tool palettes or something, you
574 // would change the SendMessage() calls below.
579 if (GETMENUWASUPFLAG( hWnd
) == FALSE
&& DoMenu( hWnd
))
580 SETMENUWASUPFLAG( hWnd
, TRUE
) ;
582 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
586 GetMinButtonRect( hWnd
, &rc
) ;
587 // Note that DepressMinMaxButton() goes into
588 // a PeekMessage() loop waiting for the mouse
591 if (DepressMinMaxButton( hWnd
, wParam
, &rc
))
592 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_MINIMIZE
, lParam
) ;
596 GetMaxButtonRect( hWnd
, &rc
) ;
597 // Note that DepressMinMaxButton() goes into
598 // a PeekMessage() loop waiting for the mouse
601 if (DepressMinMaxButton( hWnd
, wParam
, &rc
))
604 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_RESTORE
, lParam
) ;
606 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_MAXIMIZE
, lParam
) ;
611 // Well, it appears as though the user clicked somewhere other
612 // than the buttons. We let DefWindowProc do it's magic.
613 // This is where things like dragging and sizing the
616 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
623 if (IsIconic( hWnd
))
624 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
626 // Paint the non-client area here. We will call DefWindowProc
627 // after we are done so it can paint the borders and so
630 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
631 if (HASCAPTION( hWnd
))
635 HDC hDC
= GetWindowDC( hWnd
) ;
638 GetCaptionRect( hWnd
, &rcCap
) ; // Convert to window coords
639 GetWindowRect( hWnd
, &rc
) ;
640 OffsetRect( &rcCap
, -rc
.left
, -rc
.top
) ;
642 if (uiMsg
== WM_NCPAINT
)
643 fActive
= (hWnd
== GetActiveWindow()) ;
647 DrawCaption( hDC
, hWnd
, &rcCap
,
648 TestWinStyle(hWnd
, IBS_VERTCAPTION
),
649 TestWinStyle(hWnd
, WS_SYSMENU
),
650 TestWinStyle(hWnd
, WS_MINIMIZEBOX
),
651 TestWinStyle(hWnd
, WS_MAXIMIZEBOX
),
654 ReleaseDC( hWnd
, hDC
) ;
660 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
665 } // ibDefWindowProc()
667 // ibAdjustWindowRect( HWND hWnd, LPRECT lprc )
669 // Does the same thing as the USER function AdjustWindowRect(),
670 // but knows about itsybitsy windows. AdjustWindowRect() is
671 // bogus for stuff like this.
673 void WINAPI
ibAdjustWindowRect( HWND hWnd
, LPRECT lprc
)
675 short cx
= 0, cy
= 0 ;
678 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
680 // First check Windows's styles, then our own.
682 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
684 cx
= GetSystemMetrics( SM_CXFRAME
) ;
685 cy
= GetSystemMetrics( SM_CYFRAME
) ;
688 if (TestWinStyle(hWnd
, DS_MODALFRAME
))
690 cx
= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
691 cy
= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
694 if (TestWinStyle(hWnd
, WS_BORDER
))
696 cx
= GetSystemMetrics( SM_CXBORDER
) ;
697 cy
= GetSystemMetrics( SM_CYBORDER
) ;
700 InflateRect( lprc
, cx
, cy
) ;
702 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
703 lprc
->left
-= nCapSize
;
705 if (TestWinStyle( hWnd
, IBS_HORZCAPTION
))
706 lprc
->top
-= nCapSize
;
708 } // ibAdjustWindowRect()
711 ///////////////////////////////////////////////////////////////////////
712 // Internal functions
713 ///////////////////////////////////////////////////////////////////////
715 // DepressMinMaxButton()
717 // This function is called when the user has pressed either the min or
718 // max button (i.e. WM_NCLBUTTONDOWN). We go into a Peekmessage() loop,
719 // waiting for the mouse to come back up. This allows us to make the
720 // button change up/down state like a real button does.
722 // lprc points to the rectangle that describes the button the
723 // user has clicked on.
725 BOOL PASCAL
DepressMinMaxButton( HWND hWnd
, UINT uiHT
, LPRECT lprc
)
727 BOOL fDepressed
= TRUE
;
730 // Draw button in down state
731 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
) ;
736 if (PeekMessage((LPMSG
)&msg
, NULL
, WM_MOUSEFIRST
, WM_MOUSELAST
, PM_REMOVE
))
742 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, !fDepressed
) ;
744 return PtInRect( lprc
, msg
.pt
) ;
747 if (PtInRect( lprc
, msg
.pt
))
750 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
= TRUE
) ;
755 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
= FALSE
) ;
762 } // DepressMinMaxButton()
764 // DrawCaption( HDC hDC, HWND hWnd, LPRECT lprc,
765 // BOOL fVert, BOOL fSysMenu, BOOL fActive )
767 // This function draws an itsy bitsy caption bar with or
768 // without system menu to the dc specified by hDC. The
769 // caption is drawn to fit within the lprc RECT and is
770 // drawn//withOut/ borders.
772 BOOL PASCAL
DrawCaption( HDC hDC
, HWND hWnd
, LPRECT lprc
,
773 BOOL fVert
, BOOL fSysMenu
, BOOL fMin
,
774 BOOL fMax
, BOOL fActive
)
778 COLORREF rgbCaptionBG
;
780 COLORREF rgbWindowFrame
;
785 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
789 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
791 // if we have focus use the active caption color
792 // otherwise use the inactive caption color
796 rgbText
= GetSysColor( COLOR_CAPTIONTEXT
) ;
797 rgbCaptionBG
= GetSysColor( COLOR_ACTIVECAPTION
) ;
802 rgbText
= GetSysColor( COLOR_INACTIVECAPTIONTEXT
) ;
804 rgbText
= GetSysColor( COLOR_CAPTIONTEXT
) ;
806 rgbCaptionBG
= GetSysColor( COLOR_INACTIVECAPTION
) ;
809 SetBkMode( hDC
, TRANSPARENT
) ;
810 SelectObject( hDC
, GetStockObject( NULL_BRUSH
) ) ;
811 SelectObject( hDC
, GetStockObject( NULL_PEN
) ) ;
818 rcCap
.top
+= nCapSize
;
820 rcCap
.left
+= nCapSize
;
826 rcCap
.bottom
-= nCapSize
;
828 rcCap
.right
-= nCapSize
;
834 rcCap
.bottom
-= nCapSize
;
836 rcCap
.right
-= nCapSize
;
841 rc
.left
= lprc
->right
- 1 ;
842 rc
.right
= lprc
->right
;
844 rc
.bottom
= lprc
->bottom
;
848 rc
.left
= lprc
->left
;
849 rc
.right
= lprc
->right
;
850 rc
.bottom
= lprc
->bottom
;
851 rc
.top
= rc
.bottom
- 1 ;
854 SetBkColor( hDC
, rgbWindowFrame
) ;
855 DRAWFASTRECT( hDC
, &rc
) ;
857 hbrCaption
= CreateSolidBrush( rgbCaptionBG
) ;
858 hbrCaption
= (HBRUSH
) SelectObject( hDC
, hbrCaption
) ;
859 SelectObject( hDC
, (HPEN
) GetStockObject( NULL_PEN
) ) ;
861 Rectangle( hDC
, rcCap
.left
, rcCap
.top
, rcCap
.right
, rcCap
.bottom
+ 1 ) ;
863 Rectangle( hDC
, rcCap
.left
, rcCap
.top
, rcCap
.right
+1, rcCap
.bottom
) ;
864 hbrCaption
= (HBRUSH
) SelectObject( hDC
, hbrCaption
) ;
865 DeleteObject( hbrCaption
) ;
868 // Draw caption text here. Only do it in 3.1 'cause 3.1 gives
871 ui
= GetWindowTextLength( hWnd
) ;
882 lpsz
= (wxChar
*)GlobalAllocPtr( GHND
, (ui
+ 2) * sizeof(wxChar
) );
887 GetWindowText( hWnd
, lpsz
, ui
+ 1 ) ;
888 nBkMode
= SetBkMode( hDC
, TRANSPARENT
) ;
889 rgbText
= SetTextColor( hDC
, rgbText
) ;
891 memset( &lf
, '\0', sizeof(LOGFONT
) ) ;
893 lf
.lfHeight
= -(int)(nCapSize
- 3) ;
894 lf
.lfCharSet
= ANSI_CHARSET
;
895 lf
.lfQuality
= DEFAULT_QUALITY
;
896 lf
.lfClipPrecision
= CLIP_LH_ANGLES
| CLIP_STROKE_PRECIS
;
899 lf
.lfWeight
= FW_BOLD
;
904 // Can only rotate true type fonts (well, ok, we could
905 // try and use "modern").
906 wxStrcpy( lf
.lfFaceName
, _T("Arial") ) ;
907 lf
.lfPitchAndFamily
= FF_SWISS
| 0x04;
908 lf
.lfEscapement
= 900 ;
910 // Note: The Win 3.1 documentation for CreateFont() say's
911 // that the lfOrientation member is ignored. It appears,
912 // that on Windows 16 3.1 this is true, but when running
913 // as a 16 bit WinApp on WindowsNT 3.1 the lfOrientation
914 // must be set or the text does not rotate!
916 lf
.lfOrientation
= 900 ;
918 hFont
= CreateFontIndirect( &lf
) ;
919 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
921 GetTextExtentPoint( hDC
, lpsz
, ui
, &Size
) ;
922 cx
= rcCap
.bottom
- ((rcCap
.bottom
- rcCap
.top
- Size
.cx
) / 2) ;
923 cy
= rcCap
.left
- 1 + ((rcCap
.right
- rcCap
.left
- Size
.cy
) / 2) ;
925 // Make sure we got a rotatable font back.
927 GetTextMetrics( hDC
, &tm
) ;
928 if (tm
.tmPitchAndFamily
& TMPF_VECTOR
||
929 tm
.tmPitchAndFamily
& TMPF_TRUETYPE
)
933 min( (long)cx
, rcCap
.bottom
),
938 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
939 DeleteObject( hFont
) ;
943 // Use small fonts always for the horizontal. Cause it looks
944 // more like "System" than Arial.
946 lf
.lfPitchAndFamily
= FF_SWISS
;
948 hFont
= CreateFontIndirect( &lf
) ;
949 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
951 GetTextExtentPoint( hDC
, lpsz
, ui
, &Size
) ;
952 cx
= rcCap
.left
+ ((rcCap
.right
- rcCap
.left
- Size
.cx
) / 2) ;
953 cy
= rcCap
.top
+ ((rcCap
.bottom
- rcCap
.top
- Size
.cy
) / 2) ;
955 // Figger out how big the string is
958 max( (long)cx
, rcCap
.left
),
963 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
964 DeleteObject( hFont
) ;
969 rgbText
= SetTextColor( hDC
, rgbText
) ;
970 SetBkMode( hDC
, nBkMode
) ;
973 GlobalFreePtr( (unsigned int) lpsz
) ;
975 GlobalFreePtr( lpsz
) ;
981 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
984 DrawButton( hDC
, hWnd
, TRUE
, FALSE
) ;
987 DrawButton( hDC
, hWnd
, FALSE
, FALSE
) ;
994 // DrawSysMenu( HDC hDC, hWnd, BOOL fInvert )
996 // Draws the little system menu icon.
998 void PASCAL
DrawSysMenu( HDC hDC
, HWND hWnd
, BOOL fInvert
)
1003 COLORREF rgbIconFace
;
1004 COLORREF rgbWindowFrame
;
1008 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1013 hDC
= GetWindowDC( hWnd
) ;
1020 rgbIconFace
= GetNearestColor( hDC
, RGBLTGRAY
) ;
1021 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1023 GetIconRect( hWnd
, &rcIcon
) ;
1024 GetWindowRect( hWnd
, &rc
) ;
1026 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1030 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1032 rc
= rcIcon
; // separator line
1033 rc
.top
= ++rc
.bottom
- 1 ;
1037 rc
= rcIcon
; // separator line
1038 rc
.left
= ++rc
.right
- 1 ;
1042 SetBkColor( hDC
, rgbIconFace
) ;
1043 DRAWFASTRECT( hDC
, &rcTemp
) ;
1045 // Draw separator line
1046 SetBkColor( hDC
, rgbWindowFrame
) ;
1047 DRAWFASTRECT( hDC
, &rc
) ;
1051 // Draw the little horizontal doo-hickey
1053 rcTemp
.top
= rcIcon
.top
+ ((nCapSize
-1) / 2) ;
1054 rcTemp
.bottom
= rcTemp
.top
+ 3 ;
1055 rcTemp
.left
= rcTemp
.left
+ 3 ;
1056 rcTemp
.right
= rcTemp
.right
- 1 ;
1058 SetBkColor( hDC
, RGBGRAY
) ;
1059 DRAWFASTRECT( hDC
, &rcTemp
) ;
1062 OffsetRect( &rc
, -1, -1 ) ;
1063 SetBkColor( hDC
, RGBBLACK
) ;
1064 DRAWFASTRECT( hDC
, &rc
) ;
1066 InflateRect( &rc
, -1, -1 ) ;
1067 SetBkColor( hDC
, RGBWHITE
) ;
1068 DRAWFASTRECT( hDC
, &rc
) ;
1072 InvertRect( hDC
, &rcIcon
) ;
1075 ReleaseDC( hWnd
, hDC
) ;
1080 // DoMenu( HWND hWnd )
1082 // Pops up the system menu.
1084 BOOL PASCAL
DoMenu( HWND hWnd
)
1093 if (!TestWinStyle(hWnd
, WS_SYSMENU
))
1096 hDC
= GetWindowDC( hWnd
);
1101 DrawSysMenu( hDC
, hWnd
, TRUE
) ;
1105 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1116 GetIconRect( hWnd
, &rcIcon
) ;
1117 GetWindowRect( hWnd
, &rc
) ;
1118 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1120 ClientToScreen( hWnd
, &pt
) ;
1121 ClientToScreen( hWnd
, (LPPOINT
)&rc
.right
) ;
1123 dw
= GetWindowLong( hWnd
, GWL_STYLE
) ;
1124 SetWindowLong( hWnd
, GWL_STYLE
, dw
| WS_SYSMENU
) ;
1126 hMenu
= GetSystemMenu( hWnd
, FALSE
) ;
1127 SetupSystemMenu( hWnd
, hMenu
) ;
1129 SetWindowLong( hWnd
, GWL_STYLE
, dw
) ;
1131 TrackPopupMenu( hMenu
, 0, //TPM_LEFTALIGN,
1138 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
1139 ReleaseDC( hWnd
, hDC
) ;
1145 // SetupSystemMenu( HWND hWnd, HMENU hMenu )
1147 // Enables/Disables the appropriate menu items on the
1148 // menu passed for the window passed.
1150 void PASCAL
SetupSystemMenu( HWND hWnd
, HMENU hMenu
)
1158 // Assume all should be grayed.
1160 wSize
= wMove
= wMinBox
= wMaxBox
= wRestore
= MF_GRAYED
;
1162 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
) || IsIconic( hWnd
))
1163 wMaxBox
= MF_ENABLED
;
1165 if (TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1166 wMinBox
= MF_ENABLED
;
1168 if (IsZoomed( hWnd
))
1169 wRestore
= MF_ENABLED
;
1171 if (TestWinStyle( hWnd
, WS_THICKFRAME
) &&
1172 !(IsIconic( hWnd
) || IsZoomed( hWnd
)))
1173 wSize
= MF_ENABLED
;
1175 if (!IsZoomed( hWnd
) &&
1176 !IsIconic( hWnd
) &&
1177 TestWinStyle( hWnd
, WS_CAPTION
) )
1178 wMove
= MF_ENABLED
;
1180 EnableMenuItem( hMenu
, SC_MOVE
, wMove
) ;
1181 EnableMenuItem( hMenu
, SC_SIZE
, wSize
) ;
1182 EnableMenuItem( hMenu
, SC_MINIMIZE
, wMinBox
) ;
1183 EnableMenuItem( hMenu
, SC_MAXIMIZE
, wMaxBox
) ;
1184 EnableMenuItem( hMenu
, SC_RESTORE
, wRestore
) ;
1186 } // SetupSystemMenu()
1188 // GetCaptionRect( HWND hWnd, LPRECT lprc )
1190 // calcluales the rectangle of the mini-caption in screen coords.
1192 BOOL PASCAL
GetCaptionRect( HWND hWnd
, LPRECT lprc
)
1196 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1198 if (!HASCAPTION( hWnd
))
1200 SetRectEmpty( lprc
) ;
1204 GetWindowRect( hWnd
, lprc
) ;
1206 // the window might have other non-client components like
1209 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
1211 lprc
->left
+= GetSystemMetrics( SM_CXFRAME
) ;
1212 lprc
->top
+= GetSystemMetrics( SM_CYFRAME
) ;
1213 lprc
->right
-= GetSystemMetrics( SM_CXFRAME
) ;
1214 lprc
->bottom
-= GetSystemMetrics( SM_CYFRAME
) ;
1217 if (TestWinStyle( hWnd
, DS_MODALFRAME
)) // if it's a dialog box
1219 lprc
->left
+= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1220 lprc
->top
+= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1221 lprc
->right
-= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1222 lprc
->bottom
-= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1225 if (TestWinStyle( hWnd
, WS_BORDER
))
1227 lprc
->left
+= GetSystemMetrics( SM_CXBORDER
) ;
1228 lprc
->top
+= GetSystemMetrics( SM_CYBORDER
) ;
1229 lprc
->right
-= GetSystemMetrics( SM_CXBORDER
) ;
1230 lprc
->bottom
-= GetSystemMetrics( SM_CYBORDER
) ;
1233 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1234 lprc
->right
= lprc
->left
+ nCapSize
;
1236 lprc
->bottom
= lprc
->top
+ nCapSize
;
1239 } // GetCaptionRect()
1241 // GetIconRect( HWND hWnd, LPRECT lprc )
1243 // Calculates the rect of the icon in screen coordinates.
1245 BOOL PASCAL
GetIconRect( HWND hWnd
, LPRECT lprc
)
1250 fMenu
= TestWinStyle( hWnd
, WS_SYSMENU
) ;
1251 fVert
= TestWinStyle( hWnd
, IBS_VERTCAPTION
) ;
1253 if (!GetCaptionRect( hWnd
, lprc
)) // window coords
1258 SetRectEmpty( lprc
) ;
1262 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1265 lprc
->bottom
= lprc
->top
+ nCapSize
;
1267 lprc
->right
= lprc
->left
+ nCapSize
;
1276 // GetMinButtonRect()
1278 // Calculates the rect of the minimize button in screen
1281 // For horizontal captions, we have the following situation ('Y' is minimize
1282 // and '^' is maximize or restore):
1284 // +---------------------------------+
1286 // +---------------------------------+
1287 // | |.......| <-- This is the width (nSize)
1289 // For vertical captions, we have the following:
1299 // |--| . <-- This is the height of the rectangle (nSize)
1303 // In order to figure out where the minimize button goes, we first need
1304 // to know if there is a maximize button. If so, use GetMaxButtonRect()
1307 BOOL PASCAL
GetMinButtonRect( HWND hWnd
, LPRECT lprc
)
1309 if (!TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1311 SetRectEmpty( lprc
) ;
1315 // The minimize button can be in either position 1 or 2. If there
1316 // is a maximize button, it's in position 2.
1318 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1319 return GetButtonRect( hWnd
, 2, lprc
) ;
1321 return GetButtonRect( hWnd
, 1, lprc
) ;
1324 // GetMaxButtonRect()
1326 // Calculates the rect of the maximize button in screen
1329 // The maximize button, if present, is always to the far right
1332 BOOL PASCAL
GetMaxButtonRect( HWND hWnd
, LPRECT lprc
)
1334 //The maximize button can only be in position 1.
1336 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1337 return GetButtonRect( hWnd
, 1, lprc
) ;
1340 SetRectEmpty( lprc
) ;
1345 // Get the rect where a button would go.
1347 // This function does not care if it's a min or max, just whether
1348 // it is the first from the right/bottom or second from the right/bottom
1351 BOOL PASCAL
GetButtonRect( HWND hWnd
, UINT nPos
, LPRECT lprc
)
1355 if (!GetCaptionRect( hWnd
, lprc
)) //window coords
1358 nSize
= GETCAPTIONSIZE( hWnd
) ;
1360 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1362 lprc
->bottom
-= nSize
* (nPos
-1) ;
1363 lprc
->top
= lprc
->bottom
- nSize
+ 1 ;
1367 lprc
->right
-= nSize
* (nPos
-1) ;
1368 lprc
->left
= lprc
->right
- nSize
+ 1 ;
1372 } // GetButtonRect()
1374 // DrawButton( HDC hDC, HWND hWnd, BOOL fMin, BOOL fDepressed )
1376 // Draws either the min, max, or restore buttons. If fMin is FALSE then it
1377 // will draw either the Max or Restore button. If fDepressed is TRUE it will
1378 // draw the button in a down state.
1380 void PASCAL
DrawButton( HDC hDC
, HWND hWnd
, BOOL fMin
, BOOL fDepressed
)
1384 COLORREF rgbWindowFrame
;
1390 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1392 // If you look at the standard Windows' min/max buttons, you will notice
1393 // that they have two pixels of 'shadow' to the bottom and right. Since
1394 // our buttons can be really, really small, we only want one pixel of
1395 // shadow when they are small. I arbitrarily decided that if the
1396 // caption size is greater than or equal to 20 we will use two
1397 // pixels. That's what this THREASHOLD stuff does.
1399 #define THRESHOLD 20
1400 nOffset
= (nCapSize
>= THRESHOLD
) ? 2 : 1 ;
1405 hDC
= GetWindowDC( hWnd
) ;
1412 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1415 GetMinButtonRect( hWnd
, &rcButton
) ;
1417 GetMaxButtonRect( hWnd
, &rcButton
) ;
1419 GetWindowRect( hWnd
, &rc
) ;
1420 OffsetRect( &rcButton
, -rc
.left
, -rc
.top
) ;
1423 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1425 rc
= rcButton
; //separator line
1426 rc
.bottom
= --rc
.top
+ 1 ;
1431 rc
= rcButton
; //separator line
1432 rc
.right
= --rc
.left
+ 1 ;
1436 //Draw separator line
1437 SetBkColor( hDC
, rgbWindowFrame
) ;
1438 DRAWFASTRECT( hDC
, &rc
) ;
1441 SetBkColor( hDC
, RGBLTGRAY
) ;
1442 DRAWFASTRECT( hDC
, &rcButton
) ;
1446 //The normal min/max buttons have one pixel on the top and left
1447 //sides for the highlight, and two pixels on the bottom and
1448 //right side for the shadow.
1450 //When our caption is 'small' we only use one pixel on all
1453 SetBkColor( hDC
, RGBWHITE
) ;
1456 rc
.right
= rc
.left
+ 1 ;
1457 DRAWFASTRECT( hDC
, &rc
) ;
1461 rc
.bottom
= rc
.top
+ 1 ;
1462 DRAWFASTRECT( hDC
, &rc
) ;
1464 SetBkColor( hDC
, RGBGRAY
) ;
1467 rc
.left
= rc
.right
- 1 ;
1468 DRAWFASTRECT( hDC
, &rc
) ;
1469 if (nCapSize
> THRESHOLD
)
1473 DRAWFASTRECT( hDC
, &rc
) ;
1478 rc
.top
= rc
.bottom
- 1 ;
1479 DRAWFASTRECT( hDC
, &rc
) ;
1480 if (nCapSize
> THRESHOLD
)
1484 DRAWFASTRECT( hDC
, &rc
) ;
1489 rcButton
.right
-= nOffset
;
1490 rcButton
.bottom
-= nOffset
;
1494 //Draw depressed state
1496 SetBkColor( hDC
, RGBGRAY
) ;
1499 rc
.right
= rc
.left
+ nOffset
;
1500 DRAWFASTRECT( hDC
, &rc
) ;
1504 rc
.bottom
= rc
.top
+ nOffset
;
1505 DRAWFASTRECT( hDC
, &rc
) ;
1507 rcButton
.left
+= 2 * nOffset
;
1508 rcButton
.top
+= 2 * nOffset
;
1511 // Now draw the arrows. We do not want the
1512 // arrows to grow too large when we have a bigger than
1513 // normal caption, so we restrict their size.
1515 // rcButton now represents where we can place our
1518 // The maximum size of our arrows (i.e. the width of rcButton)
1519 // has been empirically determined to be SM_CYCAPTION / 2
1521 n
= ((GetSystemMetrics( SM_CYCAPTION
)) / 2) -
1522 (rcButton
.right
- rcButton
.left
) ;
1524 InflateRect( &rcButton
, n
/2-1, n
/2-1 ) ;
1527 DrawArrow( hDC
, &rcButton
, ARROW_DOWN
) ;
1529 if (IsZoomed( hWnd
))
1531 DrawArrow( hDC
, &rcButton
, ARROW_RESTORE
) ;
1534 DrawArrow( hDC
, &rcButton
, ARROW_UP
) ;
1537 ReleaseDC( hWnd
, hDC
) ;
1545 // Draws either a up or down arrow. The arrow is bound by the rectangle
1547 void PASCAL
DrawArrow( HDC hdc
, LPRECT lprc
, UINT uiStyle
)
1553 int nMax
= (lprc
->bottom
- lprc
->top
) >> 1 ;
1555 SetBkColor( hdc
, RGBBLACK
) ;
1557 // We draw the arrow by drawing a series of horizontal lines
1559 xTip
= lprc
->left
+ ((lprc
->right
- lprc
->left
+1) >> 1) ;
1563 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1564 for (row
= 1 ; row
<= nMax
; row
++ )
1566 rc
.left
= xTip
- row
;
1567 rc
.right
= xTip
+ row
- 1 ;
1568 rc
.top
= yTip
+ row
;
1569 rc
.bottom
= rc
.top
+ 1 ;
1570 DRAWFASTRECT( hdc
, &rc
) ;
1575 yTip
= lprc
->bottom
- ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1576 for ( row
= nMax
; row
> 0 ; row
-- )
1578 rc
.left
= xTip
- row
;
1579 rc
.right
= xTip
+ row
- 1 ;
1580 rc
.top
= yTip
- row
;
1581 rc
.bottom
= rc
.top
+ 1 ;
1582 DRAWFASTRECT( hdc
, &rc
) ;
1588 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 3) - 2;
1589 for (row
= 1 ; row
<= nMax
; row
++ )
1591 rc
.left
= xTip
- row
;
1592 rc
.right
= xTip
+ row
- 1 ;
1593 rc
.top
= yTip
+ row
;
1594 rc
.bottom
= rc
.top
+ 1 ;
1595 DRAWFASTRECT( hdc
, &rc
) ;
1598 yTip
+= (nMax
+1) * 2 ;
1599 for ( row
= nMax
; row
> 0 ; row
-- )
1601 rc
.left
= xTip
- row
;
1602 rc
.right
= xTip
+ row
- 1 ;
1603 rc
.top
= yTip
- row
;
1604 rc
.bottom
= rc
.top
+ 1 ;
1605 DRAWFASTRECT( hdc
, &rc
) ;
1612 #endif // wxUSE_ITSY_BITSY