1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxMiniFrame
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
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"
36 #include "wx/minifram.h"
38 IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame
, wxFrame
)
46 #include "wx/minifram.h"
48 #ifdef __GNUWIN32_OLD__
49 #include "wx/msw/gnuwin32/extra.h"
52 IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame
, wxFrame
)
54 long wxMiniFrame::MSWDefWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
56 if ((GetWindowStyleFlag() & wxTINY_CAPTION_HORIZ
) ||
57 (GetWindowStyleFlag() & wxTINY_CAPTION_VERT
))
58 return ::ibDefWindowProc((HWND
) GetHWND(), nMsg
, wParam
, lParam
);
59 else if ( m_oldWndProc
)
60 return ::CallWindowProc(CASTWNDPROC m_oldWndProc
, (HWND
) GetHWND(), (UINT
) nMsg
, (WPARAM
) wParam
, (LPARAM
) lParam
);
62 return ::DefWindowProc((HWND
) GetHWND(), nMsg
, wParam
, lParam
);
65 wxMiniFrame::~wxMiniFrame(void)
69 /////////////////////////////////////////////////////////////////////////
71 // Project: ItsyBitsy window support module
75 // ItsyBitsy is a support module that allows you to create windows
76 // that look and act very much like a popup window witha system
77 // menu and caption bar, except everything is scaled to about 2/3
80 // For documentation on how to use ItsyBits, read the document
84 // 9/27/91 Charlie Kindel (cek/ckindel)
85 // Wrote and documented it.
88 // 2/23/93 cek Added minimize/maximize buttons.
89 // 3/18/93 cek Fixed system menu bug where system menu
90 // popped back up if you clicked on the
91 // icon again while it was up.
92 // 3/24/93 cek More comments. Fixed DS_MODALDIALOG style
93 // problem. Use auto precompiled headers
96 //////////////////////////////////////////////////////////////////////////
98 #include "wx/window.h"
99 #include "wx/msw/private.h"
103 #if !defined( __WATCOMC__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__)
112 // Some mildly useful macros for the standard 16 colors
113 #define RGBBLACK RGB(0,0,0)
114 #define RGBRED RGB(128,0,0)
115 #define RGBGREEN RGB(0,128,0)
116 #define RGBBLUE RGB(0,0,128)
118 #define RGBBROWN RGB(128,128,0)
119 #define RGBMAGENTA RGB(128,0,128)
120 #define RGBCYAN RGB(0,128,128)
121 #define RGBLTGRAY RGB(192,192,192)
123 #define RGBGRAY RGB(128,128,128)
124 #define RGBLTRED RGB(255,0,0)
125 #define RGBLTGREEN RGB(0,255,0)
126 #define RGBLTBLUE RGB(0,0,255)
128 #define RGBYELLOW RGB(255,255,0)
129 #define RGBLTMAGENTA RGB(255,0,255)
130 #define RGBLTCYAN RGB(0,255,255)
131 #define RGBWHITE RGB(255,255,255)
134 #ifndef GlobalAllocPtr
135 #define GlobalPtrHandle(lp) \
136 ((HGLOBAL)GlobalHandle(lp))
138 #define GlobalLockPtr(lp) \
139 ((BOOL)GlobalLock(GlobalPtrHandle(lp)))
140 #define GlobalUnlockPtr(lp) \
141 GlobalUnlock(GlobalPtrHandle(lp))
143 #define GlobalAllocPtr(flags, cb) \
144 (GlobalLock(GlobalAlloc((flags), (cb))))
145 #define GlobalReAllocPtr(lp, cbNew, flags) \
146 (GlobalUnlockPtr(lp), GlobalLock(GlobalReAlloc(GlobalPtrHandle(lp) , (cbNew), (flags))))
147 #define GlobalFreePtr(lp) \
148 (GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp)))
151 #if defined(__BORLANDC__) || defined(__WATCOMC__)
152 #define max(a,b) (((a) > (b)) ? (a) : (b))
153 #define min(a,b) (((a) < (b)) ? (a) : (b))
156 // CAPTIONXY is the default size of the system menu icon. This
157 // determines the height/width of the caption.
159 // The value that results from the following formula works out
160 // nicely for the veritcal caption on VGA, 8514 (Large Fonts),
161 // 8514 (Small Fonts), XGA (Small Fonts), XGA (Large Fonts),
162 // and TIGA (Small Fonts). It may not be good on other displays.
164 // The problem is that TT fonts turn into bitmap fonts when they
165 // are sized below a certain threshold. The idea is to make the
166 // size of the caption just big enough to get the smallest TT
167 // (scalable) font to fit.
169 #define CAPTIONXY (GetSystemMetrics( SM_CYCAPTION ) / 2 + 1)
171 #define TestWinStyle( hWnd, dwStyleBit ) \
172 (((DWORD)GetWindowLong( hWnd, GWL_STYLE ) & (DWORD)dwStyleBit) ? TRUE : FALSE )
173 #define HASCAPTION( hwnd ) (TestWinStyle( hwnd, IBS_VERTCAPTION ) ||\
174 TestWinStyle( hwnd, IBS_HORZCAPTION ))
176 #define SETCAPTIONSIZE(h,i) (UINT)SetProp(h,wxT("ibSize"),(HANDLE)i)
177 #define GETCAPTIONSIZE(h) (UINT)GetProp(h,wxT("ibSize"))
178 #define FREECAPTIONSIZE(h) RemoveProp(h,wxT("ibSize"))
180 #define SETMENUWASUPFLAG(h,i) (UINT)SetProp(h,wxT("ibFlag"),(HANDLE)i)
181 #define GETMENUWASUPFLAG(h) (UINT)GetProp(h,wxT("ibFlag"))
182 #define FREEMENUWASUPFLAG(h) RemoveProp(h,wxT("ibFlag"))
184 /////////////////////////////////////////////////////////////////////
185 // Little known fact:
186 // ExtTextOut() is the fastest way to draw a filled rectangle
187 // in Windows (if you don't want dithered colors or borders).
189 // Unfortunately there is a bug in the Windows 3.0 8514 driver
190 // in using ExtTextOut() to a memory DC. If you are drawing
191 // to an off screen bitmap, then blitting that bitmap to the
192 // display, do not #define wxUSE_EXTTEXTOUT below.
194 // The following macro (DRAWFASTRECT) draws a filled rectangle
195 // with no border and a solid color. It uses the current back-
196 // ground color as the fill color.
197 //////////////////////////////////////////////////////////////////////
198 #define wxUSE_EXTTEXTOUT
199 #ifdef wxUSE_EXTTEXTOUT
200 #define DRAWFASTRECT(hdc,lprc) ExtTextOut(hdc,0,0,ETO_OPAQUE,lprc,NULL,0,NULL)
202 #define DRAWFASTRECT(hdc,lprc) {\
203 HBRUSH hbr = CreateSolidBrush( GetBkColor( hdc ) ) ;\
204 hbr = SelectObject(hdc, hbr) ;\
205 PatBlt(hdc,(lprc)->left,(lprc)->top,(lprc)->right-(lprc)->left,(lprc)->bottom-(lprc)->top,PATCOPY) ;\
206 hbr = SelectObject(hdc, hbr) ;\
207 DeleteObject( hbr ) ;\
211 // The DrawArrow function takes the following to indicate what
212 // kind of arrow to draw.
216 #define ARROW_RESTORE 2
218 BOOL PASCAL
DepressMinMaxButton( HWND hWnd
, UINT uiHT
, LPRECT
) ;
219 BOOL PASCAL
DoMenu( HWND hWnd
) ;
220 void PASCAL
SetupSystemMenu( HWND hWnd
, HMENU hMenu
) ;
221 BOOL PASCAL
GetCaptionRect( HWND hWnd
, LPRECT lprc
) ;
222 BOOL PASCAL
GetIconRect( HWND hWnd
, LPRECT lprc
) ;
223 BOOL PASCAL
GetButtonRect( HWND hWnd
, UINT nPos
, LPRECT lprc
) ;
224 BOOL PASCAL
GetMinButtonRect( HWND hWnd
, LPRECT lprc
) ;
225 BOOL PASCAL
GetMaxButtonRect( HWND hWnd
, LPRECT lprc
) ;
226 BOOL PASCAL
DrawCaption( HDC hDC
, HWND hWnd
, LPRECT lprc
,
227 BOOL fVert
, BOOL fSysMenu
,
228 BOOL fMin
, BOOL fMax
, BOOL fActive
) ;
229 void PASCAL
DrawSysMenu( HDC hDC
, HWND hWnd
, BOOL fInvert
) ;
230 void PASCAL
DrawButton( HDC hDC
, HWND hWnd
, BOOL fMin
, BOOL fDepressed
) ;
231 void PASCAL
DrawArrow( HDC hdc
, LPRECT lprc
, UINT uiStyle
) ;
237 ///////////////////////////////////////////////////////////////////////
238 // External/Public functions
239 ///////////////////////////////////////////////////////////////////////
241 /////////////////////////////////////////////////////////////////
242 // UINT WINAPI ibGetCaptionSize( HWND hWnd )
246 // Gets the size of the caption (height if horz, width if
251 ///////////////////////////////////////////////////////////////
252 UINT WINAPI
ibGetCaptionSize( HWND hWnd
)
254 return GETCAPTIONSIZE( hWnd
) + 1 ;
255 } // ibSetCaptionSize()
257 /////////////////////////////////////////////////////////////////
258 // UINT WINAPI ibSetCaptionSize( HWND hWnd, UINT nSize )
262 // Changes the size of the caption (height if horz, width if
267 //////////////////////////////////////////////////////////////////
268 UINT WINAPI
ibSetCaptionSize( HWND hWnd
, UINT nSize
)
276 ui
= SETCAPTIONSIZE( hWnd
, nSize
) ;
278 // Once we change the window style, we need a WM_NCCALCRECT
281 // SWP_FRAMECHANGED is not documented in the 3.1 SDK docs,
282 // but *is* in WINDOWS.H.
284 SetWindowPos( hWnd
, NULL
, 0, 0, 0, 0, SWP_FRAMECHANGED
|
285 SWP_NOSIZE
| SWP_NOMOVE
|
286 SWP_NOACTIVATE
| SWP_NOZORDER
) ;
290 } // ibSetCaptionSize()
292 /////////////////////////////////////////////////////////////////
293 // LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam )
297 // This function should be called instead of DefWindowProc() for
298 // windows that want to have itsybitsy captions.
302 //////////////////////////////////////////////////////////////////
303 LRESULT WINAPI
ibDefWindowProc( HWND hWnd
, UINT uiMsg
, WPARAM wParam
, LPARAM lParam
)
312 // was hit then pop up the menu
314 if (HASCAPTION( hWnd
) && (wParam
== VK_SPACE
))
328 DWORD dw
= GetWindowLong( hWnd
, GWL_STYLE
) ;
330 // Fool DefWindowProc into thinking we do not have
331 // a system menu. Otherwise it will try to
334 SetWindowLong( hWnd
, GWL_STYLE
, dw
&~WS_SYSMENU
) ;
335 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
336 SetWindowLong( hWnd
, GWL_STYLE
, dw
) ;
342 // The menu that is poped up for the system menu with
343 // TrackPopupMenu() sends it's notifications as WM_COMMAND
344 // messages. We need to translate these into
345 // WM_SYSCOMMAND messages. All standard WM_SYSCOMMAND
346 // ids are greater than 0xF000.
348 // This could be a possible cause of confusion if the
349 // itsybitsy window had children that used SC_MOVE or SC_CLOSE
350 // as their IDs. Take note and be careful.
352 // Also, because ibDefWindowProc looks at WM_COMMAND messages,
353 // you will need to be careful to call ibDefWindowProc() for
354 // any wm_command messages that you would normally ignore.
355 // Otherwise the system menu won't work.
357 if (wParam
>= 0xF000)
358 // Call PostMessage() here instead of SendMessage!
360 // Our menu was created by TrackPopupMenu(). TPM() does
361 // not return until after the menu has been destroyed
362 // (and thus the command associated with the menu selection
363 // sent). Therefore when we get here, we are still
364 // *inside* TPM(). If we Send WM_SYSCOMMAND, SC_CLOSE
365 // to the window, the window will be destroyed before
366 // TPM() returns to our code within DoMenu() below. Wel...
367 // We do stuff with the window handle after DoMenu()
368 // returns (namely GetProp()). Since the window has
369 // been destroyed,this is bad.
370 PostMessage( hWnd
, WM_SYSCOMMAND
, wParam
, lParam
) ;
372 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
374 case WM_GETMINMAXINFO
:
376 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
377 if (HASCAPTION( hWnd
) && TestWinStyle( hWnd
, WS_THICKFRAME
))
379 LPPOINT lppt
= (LPPOINT
)lParam
;
384 int cx
, cy
; // window frame/border width
386 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
388 cx
= GetSystemMetrics( SM_CXFRAME
) ;
389 cy
= GetSystemMetrics( SM_CYFRAME
) ;
391 else if (TestWinStyle(hWnd
, WS_BORDER
))
393 cx
= GetSystemMetrics( SM_CXBORDER
) ;
394 cy
= GetSystemMetrics( SM_CYBORDER
) ;
398 // VZ: I don't know what should be here, but the vars must
400 wxFAIL_MSG(wxT("don't know how to initialize cx, cy"));
405 GetIconRect( hWnd
, &rcMenu
) ;
406 GetMinButtonRect( hWnd
, &rcMin
) ;
407 GetMaxButtonRect( hWnd
, &rcMax
) ;
408 nX
= (rcMenu
.right
-rcMenu
.left
) +
409 (rcMin
.right
-rcMin
.left
) +
410 (rcMin
.right
-rcMin
.left
) ;
413 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
) )
415 lppt
[3].x
= nCapSize
+ cx
* 2 - 1 ;
416 lppt
[3].y
= nX
+ (2* nCapSize
) ;
420 lppt
[3].x
= nX
+ (2* nCapSize
) ;
421 lppt
[3].y
= nCapSize
+ cy
* 2 - 1 ;
424 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
428 /////////////////////////////////////////////////////////////////////
429 // Non-client area messages. These are used to allow the
430 // minature caption bar to be handled correctly.
436 // We have two things that we need to store somewhere:
437 // 1) The caption height (width).
438 // and 2) A flag indicating whether the sysmenu was
441 // CAPTIONXY is a macro that calls GetSystemMetrics.
443 SETCAPTIONSIZE( hWnd
, CAPTIONXY
) ;
445 // Set our flag that tells us whether the system menu was
448 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
450 // Are we in 3.1? If so we have some neat features
451 // we can use like rotated TrueType fonts.
453 fWin31
= (BOOL
)(LOWORD( GetVersion() ) >= 0x030A) ;
455 // If IBS_????CAPTION was specified and the WS_DLGFRAME (or
456 // WS_DLGFRAME 'cause it == WS_CAPTION | WS_BORDER)
457 // was specified the creator made a mistake. Things get really
458 // ugly if DefWindowProc sees WS_DLGFRAME, so we strip
459 // the WS_DLGFRAME part off!
461 dwStyle
= GetWindowLong( hWnd
, GWL_STYLE
) ;
462 if ((dwStyle
& IBS_VERTCAPTION
|| dwStyle
& IBS_HORZCAPTION
) &&
463 dwStyle
& WS_DLGFRAME
)
465 dwStyle
&= (DWORD
)~WS_DLGFRAME
;
466 SetWindowLong( hWnd
, GWL_STYLE
, dwStyle
) ;
469 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
472 // We store the caption size in a window prop. so we
473 // must remove props.
475 FREECAPTIONSIZE( hWnd
) ;
476 FREEMENUWASUPFLAG( hWnd
) ;
477 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
480 // This is sent when the window manager wants to find out
481 // how big our client area is to be. If we have a mini-caption
482 // then we trap this message and calculate the cleint area rect,
483 // which is the client area rect calculated by DefWindowProc()
484 // minus the width/height of the mini-caption bar
486 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
487 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
))
489 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
491 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
) )
492 ((LPRECT
)lParam
)->left
+= nCapSize
;
494 ((LPRECT
)lParam
)->top
+= nCapSize
;
499 // This message is sent whenever the mouse moves over us.
500 // We will depend on DefWindowProc for everything unless
501 // there is a mini-caption, in which case we will
502 // return HTCAPTION or HTSYSMENU. When the user clicks
503 // or double clicks, NC_LBUTTON/ message are sent with
504 // wParam equal to what we return here.
505 // This means that this is an ideal place to figure out
508 // let defwindowproc handle the standard borders etc...
510 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
511 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
) && lRet
== HTNOWHERE
)
519 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
521 // if DefWindowProc returned HTCAPTION then we have to
522 // refine the area and return HTSYSMENU if appropriate
524 pt
.x
= LOWORD( lParam
) ;
525 pt
.y
= HIWORD( lParam
) ;
527 GetCaptionRect( hWnd
, &rc
) ; // window coords
528 if (PtInRect( &rc
, pt
))
532 // rely on the fact that Get???Rect() return an invalid
533 // (empty) rectangle if the menu/buttons don't exist
535 GetIconRect( hWnd
, &rcMenu
) ;
536 GetMinButtonRect( hWnd
, &rcMinButton
) ;
537 GetMaxButtonRect( hWnd
, &rcMaxButton
) ;
539 if (PtInRect( &rcMenu
, pt
))
542 if (PtInRect( &rcMinButton
, pt
))
545 if (PtInRect( &rcMaxButton
, pt
))
549 if (lRet
!= HTSYSMENU
)
550 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
553 case WM_NCLBUTTONDBLCLK
:
554 // Windows recieve WM_NC?BUTTONDBLCLK messages whether they
555 // have CS_DBLCLKS or not. We watch for one of these
556 // to see if the user double clicked on the system menu (to
557 // close the window) or on the caption (to maximize the window).
559 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
) && wParam
== HTSYSMENU
)
561 SendMessage( hWnd
, WM_CLOSE
, 0, 0L ) ;
564 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
566 case WM_NCLBUTTONDOWN
:
570 // If we're iconic or we don't have a caption then
571 // DefWindowProc will do the job just fine.
573 if (IsIconic( hWnd
) || !HASCAPTION( hWnd
))
574 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
576 // Here's were we handle the system menu, the min and max buttons.
577 // If you wanted to change the behavior of the min/max buttons
578 // do something like swap tool palettes or something, you
579 // would change the SendMessage() calls below.
584 if (GETMENUWASUPFLAG( hWnd
) == FALSE
&& DoMenu( hWnd
))
585 SETMENUWASUPFLAG( hWnd
, TRUE
) ;
587 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
591 GetMinButtonRect( hWnd
, &rc
) ;
592 // Note that DepressMinMaxButton() goes into
593 // a PeekMessage() loop waiting for the mouse
596 if (DepressMinMaxButton( hWnd
, wParam
, &rc
))
597 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_MINIMIZE
, lParam
) ;
601 GetMaxButtonRect( hWnd
, &rc
) ;
602 // Note that DepressMinMaxButton() goes into
603 // a PeekMessage() loop waiting for the mouse
606 if (DepressMinMaxButton( hWnd
, wParam
, &rc
))
609 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_RESTORE
, lParam
) ;
611 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_MAXIMIZE
, lParam
) ;
616 // Well, it appears as though the user clicked somewhere other
617 // than the buttons. We let DefWindowProc do it's magic.
618 // This is where things like dragging and sizing the
621 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
628 if (IsIconic( hWnd
))
629 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
631 // Paint the non-client area here. We will call DefWindowProc
632 // after we are done so it can paint the borders and so
635 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
636 if (HASCAPTION( hWnd
))
640 HDC hDC
= GetWindowDC( hWnd
) ;
643 GetCaptionRect( hWnd
, &rcCap
) ; // Convert to window coords
644 GetWindowRect( hWnd
, &rc
) ;
645 OffsetRect( &rcCap
, -rc
.left
, -rc
.top
) ;
647 if (uiMsg
== WM_NCPAINT
)
648 fActive
= (hWnd
== GetActiveWindow()) ;
652 DrawCaption( hDC
, hWnd
, &rcCap
,
653 TestWinStyle(hWnd
, IBS_VERTCAPTION
),
654 TestWinStyle(hWnd
, WS_SYSMENU
),
655 TestWinStyle(hWnd
, WS_MINIMIZEBOX
),
656 TestWinStyle(hWnd
, WS_MAXIMIZEBOX
),
659 ReleaseDC( hWnd
, hDC
) ;
665 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
670 } // ibDefWindowProc()
672 // ibAdjustWindowRect( HWND hWnd, LPRECT lprc )
674 // Does the same thing as the USER function AdjustWindowRect(),
675 // but knows about itsybitsy windows. AdjustWindowRect() is
676 // bogus for stuff like this.
678 void WINAPI
ibAdjustWindowRect( HWND hWnd
, LPRECT lprc
)
680 short cx
= 0, cy
= 0 ;
683 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
685 // First check Windows's styles, then our own.
687 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
689 cx
= GetSystemMetrics( SM_CXFRAME
) ;
690 cy
= GetSystemMetrics( SM_CYFRAME
) ;
693 if (TestWinStyle(hWnd
, DS_MODALFRAME
))
695 cx
= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
696 cy
= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
699 if (TestWinStyle(hWnd
, WS_BORDER
))
701 cx
= GetSystemMetrics( SM_CXBORDER
) ;
702 cy
= GetSystemMetrics( SM_CYBORDER
) ;
705 InflateRect( lprc
, cx
, cy
) ;
707 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
708 lprc
->left
-= nCapSize
;
710 if (TestWinStyle( hWnd
, IBS_HORZCAPTION
))
711 lprc
->top
-= nCapSize
;
713 } // ibAdjustWindowRect()
716 ///////////////////////////////////////////////////////////////////////
717 // Internal functions
718 ///////////////////////////////////////////////////////////////////////
720 // DepressMinMaxButton()
722 // This function is called when the user has pressed either the min or
723 // max button (i.e. WM_NCLBUTTONDOWN). We go into a Peekmessage() loop,
724 // waiting for the mouse to come back up. This allows us to make the
725 // button change up/down state like a real button does.
727 // lprc points to the rectangle that describes the button the
728 // user has clicked on.
730 BOOL PASCAL
DepressMinMaxButton( HWND hWnd
, UINT uiHT
, LPRECT lprc
)
732 BOOL fDepressed
= TRUE
;
735 // Draw button in down state
736 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
) ;
741 if (PeekMessage((LPMSG
)&msg
, NULL
, WM_MOUSEFIRST
, WM_MOUSELAST
, PM_REMOVE
))
747 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, !fDepressed
) ;
749 return PtInRect( lprc
, msg
.pt
) ;
752 if (PtInRect( lprc
, msg
.pt
))
755 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
= TRUE
) ;
760 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
= FALSE
) ;
767 } // DepressMinMaxButton()
769 // DrawCaption( HDC hDC, HWND hWnd, LPRECT lprc,
770 // BOOL fVert, BOOL fSysMenu, BOOL fActive )
772 // This function draws an itsy bitsy caption bar with or
773 // without system menu to the dc specified by hDC. The
774 // caption is drawn to fit within the lprc RECT and is
775 // drawn//withOut/ borders.
777 BOOL PASCAL
DrawCaption( HDC hDC
, HWND hWnd
, LPRECT lprc
,
778 BOOL fVert
, BOOL fSysMenu
, BOOL fMin
,
779 BOOL fMax
, BOOL fActive
)
783 COLORREF rgbCaptionBG
;
785 COLORREF rgbWindowFrame
;
790 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
794 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
796 // if we have focus use the active caption color
797 // otherwise use the inactive caption color
801 rgbText
= GetSysColor( COLOR_CAPTIONTEXT
) ;
802 rgbCaptionBG
= GetSysColor( COLOR_ACTIVECAPTION
) ;
807 rgbText
= GetSysColor( COLOR_INACTIVECAPTIONTEXT
) ;
809 rgbText
= GetSysColor( COLOR_CAPTIONTEXT
) ;
811 rgbCaptionBG
= GetSysColor( COLOR_INACTIVECAPTION
) ;
814 SetBkMode( hDC
, TRANSPARENT
) ;
815 SelectObject( hDC
, GetStockObject( NULL_BRUSH
) ) ;
816 SelectObject( hDC
, GetStockObject( NULL_PEN
) ) ;
823 rcCap
.top
+= nCapSize
;
825 rcCap
.left
+= nCapSize
;
831 rcCap
.bottom
-= nCapSize
;
833 rcCap
.right
-= nCapSize
;
839 rcCap
.bottom
-= nCapSize
;
841 rcCap
.right
-= nCapSize
;
846 rc
.left
= lprc
->right
- 1 ;
847 rc
.right
= lprc
->right
;
849 rc
.bottom
= lprc
->bottom
;
853 rc
.left
= lprc
->left
;
854 rc
.right
= lprc
->right
;
855 rc
.bottom
= lprc
->bottom
;
856 rc
.top
= rc
.bottom
- 1 ;
859 SetBkColor( hDC
, rgbWindowFrame
) ;
860 DRAWFASTRECT( hDC
, &rc
) ;
862 hbrCaption
= CreateSolidBrush( rgbCaptionBG
) ;
863 hbrCaption
= (HBRUSH
) SelectObject( hDC
, hbrCaption
) ;
864 SelectObject( hDC
, (HPEN
) GetStockObject( NULL_PEN
) ) ;
866 Rectangle( hDC
, rcCap
.left
, rcCap
.top
, rcCap
.right
, rcCap
.bottom
+ 1 ) ;
868 Rectangle( hDC
, rcCap
.left
, rcCap
.top
, rcCap
.right
+1, rcCap
.bottom
) ;
869 hbrCaption
= (HBRUSH
) SelectObject( hDC
, hbrCaption
) ;
870 DeleteObject( hbrCaption
) ;
873 // Draw caption text here. Only do it in 3.1 'cause 3.1 gives
876 ui
= GetWindowTextLength( hWnd
) ;
887 lpsz
= (wxChar
*)GlobalAllocPtr( GHND
, (ui
+ 2) * sizeof(wxChar
) );
892 GetWindowText( hWnd
, lpsz
, ui
+ 1 ) ;
893 nBkMode
= SetBkMode( hDC
, TRANSPARENT
) ;
894 rgbText
= SetTextColor( hDC
, rgbText
) ;
896 memset( &lf
, '\0', sizeof(LOGFONT
) ) ;
898 lf
.lfHeight
= -(int)(nCapSize
- 3) ;
899 lf
.lfCharSet
= ANSI_CHARSET
;
900 lf
.lfQuality
= DEFAULT_QUALITY
;
901 lf
.lfClipPrecision
= CLIP_LH_ANGLES
| CLIP_STROKE_PRECIS
;
904 lf
.lfWeight
= FW_BOLD
;
909 // Can only rotate true type fonts (well, ok, we could
910 // try and use "modern").
911 wxStrcpy( lf
.lfFaceName
, wxT("Arial") ) ;
912 lf
.lfPitchAndFamily
= FF_SWISS
| 0x04;
913 lf
.lfEscapement
= 900 ;
915 // Note: The Win 3.1 documentation for CreateFont() say's
916 // that the lfOrientation member is ignored. It appears,
917 // that on Windows 16 3.1 this is true, but when running
918 // as a 16 bit WinApp on WindowsNT 3.1 the lfOrientation
919 // must be set or the text does not rotate!
921 lf
.lfOrientation
= 900 ;
923 hFont
= CreateFontIndirect( &lf
) ;
924 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
926 GetTextExtentPoint( hDC
, lpsz
, ui
, &Size
) ;
927 cx
= rcCap
.bottom
- ((rcCap
.bottom
- rcCap
.top
- Size
.cx
) / 2) ;
928 cy
= rcCap
.left
- 1 + ((rcCap
.right
- rcCap
.left
- Size
.cy
) / 2) ;
930 // Make sure we got a rotatable font back.
932 GetTextMetrics( hDC
, &tm
) ;
933 if (tm
.tmPitchAndFamily
& TMPF_VECTOR
||
934 tm
.tmPitchAndFamily
& TMPF_TRUETYPE
)
938 min( (long)cx
, rcCap
.bottom
),
943 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
944 DeleteObject( hFont
) ;
948 // Use small fonts always for the horizontal. Cause it looks
949 // more like "System" than Arial.
951 lf
.lfPitchAndFamily
= FF_SWISS
;
953 hFont
= CreateFontIndirect( &lf
) ;
954 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
956 GetTextExtentPoint( hDC
, lpsz
, ui
, &Size
) ;
957 cx
= rcCap
.left
+ ((rcCap
.right
- rcCap
.left
- Size
.cx
) / 2) ;
958 cy
= rcCap
.top
+ ((rcCap
.bottom
- rcCap
.top
- Size
.cy
) / 2) ;
960 // Figger out how big the string is
963 max( (long)cx
, rcCap
.left
),
968 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
969 DeleteObject( hFont
) ;
974 rgbText
= SetTextColor( hDC
, rgbText
) ;
975 SetBkMode( hDC
, nBkMode
) ;
978 GlobalFreePtr( (unsigned int)(DWORD
) lpsz
) ;
980 GlobalFreePtr( lpsz
) ;
986 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
989 DrawButton( hDC
, hWnd
, TRUE
, FALSE
) ;
992 DrawButton( hDC
, hWnd
, FALSE
, FALSE
) ;
999 // DrawSysMenu( HDC hDC, hWnd, BOOL fInvert )
1001 // Draws the little system menu icon.
1003 void PASCAL
DrawSysMenu( HDC hDC
, HWND hWnd
, BOOL fInvert
)
1008 COLORREF rgbIconFace
;
1009 COLORREF rgbWindowFrame
;
1013 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1018 hDC
= GetWindowDC( hWnd
) ;
1025 rgbIconFace
= GetNearestColor( hDC
, RGBLTGRAY
) ;
1026 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1028 GetIconRect( hWnd
, &rcIcon
) ;
1029 GetWindowRect( hWnd
, &rc
) ;
1031 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1035 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1037 rc
= rcIcon
; // separator line
1038 rc
.top
= ++rc
.bottom
- 1 ;
1042 rc
= rcIcon
; // separator line
1043 rc
.left
= ++rc
.right
- 1 ;
1047 SetBkColor( hDC
, rgbIconFace
) ;
1048 DRAWFASTRECT( hDC
, &rcTemp
) ;
1050 // Draw separator line
1051 SetBkColor( hDC
, rgbWindowFrame
) ;
1052 DRAWFASTRECT( hDC
, &rc
) ;
1056 // Draw the little horizontal doo-hickey
1058 rcTemp
.top
= rcIcon
.top
+ ((nCapSize
-1) / 2) ;
1059 rcTemp
.bottom
= rcTemp
.top
+ 3 ;
1060 rcTemp
.left
= rcTemp
.left
+ 3 ;
1061 rcTemp
.right
= rcTemp
.right
- 1 ;
1063 SetBkColor( hDC
, RGBGRAY
) ;
1064 DRAWFASTRECT( hDC
, &rcTemp
) ;
1067 OffsetRect( &rc
, -1, -1 ) ;
1068 SetBkColor( hDC
, RGBBLACK
) ;
1069 DRAWFASTRECT( hDC
, &rc
) ;
1071 InflateRect( &rc
, -1, -1 ) ;
1072 SetBkColor( hDC
, RGBWHITE
) ;
1073 DRAWFASTRECT( hDC
, &rc
) ;
1077 InvertRect( hDC
, &rcIcon
) ;
1080 ReleaseDC( hWnd
, hDC
) ;
1085 // DoMenu( HWND hWnd )
1087 // Pops up the system menu.
1089 BOOL PASCAL
DoMenu( HWND hWnd
)
1098 if (!TestWinStyle(hWnd
, WS_SYSMENU
))
1101 hDC
= GetWindowDC( hWnd
);
1106 DrawSysMenu( hDC
, hWnd
, TRUE
) ;
1110 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1121 GetIconRect( hWnd
, &rcIcon
) ;
1122 GetWindowRect( hWnd
, &rc
) ;
1123 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1125 ClientToScreen( hWnd
, &pt
) ;
1126 ClientToScreen( hWnd
, (LPPOINT
)&rc
.right
) ;
1128 dw
= GetWindowLong( hWnd
, GWL_STYLE
) ;
1129 SetWindowLong( hWnd
, GWL_STYLE
, dw
| WS_SYSMENU
) ;
1131 hMenu
= GetSystemMenu( hWnd
, FALSE
) ;
1132 SetupSystemMenu( hWnd
, hMenu
) ;
1134 SetWindowLong( hWnd
, GWL_STYLE
, dw
) ;
1136 TrackPopupMenu( hMenu
, 0, //TPM_LEFTALIGN,
1143 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
1144 ReleaseDC( hWnd
, hDC
) ;
1150 // SetupSystemMenu( HWND hWnd, HMENU hMenu )
1152 // Enables/Disables the appropriate menu items on the
1153 // menu passed for the window passed.
1155 void PASCAL
SetupSystemMenu( HWND hWnd
, HMENU hMenu
)
1163 // Assume all should be grayed.
1165 wSize
= wMove
= wMinBox
= wMaxBox
= wRestore
= MF_GRAYED
;
1167 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
) || IsIconic( hWnd
))
1168 wMaxBox
= MF_ENABLED
;
1170 if (TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1171 wMinBox
= MF_ENABLED
;
1173 if (IsZoomed( hWnd
))
1174 wRestore
= MF_ENABLED
;
1176 if (TestWinStyle( hWnd
, WS_THICKFRAME
) &&
1177 !(IsIconic( hWnd
) || IsZoomed( hWnd
)))
1178 wSize
= MF_ENABLED
;
1180 if (!IsZoomed( hWnd
) &&
1181 !IsIconic( hWnd
) &&
1182 TestWinStyle( hWnd
, WS_CAPTION
) )
1183 wMove
= MF_ENABLED
;
1185 EnableMenuItem( hMenu
, SC_MOVE
, wMove
) ;
1186 EnableMenuItem( hMenu
, SC_SIZE
, wSize
) ;
1187 EnableMenuItem( hMenu
, SC_MINIMIZE
, wMinBox
) ;
1188 EnableMenuItem( hMenu
, SC_MAXIMIZE
, wMaxBox
) ;
1189 EnableMenuItem( hMenu
, SC_RESTORE
, wRestore
) ;
1191 } // SetupSystemMenu()
1193 // GetCaptionRect( HWND hWnd, LPRECT lprc )
1195 // calcluales the rectangle of the mini-caption in screen coords.
1197 BOOL PASCAL
GetCaptionRect( HWND hWnd
, LPRECT lprc
)
1201 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1203 if (!HASCAPTION( hWnd
))
1205 SetRectEmpty( lprc
) ;
1209 GetWindowRect( hWnd
, lprc
) ;
1211 // the window might have other non-client components like
1214 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
1216 lprc
->left
+= GetSystemMetrics( SM_CXFRAME
) ;
1217 lprc
->top
+= GetSystemMetrics( SM_CYFRAME
) ;
1218 lprc
->right
-= GetSystemMetrics( SM_CXFRAME
) ;
1219 lprc
->bottom
-= GetSystemMetrics( SM_CYFRAME
) ;
1222 if (TestWinStyle( hWnd
, DS_MODALFRAME
)) // if it's a dialog box
1224 lprc
->left
+= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1225 lprc
->top
+= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1226 lprc
->right
-= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1227 lprc
->bottom
-= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1230 if (TestWinStyle( hWnd
, WS_BORDER
))
1232 lprc
->left
+= GetSystemMetrics( SM_CXBORDER
) ;
1233 lprc
->top
+= GetSystemMetrics( SM_CYBORDER
) ;
1234 lprc
->right
-= GetSystemMetrics( SM_CXBORDER
) ;
1235 lprc
->bottom
-= GetSystemMetrics( SM_CYBORDER
) ;
1238 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1239 lprc
->right
= lprc
->left
+ nCapSize
;
1241 lprc
->bottom
= lprc
->top
+ nCapSize
;
1244 } // GetCaptionRect()
1246 // GetIconRect( HWND hWnd, LPRECT lprc )
1248 // Calculates the rect of the icon in screen coordinates.
1250 BOOL PASCAL
GetIconRect( HWND hWnd
, LPRECT lprc
)
1255 fMenu
= TestWinStyle( hWnd
, WS_SYSMENU
) ;
1256 fVert
= TestWinStyle( hWnd
, IBS_VERTCAPTION
) ;
1258 if (!GetCaptionRect( hWnd
, lprc
)) // window coords
1263 SetRectEmpty( lprc
) ;
1267 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1270 lprc
->bottom
= lprc
->top
+ nCapSize
;
1272 lprc
->right
= lprc
->left
+ nCapSize
;
1281 // GetMinButtonRect()
1283 // Calculates the rect of the minimize button in screen
1286 // For horizontal captions, we have the following situation ('Y' is minimize
1287 // and '^' is maximize or restore):
1289 // +---------------------------------+
1291 // +---------------------------------+
1292 // | |.......| <-- This is the width (nSize)
1294 // For vertical captions, we have the following:
1304 // |--| . <-- This is the height of the rectangle (nSize)
1308 // In order to figure out where the minimize button goes, we first need
1309 // to know if there is a maximize button. If so, use GetMaxButtonRect()
1312 BOOL PASCAL
GetMinButtonRect( HWND hWnd
, LPRECT lprc
)
1314 if (!TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1316 SetRectEmpty( lprc
) ;
1320 // The minimize button can be in either position 1 or 2. If there
1321 // is a maximize button, it's in position 2.
1323 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1324 return GetButtonRect( hWnd
, 2, lprc
) ;
1326 return GetButtonRect( hWnd
, 1, lprc
) ;
1329 // GetMaxButtonRect()
1331 // Calculates the rect of the maximize button in screen
1334 // The maximize button, if present, is always to the far right
1337 BOOL PASCAL
GetMaxButtonRect( HWND hWnd
, LPRECT lprc
)
1339 //The maximize button can only be in position 1.
1341 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1342 return GetButtonRect( hWnd
, 1, lprc
) ;
1345 SetRectEmpty( lprc
) ;
1350 // Get the rect where a button would go.
1352 // This function does not care if it's a min or max, just whether
1353 // it is the first from the right/bottom or second from the right/bottom
1356 BOOL PASCAL
GetButtonRect( HWND hWnd
, UINT nPos
, LPRECT lprc
)
1360 if (!GetCaptionRect( hWnd
, lprc
)) //window coords
1363 nSize
= GETCAPTIONSIZE( hWnd
) ;
1365 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1367 lprc
->bottom
-= nSize
* (nPos
-1) ;
1368 lprc
->top
= lprc
->bottom
- nSize
+ 1 ;
1372 lprc
->right
-= nSize
* (nPos
-1) ;
1373 lprc
->left
= lprc
->right
- nSize
+ 1 ;
1377 } // GetButtonRect()
1379 // DrawButton( HDC hDC, HWND hWnd, BOOL fMin, BOOL fDepressed )
1381 // Draws either the min, max, or restore buttons. If fMin is FALSE then it
1382 // will draw either the Max or Restore button. If fDepressed is TRUE it will
1383 // draw the button in a down state.
1385 void PASCAL
DrawButton( HDC hDC
, HWND hWnd
, BOOL fMin
, BOOL fDepressed
)
1389 COLORREF rgbWindowFrame
;
1395 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1397 // If you look at the standard Windows' min/max buttons, you will notice
1398 // that they have two pixels of 'shadow' to the bottom and right. Since
1399 // our buttons can be really, really small, we only want one pixel of
1400 // shadow when they are small. I arbitrarily decided that if the
1401 // caption size is greater than or equal to 20 we will use two
1402 // pixels. That's what this THREASHOLD stuff does.
1404 #define THRESHOLD 20
1405 nOffset
= (nCapSize
>= THRESHOLD
) ? 2 : 1 ;
1410 hDC
= GetWindowDC( hWnd
) ;
1417 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1420 GetMinButtonRect( hWnd
, &rcButton
) ;
1422 GetMaxButtonRect( hWnd
, &rcButton
) ;
1424 GetWindowRect( hWnd
, &rc
) ;
1425 OffsetRect( &rcButton
, -rc
.left
, -rc
.top
) ;
1428 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1430 rc
= rcButton
; //separator line
1431 rc
.bottom
= --rc
.top
+ 1 ;
1436 rc
= rcButton
; //separator line
1437 rc
.right
= --rc
.left
+ 1 ;
1441 //Draw separator line
1442 SetBkColor( hDC
, rgbWindowFrame
) ;
1443 DRAWFASTRECT( hDC
, &rc
) ;
1446 SetBkColor( hDC
, RGBLTGRAY
) ;
1447 DRAWFASTRECT( hDC
, &rcButton
) ;
1451 //The normal min/max buttons have one pixel on the top and left
1452 //sides for the highlight, and two pixels on the bottom and
1453 //right side for the shadow.
1455 //When our caption is 'small' we only use one pixel on all
1458 SetBkColor( hDC
, RGBWHITE
) ;
1461 rc
.right
= rc
.left
+ 1 ;
1462 DRAWFASTRECT( hDC
, &rc
) ;
1466 rc
.bottom
= rc
.top
+ 1 ;
1467 DRAWFASTRECT( hDC
, &rc
) ;
1469 SetBkColor( hDC
, RGBGRAY
) ;
1472 rc
.left
= rc
.right
- 1 ;
1473 DRAWFASTRECT( hDC
, &rc
) ;
1474 if (nCapSize
> THRESHOLD
)
1478 DRAWFASTRECT( hDC
, &rc
) ;
1483 rc
.top
= rc
.bottom
- 1 ;
1484 DRAWFASTRECT( hDC
, &rc
) ;
1485 if (nCapSize
> THRESHOLD
)
1489 DRAWFASTRECT( hDC
, &rc
) ;
1494 rcButton
.right
-= nOffset
;
1495 rcButton
.bottom
-= nOffset
;
1499 //Draw depressed state
1501 SetBkColor( hDC
, RGBGRAY
) ;
1504 rc
.right
= rc
.left
+ nOffset
;
1505 DRAWFASTRECT( hDC
, &rc
) ;
1509 rc
.bottom
= rc
.top
+ nOffset
;
1510 DRAWFASTRECT( hDC
, &rc
) ;
1512 rcButton
.left
+= 2 * nOffset
;
1513 rcButton
.top
+= 2 * nOffset
;
1516 // Now draw the arrows. We do not want the
1517 // arrows to grow too large when we have a bigger than
1518 // normal caption, so we restrict their size.
1520 // rcButton now represents where we can place our
1523 // The maximum size of our arrows (i.e. the width of rcButton)
1524 // has been empirically determined to be SM_CYCAPTION / 2
1526 n
= ((GetSystemMetrics( SM_CYCAPTION
)) / 2) -
1527 (rcButton
.right
- rcButton
.left
) ;
1529 InflateRect( &rcButton
, n
/2-1, n
/2-1 ) ;
1532 DrawArrow( hDC
, &rcButton
, ARROW_DOWN
) ;
1534 if (IsZoomed( hWnd
))
1536 DrawArrow( hDC
, &rcButton
, ARROW_RESTORE
) ;
1539 DrawArrow( hDC
, &rcButton
, ARROW_UP
) ;
1542 ReleaseDC( hWnd
, hDC
) ;
1550 // Draws either a up or down arrow. The arrow is bound by the rectangle
1552 void PASCAL
DrawArrow( HDC hdc
, LPRECT lprc
, UINT uiStyle
)
1558 int nMax
= (lprc
->bottom
- lprc
->top
) >> 1 ;
1560 SetBkColor( hdc
, RGBBLACK
) ;
1562 // We draw the arrow by drawing a series of horizontal lines
1564 xTip
= lprc
->left
+ ((lprc
->right
- lprc
->left
+1) >> 1) ;
1568 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1569 for (row
= 1 ; row
<= nMax
; row
++ )
1571 rc
.left
= xTip
- row
;
1572 rc
.right
= xTip
+ row
- 1 ;
1573 rc
.top
= yTip
+ row
;
1574 rc
.bottom
= rc
.top
+ 1 ;
1575 DRAWFASTRECT( hdc
, &rc
) ;
1580 yTip
= lprc
->bottom
- ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1581 for ( row
= nMax
; row
> 0 ; row
-- )
1583 rc
.left
= xTip
- row
;
1584 rc
.right
= xTip
+ row
- 1 ;
1585 rc
.top
= yTip
- row
;
1586 rc
.bottom
= rc
.top
+ 1 ;
1587 DRAWFASTRECT( hdc
, &rc
) ;
1593 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 3) - 2;
1594 for (row
= 1 ; row
<= nMax
; row
++ )
1596 rc
.left
= xTip
- row
;
1597 rc
.right
= xTip
+ row
- 1 ;
1598 rc
.top
= yTip
+ row
;
1599 rc
.bottom
= rc
.top
+ 1 ;
1600 DRAWFASTRECT( hdc
, &rc
) ;
1603 yTip
+= (nMax
+1) * 2 ;
1604 for ( row
= nMax
; row
> 0 ; row
-- )
1606 rc
.left
= xTip
- row
;
1607 rc
.right
= xTip
+ row
- 1 ;
1608 rc
.top
= yTip
- row
;
1609 rc
.bottom
= rc
.top
+ 1 ;
1610 DRAWFASTRECT( hdc
, &rc
) ;
1617 #endif // wxUSE_ITSY_BITSY