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"
36 #include "wx/minifram.h"
38 IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame
, wxFrame
)
46 #include "wx/minifram.h"
49 #ifdef __GNUWIN32_OLD__
50 #include "wx/msw/gnuwin32/extra.h"
54 IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame
, wxFrame
)
56 long wxMiniFrame::MSWDefWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
58 if ((GetWindowStyleFlag() & wxTINY_CAPTION_HORIZ
) ||
59 (GetWindowStyleFlag() & wxTINY_CAPTION_VERT
))
60 return ::ibDefWindowProc((HWND
) GetHWND(), nMsg
, wParam
, lParam
);
61 else if ( m_oldWndProc
)
62 return ::CallWindowProc(CASTWNDPROC m_oldWndProc
, (HWND
) GetHWND(), (UINT
) nMsg
, (WPARAM
) wParam
, (LPARAM
) lParam
);
64 return ::DefWindowProc((HWND
) GetHWND(), nMsg
, wParam
, lParam
);
67 wxMiniFrame::~wxMiniFrame(void)
71 /////////////////////////////////////////////////////////////////////////
73 // Project: ItsyBitsy window support module
77 // ItsyBitsy is a support module that allows you to create windows
78 // that look and act very much like a popup window witha system
79 // menu and caption bar, except everything is scaled to about 2/3
82 // For documentation on how to use ItsyBits, read the document
86 // 9/27/91 Charlie Kindel (cek/ckindel)
87 // Wrote and documented it.
90 // 2/23/93 cek Added minimize/maximize buttons.
91 // 3/18/93 cek Fixed system menu bug where system menu
92 // popped back up if you clicked on the
93 // icon again while it was up.
94 // 3/24/93 cek More comments. Fixed DS_MODALDIALOG style
95 // problem. Use auto precompiled headers
98 //////////////////////////////////////////////////////////////////////////
100 #include "wx/window.h"
101 #include "wx/msw/private.h"
105 #if !defined( __WATCOMC__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__)
114 // Some mildly useful macros for the standard 16 colors
115 #define RGBBLACK RGB(0,0,0)
116 #define RGBRED RGB(128,0,0)
117 #define RGBGREEN RGB(0,128,0)
118 #define RGBBLUE RGB(0,0,128)
120 #define RGBBROWN RGB(128,128,0)
121 #define RGBMAGENTA RGB(128,0,128)
122 #define RGBCYAN RGB(0,128,128)
123 #define RGBLTGRAY RGB(192,192,192)
125 #define RGBGRAY RGB(128,128,128)
126 #define RGBLTRED RGB(255,0,0)
127 #define RGBLTGREEN RGB(0,255,0)
128 #define RGBLTBLUE RGB(0,0,255)
130 #define RGBYELLOW RGB(255,255,0)
131 #define RGBLTMAGENTA RGB(255,0,255)
132 #define RGBLTCYAN RGB(0,255,255)
133 #define RGBWHITE RGB(255,255,255)
136 #ifndef GlobalAllocPtr
137 #define GlobalPtrHandle(lp) \
138 ((HGLOBAL)GlobalHandle(lp))
140 #define GlobalLockPtr(lp) \
141 ((BOOL)GlobalLock(GlobalPtrHandle(lp)))
142 #define GlobalUnlockPtr(lp) \
143 GlobalUnlock(GlobalPtrHandle(lp))
145 #define GlobalAllocPtr(flags, cb) \
146 (GlobalLock(GlobalAlloc((flags), (cb))))
147 #define GlobalReAllocPtr(lp, cbNew, flags) \
148 (GlobalUnlockPtr(lp), GlobalLock(GlobalReAlloc(GlobalPtrHandle(lp) , (cbNew), (flags))))
149 #define GlobalFreePtr(lp) \
150 (GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp)))
153 #if defined(__BORLANDC__) || defined(__WATCOMC__)
154 #define max(a,b) (((a) > (b)) ? (a) : (b))
155 #define min(a,b) (((a) < (b)) ? (a) : (b))
158 // CAPTIONXY is the default size of the system menu icon. This
159 // determines the height/width of the caption.
161 // The value that results from the following formula works out
162 // nicely for the veritcal caption on VGA, 8514 (Large Fonts),
163 // 8514 (Small Fonts), XGA (Small Fonts), XGA (Large Fonts),
164 // and TIGA (Small Fonts). It may not be good on other displays.
166 // The problem is that TT fonts turn into bitmap fonts when they
167 // are sized below a certain threshold. The idea is to make the
168 // size of the caption just big enough to get the smallest TT
169 // (scalable) font to fit.
171 #define CAPTIONXY (GetSystemMetrics( SM_CYCAPTION ) / 2 + 1)
173 #define TestWinStyle( hWnd, dwStyleBit ) \
174 (((DWORD)GetWindowLong( hWnd, GWL_STYLE ) & (DWORD)dwStyleBit) ? TRUE : FALSE )
175 #define HASCAPTION( hwnd ) (TestWinStyle( hwnd, IBS_VERTCAPTION ) ||\
176 TestWinStyle( hwnd, IBS_HORZCAPTION ))
178 #define SETCAPTIONSIZE(h,i) (UINT)SetProp(h,wxT("ibSize"),(HANDLE)i)
179 #define GETCAPTIONSIZE(h) (UINT)GetProp(h,wxT("ibSize"))
180 #define FREECAPTIONSIZE(h) RemoveProp(h,wxT("ibSize"))
182 #define SETMENUWASUPFLAG(h,i) (UINT)SetProp(h,wxT("ibFlag"),(HANDLE)i)
183 #define GETMENUWASUPFLAG(h) (UINT)GetProp(h,wxT("ibFlag"))
184 #define FREEMENUWASUPFLAG(h) RemoveProp(h,wxT("ibFlag"))
186 /////////////////////////////////////////////////////////////////////
187 // Little known fact:
188 // ExtTextOut() is the fastest way to draw a filled rectangle
189 // in Windows (if you don't want dithered colors or borders).
191 // Unfortunately there is a bug in the Windows 3.0 8514 driver
192 // in using ExtTextOut() to a memory DC. If you are drawing
193 // to an off screen bitmap, then blitting that bitmap to the
194 // display, do not #define wxUSE_EXTTEXTOUT below.
196 // The following macro (DRAWFASTRECT) draws a filled rectangle
197 // with no border and a solid color. It uses the current back-
198 // ground color as the fill color.
199 //////////////////////////////////////////////////////////////////////
200 #define wxUSE_EXTTEXTOUT
201 #ifdef wxUSE_EXTTEXTOUT
202 #define DRAWFASTRECT(hdc,lprc) ExtTextOut(hdc,0,0,ETO_OPAQUE,lprc,NULL,0,NULL)
204 #define DRAWFASTRECT(hdc,lprc) {\
205 HBRUSH hbr = CreateSolidBrush( GetBkColor( hdc ) ) ;\
206 hbr = SelectObject(hdc, hbr) ;\
207 PatBlt(hdc,(lprc)->left,(lprc)->top,(lprc)->right-(lprc)->left,(lprc)->bottom-(lprc)->top,PATCOPY) ;\
208 hbr = SelectObject(hdc, hbr) ;\
209 DeleteObject( hbr ) ;\
213 // The DrawArrow function takes the following to indicate what
214 // kind of arrow to draw.
218 #define ARROW_RESTORE 2
220 BOOL PASCAL
DepressMinMaxButton( HWND hWnd
, UINT uiHT
, LPRECT
) ;
221 BOOL PASCAL
DoMenu( HWND hWnd
) ;
222 void PASCAL
SetupSystemMenu( HWND hWnd
, HMENU hMenu
) ;
223 BOOL PASCAL
GetCaptionRect( HWND hWnd
, LPRECT lprc
) ;
224 BOOL PASCAL
GetIconRect( HWND hWnd
, LPRECT lprc
) ;
225 BOOL PASCAL
GetButtonRect( HWND hWnd
, UINT nPos
, LPRECT lprc
) ;
226 BOOL PASCAL
GetMinButtonRect( HWND hWnd
, LPRECT lprc
) ;
227 BOOL PASCAL
GetMaxButtonRect( HWND hWnd
, LPRECT lprc
) ;
228 BOOL PASCAL
DrawCaption( HDC hDC
, HWND hWnd
, LPRECT lprc
,
229 BOOL fVert
, BOOL fSysMenu
,
230 BOOL fMin
, BOOL fMax
, BOOL fActive
) ;
231 void PASCAL
DrawSysMenu( HDC hDC
, HWND hWnd
, BOOL fInvert
) ;
232 void PASCAL
DrawButton( HDC hDC
, HWND hWnd
, BOOL fMin
, BOOL fDepressed
) ;
233 void PASCAL
DrawArrow( HDC hdc
, LPRECT lprc
, UINT uiStyle
) ;
239 ///////////////////////////////////////////////////////////////////////
240 // External/Public functions
241 ///////////////////////////////////////////////////////////////////////
243 /////////////////////////////////////////////////////////////////
244 // UINT WINAPI ibGetCaptionSize( HWND hWnd )
248 // Gets the size of the caption (height if horz, width if
253 ///////////////////////////////////////////////////////////////
254 UINT WINAPI
ibGetCaptionSize( HWND hWnd
)
256 return GETCAPTIONSIZE( hWnd
) + 1 ;
257 } // ibSetCaptionSize()
259 /////////////////////////////////////////////////////////////////
260 // UINT WINAPI ibSetCaptionSize( HWND hWnd, UINT nSize )
264 // Changes the size of the caption (height if horz, width if
269 //////////////////////////////////////////////////////////////////
270 UINT WINAPI
ibSetCaptionSize( HWND hWnd
, UINT nSize
)
278 ui
= SETCAPTIONSIZE( hWnd
, nSize
) ;
280 // Once we change the window style, we need a WM_NCCALCRECT
283 // SWP_FRAMECHANGED is not documented in the 3.1 SDK docs,
284 // but *is* in WINDOWS.H.
286 SetWindowPos( hWnd
, NULL
, 0, 0, 0, 0, SWP_FRAMECHANGED
|
287 SWP_NOSIZE
| SWP_NOMOVE
|
288 SWP_NOACTIVATE
| SWP_NOZORDER
) ;
292 } // ibSetCaptionSize()
294 /////////////////////////////////////////////////////////////////
295 // LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam )
299 // This function should be called instead of DefWindowProc() for
300 // windows that want to have itsybitsy captions.
304 //////////////////////////////////////////////////////////////////
305 LRESULT WINAPI
ibDefWindowProc( HWND hWnd
, UINT uiMsg
, WPARAM wParam
, LPARAM lParam
)
314 // was hit then pop up the menu
316 if (HASCAPTION( hWnd
) && (wParam
== VK_SPACE
))
330 DWORD dw
= GetWindowLong( hWnd
, GWL_STYLE
) ;
332 // Fool DefWindowProc into thinking we do not have
333 // a system menu. Otherwise it will try to
336 SetWindowLong( hWnd
, GWL_STYLE
, dw
&~WS_SYSMENU
) ;
337 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
338 SetWindowLong( hWnd
, GWL_STYLE
, dw
) ;
344 // The menu that is poped up for the system menu with
345 // TrackPopupMenu() sends it's notifications as WM_COMMAND
346 // messages. We need to translate these into
347 // WM_SYSCOMMAND messages. All standard WM_SYSCOMMAND
348 // ids are greater than 0xF000.
350 // This could be a possible cause of confusion if the
351 // itsybitsy window had children that used SC_MOVE or SC_CLOSE
352 // as their IDs. Take note and be careful.
354 // Also, because ibDefWindowProc looks at WM_COMMAND messages,
355 // you will need to be careful to call ibDefWindowProc() for
356 // any wm_command messages that you would normally ignore.
357 // Otherwise the system menu won't work.
359 if (wParam
>= 0xF000)
360 // Call PostMessage() here instead of SendMessage!
362 // Our menu was created by TrackPopupMenu(). TPM() does
363 // not return until after the menu has been destroyed
364 // (and thus the command associated with the menu selection
365 // sent). Therefore when we get here, we are still
366 // *inside* TPM(). If we Send WM_SYSCOMMAND, SC_CLOSE
367 // to the window, the window will be destroyed before
368 // TPM() returns to our code within DoMenu() below. Wel...
369 // We do stuff with the window handle after DoMenu()
370 // returns (namely GetProp()). Since the window has
371 // been destroyed,this is bad.
372 PostMessage( hWnd
, WM_SYSCOMMAND
, wParam
, lParam
) ;
374 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
376 case WM_GETMINMAXINFO
:
378 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
379 if (HASCAPTION( hWnd
) && TestWinStyle( hWnd
, WS_THICKFRAME
))
381 LPPOINT lppt
= (LPPOINT
)lParam
;
386 int cx
, cy
; // window frame/border width
388 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
390 cx
= GetSystemMetrics( SM_CXFRAME
) ;
391 cy
= GetSystemMetrics( SM_CYFRAME
) ;
393 else if (TestWinStyle(hWnd
, WS_BORDER
))
395 cx
= GetSystemMetrics( SM_CXBORDER
) ;
396 cy
= GetSystemMetrics( SM_CYBORDER
) ;
400 // VZ: I don't know what should be here, but the vars must
402 wxFAIL_MSG(wxT("don't know how to initialize cx, cy"));
407 GetIconRect( hWnd
, &rcMenu
) ;
408 GetMinButtonRect( hWnd
, &rcMin
) ;
409 GetMaxButtonRect( hWnd
, &rcMax
) ;
410 nX
= (rcMenu
.right
-rcMenu
.left
) +
411 (rcMin
.right
-rcMin
.left
) +
412 (rcMin
.right
-rcMin
.left
) ;
415 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
) )
417 lppt
[3].x
= nCapSize
+ cx
* 2 - 1 ;
418 lppt
[3].y
= nX
+ (2* nCapSize
) ;
422 lppt
[3].x
= nX
+ (2* nCapSize
) ;
423 lppt
[3].y
= nCapSize
+ cy
* 2 - 1 ;
426 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
430 /////////////////////////////////////////////////////////////////////
431 // Non-client area messages. These are used to allow the
432 // minature caption bar to be handled correctly.
438 // We have two things that we need to store somewhere:
439 // 1) The caption height (width).
440 // and 2) A flag indicating whether the sysmenu was
443 // CAPTIONXY is a macro that calls GetSystemMetrics.
445 SETCAPTIONSIZE( hWnd
, CAPTIONXY
) ;
447 // Set our flag that tells us whether the system menu was
450 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
452 // Are we in 3.1? If so we have some neat features
453 // we can use like rotated TrueType fonts.
455 fWin31
= (BOOL
)(LOWORD( GetVersion() ) >= 0x030A) ;
457 // If IBS_????CAPTION was specified and the WS_DLGFRAME (or
458 // WS_DLGFRAME 'cause it == WS_CAPTION | WS_BORDER)
459 // was specified the creator made a mistake. Things get really
460 // ugly if DefWindowProc sees WS_DLGFRAME, so we strip
461 // the WS_DLGFRAME part off!
463 dwStyle
= GetWindowLong( hWnd
, GWL_STYLE
) ;
464 if ((dwStyle
& IBS_VERTCAPTION
|| dwStyle
& IBS_HORZCAPTION
) &&
465 dwStyle
& WS_DLGFRAME
)
467 dwStyle
&= (DWORD
)~WS_DLGFRAME
;
468 SetWindowLong( hWnd
, GWL_STYLE
, dwStyle
) ;
471 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
474 // We store the caption size in a window prop. so we
475 // must remove props.
477 FREECAPTIONSIZE( hWnd
) ;
478 FREEMENUWASUPFLAG( hWnd
) ;
479 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
482 // This is sent when the window manager wants to find out
483 // how big our client area is to be. If we have a mini-caption
484 // then we trap this message and calculate the cleint area rect,
485 // which is the client area rect calculated by DefWindowProc()
486 // minus the width/height of the mini-caption bar
488 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
489 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
))
491 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
493 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
) )
494 ((LPRECT
)lParam
)->left
+= nCapSize
;
496 ((LPRECT
)lParam
)->top
+= nCapSize
;
501 // This message is sent whenever the mouse moves over us.
502 // We will depend on DefWindowProc for everything unless
503 // there is a mini-caption, in which case we will
504 // return HTCAPTION or HTSYSMENU. When the user clicks
505 // or double clicks, NC_LBUTTON/ message are sent with
506 // wParam equal to what we return here.
507 // This means that this is an ideal place to figure out
510 // let defwindowproc handle the standard borders etc...
512 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
513 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
) && lRet
== HTNOWHERE
)
521 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
523 // if DefWindowProc returned HTCAPTION then we have to
524 // refine the area and return HTSYSMENU if appropriate
526 pt
.x
= LOWORD( lParam
) ;
527 pt
.y
= HIWORD( lParam
) ;
529 GetCaptionRect( hWnd
, &rc
) ; // window coords
530 if (PtInRect( &rc
, pt
))
534 // rely on the fact that Get???Rect() return an invalid
535 // (empty) rectangle if the menu/buttons don't exist
537 GetIconRect( hWnd
, &rcMenu
) ;
538 GetMinButtonRect( hWnd
, &rcMinButton
) ;
539 GetMaxButtonRect( hWnd
, &rcMaxButton
) ;
541 if (PtInRect( &rcMenu
, pt
))
544 if (PtInRect( &rcMinButton
, pt
))
547 if (PtInRect( &rcMaxButton
, pt
))
551 if (lRet
!= HTSYSMENU
)
552 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
555 case WM_NCLBUTTONDBLCLK
:
556 // Windows recieve WM_NC?BUTTONDBLCLK messages whether they
557 // have CS_DBLCLKS or not. We watch for one of these
558 // to see if the user double clicked on the system menu (to
559 // close the window) or on the caption (to maximize the window).
561 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
) && wParam
== HTSYSMENU
)
563 SendMessage( hWnd
, WM_CLOSE
, 0, 0L ) ;
566 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
568 case WM_NCLBUTTONDOWN
:
572 // If we're iconic or we don't have a caption then
573 // DefWindowProc will do the job just fine.
575 if (IsIconic( hWnd
) || !HASCAPTION( hWnd
))
576 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
578 // Here's were we handle the system menu, the min and max buttons.
579 // If you wanted to change the behavior of the min/max buttons
580 // do something like swap tool palettes or something, you
581 // would change the SendMessage() calls below.
586 if (GETMENUWASUPFLAG( hWnd
) == FALSE
&& DoMenu( hWnd
))
587 SETMENUWASUPFLAG( hWnd
, TRUE
) ;
589 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
593 GetMinButtonRect( hWnd
, &rc
) ;
594 // Note that DepressMinMaxButton() goes into
595 // a PeekMessage() loop waiting for the mouse
598 if (DepressMinMaxButton( hWnd
, wParam
, &rc
))
599 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_MINIMIZE
, lParam
) ;
603 GetMaxButtonRect( hWnd
, &rc
) ;
604 // Note that DepressMinMaxButton() goes into
605 // a PeekMessage() loop waiting for the mouse
608 if (DepressMinMaxButton( hWnd
, wParam
, &rc
))
611 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_RESTORE
, lParam
) ;
613 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_MAXIMIZE
, lParam
) ;
618 // Well, it appears as though the user clicked somewhere other
619 // than the buttons. We let DefWindowProc do it's magic.
620 // This is where things like dragging and sizing the
623 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
630 if (IsIconic( hWnd
))
631 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
633 // Paint the non-client area here. We will call DefWindowProc
634 // after we are done so it can paint the borders and so
637 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
638 if (HASCAPTION( hWnd
))
642 HDC hDC
= GetWindowDC( hWnd
) ;
645 GetCaptionRect( hWnd
, &rcCap
) ; // Convert to window coords
646 GetWindowRect( hWnd
, &rc
) ;
647 OffsetRect( &rcCap
, -rc
.left
, -rc
.top
) ;
649 if (uiMsg
== WM_NCPAINT
)
650 fActive
= (hWnd
== GetActiveWindow()) ;
654 DrawCaption( hDC
, hWnd
, &rcCap
,
655 TestWinStyle(hWnd
, IBS_VERTCAPTION
),
656 TestWinStyle(hWnd
, WS_SYSMENU
),
657 TestWinStyle(hWnd
, WS_MINIMIZEBOX
),
658 TestWinStyle(hWnd
, WS_MAXIMIZEBOX
),
661 ReleaseDC( hWnd
, hDC
) ;
667 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
672 } // ibDefWindowProc()
674 // ibAdjustWindowRect( HWND hWnd, LPRECT lprc )
676 // Does the same thing as the USER function AdjustWindowRect(),
677 // but knows about itsybitsy windows. AdjustWindowRect() is
678 // bogus for stuff like this.
680 void WINAPI
ibAdjustWindowRect( HWND hWnd
, LPRECT lprc
)
682 short cx
= 0, cy
= 0 ;
685 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
687 // First check Windows's styles, then our own.
689 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
691 cx
= GetSystemMetrics( SM_CXFRAME
) ;
692 cy
= GetSystemMetrics( SM_CYFRAME
) ;
695 if (TestWinStyle(hWnd
, DS_MODALFRAME
))
697 cx
= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
698 cy
= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
701 if (TestWinStyle(hWnd
, WS_BORDER
))
703 cx
= GetSystemMetrics( SM_CXBORDER
) ;
704 cy
= GetSystemMetrics( SM_CYBORDER
) ;
707 InflateRect( lprc
, cx
, cy
) ;
709 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
710 lprc
->left
-= nCapSize
;
712 if (TestWinStyle( hWnd
, IBS_HORZCAPTION
))
713 lprc
->top
-= nCapSize
;
715 } // ibAdjustWindowRect()
718 ///////////////////////////////////////////////////////////////////////
719 // Internal functions
720 ///////////////////////////////////////////////////////////////////////
722 // DepressMinMaxButton()
724 // This function is called when the user has pressed either the min or
725 // max button (i.e. WM_NCLBUTTONDOWN). We go into a Peekmessage() loop,
726 // waiting for the mouse to come back up. This allows us to make the
727 // button change up/down state like a real button does.
729 // lprc points to the rectangle that describes the button the
730 // user has clicked on.
732 BOOL PASCAL
DepressMinMaxButton( HWND hWnd
, UINT uiHT
, LPRECT lprc
)
734 BOOL fDepressed
= TRUE
;
737 // Draw button in down state
738 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
) ;
743 if (PeekMessage((LPMSG
)&msg
, NULL
, WM_MOUSEFIRST
, WM_MOUSELAST
, PM_REMOVE
))
749 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, !fDepressed
) ;
751 return PtInRect( lprc
, msg
.pt
) ;
754 if (PtInRect( lprc
, msg
.pt
))
757 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
= TRUE
) ;
762 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
= FALSE
) ;
769 } // DepressMinMaxButton()
771 // DrawCaption( HDC hDC, HWND hWnd, LPRECT lprc,
772 // BOOL fVert, BOOL fSysMenu, BOOL fActive )
774 // This function draws an itsy bitsy caption bar with or
775 // without system menu to the dc specified by hDC. The
776 // caption is drawn to fit within the lprc RECT and is
777 // drawn//withOut/ borders.
779 BOOL PASCAL
DrawCaption( HDC hDC
, HWND hWnd
, LPRECT lprc
,
780 BOOL fVert
, BOOL fSysMenu
, BOOL fMin
,
781 BOOL fMax
, BOOL fActive
)
785 COLORREF rgbCaptionBG
;
787 COLORREF rgbWindowFrame
;
792 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
796 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
798 // if we have focus use the active caption color
799 // otherwise use the inactive caption color
803 rgbText
= GetSysColor( COLOR_CAPTIONTEXT
) ;
804 rgbCaptionBG
= GetSysColor( COLOR_ACTIVECAPTION
) ;
809 rgbText
= GetSysColor( COLOR_INACTIVECAPTIONTEXT
) ;
811 rgbText
= GetSysColor( COLOR_CAPTIONTEXT
) ;
813 rgbCaptionBG
= GetSysColor( COLOR_INACTIVECAPTION
) ;
816 SetBkMode( hDC
, TRANSPARENT
) ;
817 SelectObject( hDC
, GetStockObject( NULL_BRUSH
) ) ;
818 SelectObject( hDC
, GetStockObject( NULL_PEN
) ) ;
825 rcCap
.top
+= nCapSize
;
827 rcCap
.left
+= nCapSize
;
833 rcCap
.bottom
-= nCapSize
;
835 rcCap
.right
-= nCapSize
;
841 rcCap
.bottom
-= nCapSize
;
843 rcCap
.right
-= nCapSize
;
848 rc
.left
= lprc
->right
- 1 ;
849 rc
.right
= lprc
->right
;
851 rc
.bottom
= lprc
->bottom
;
855 rc
.left
= lprc
->left
;
856 rc
.right
= lprc
->right
;
857 rc
.bottom
= lprc
->bottom
;
858 rc
.top
= rc
.bottom
- 1 ;
861 SetBkColor( hDC
, rgbWindowFrame
) ;
862 DRAWFASTRECT( hDC
, &rc
) ;
864 hbrCaption
= CreateSolidBrush( rgbCaptionBG
) ;
865 hbrCaption
= (HBRUSH
) SelectObject( hDC
, hbrCaption
) ;
866 SelectObject( hDC
, (HPEN
) GetStockObject( NULL_PEN
) ) ;
868 Rectangle( hDC
, rcCap
.left
, rcCap
.top
, rcCap
.right
, rcCap
.bottom
+ 1 ) ;
870 Rectangle( hDC
, rcCap
.left
, rcCap
.top
, rcCap
.right
+1, rcCap
.bottom
) ;
871 hbrCaption
= (HBRUSH
) SelectObject( hDC
, hbrCaption
) ;
872 DeleteObject( hbrCaption
) ;
875 // Draw caption text here. Only do it in 3.1 'cause 3.1 gives
878 ui
= GetWindowTextLength( hWnd
) ;
889 lpsz
= (wxChar
*)GlobalAllocPtr( GHND
, (ui
+ 2) * sizeof(wxChar
) );
894 GetWindowText( hWnd
, lpsz
, ui
+ 1 ) ;
895 nBkMode
= SetBkMode( hDC
, TRANSPARENT
) ;
896 rgbText
= SetTextColor( hDC
, rgbText
) ;
898 memset( &lf
, '\0', sizeof(LOGFONT
) ) ;
900 lf
.lfHeight
= -(int)(nCapSize
- 3) ;
901 lf
.lfCharSet
= ANSI_CHARSET
;
902 lf
.lfQuality
= DEFAULT_QUALITY
;
903 lf
.lfClipPrecision
= CLIP_LH_ANGLES
| CLIP_STROKE_PRECIS
;
906 lf
.lfWeight
= FW_BOLD
;
911 // Can only rotate true type fonts (well, ok, we could
912 // try and use "modern").
913 wxStrcpy( lf
.lfFaceName
, wxT("Arial") ) ;
914 lf
.lfPitchAndFamily
= FF_SWISS
| 0x04;
915 lf
.lfEscapement
= 900 ;
917 // Note: The Win 3.1 documentation for CreateFont() say's
918 // that the lfOrientation member is ignored. It appears,
919 // that on Windows 16 3.1 this is true, but when running
920 // as a 16 bit WinApp on WindowsNT 3.1 the lfOrientation
921 // must be set or the text does not rotate!
923 lf
.lfOrientation
= 900 ;
925 hFont
= CreateFontIndirect( &lf
) ;
926 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
928 GetTextExtentPoint( hDC
, lpsz
, ui
, &Size
) ;
929 cx
= rcCap
.bottom
- ((rcCap
.bottom
- rcCap
.top
- Size
.cx
) / 2) ;
930 cy
= rcCap
.left
- 1 + ((rcCap
.right
- rcCap
.left
- Size
.cy
) / 2) ;
932 // Make sure we got a rotatable font back.
934 GetTextMetrics( hDC
, &tm
) ;
935 if (tm
.tmPitchAndFamily
& TMPF_VECTOR
||
936 tm
.tmPitchAndFamily
& TMPF_TRUETYPE
)
940 min( (long)cx
, rcCap
.bottom
),
945 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
946 DeleteObject( hFont
) ;
950 // Use small fonts always for the horizontal. Cause it looks
951 // more like "System" than Arial.
953 lf
.lfPitchAndFamily
= FF_SWISS
;
955 hFont
= CreateFontIndirect( &lf
) ;
956 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
958 GetTextExtentPoint( hDC
, lpsz
, ui
, &Size
) ;
959 cx
= rcCap
.left
+ ((rcCap
.right
- rcCap
.left
- Size
.cx
) / 2) ;
960 cy
= rcCap
.top
+ ((rcCap
.bottom
- rcCap
.top
- Size
.cy
) / 2) ;
962 // Figger out how big the string is
965 max( (long)cx
, rcCap
.left
),
970 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
971 DeleteObject( hFont
) ;
976 rgbText
= SetTextColor( hDC
, rgbText
) ;
977 SetBkMode( hDC
, nBkMode
) ;
980 GlobalFreePtr( (unsigned int)(DWORD
) lpsz
) ;
982 GlobalFreePtr( lpsz
) ;
988 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
991 DrawButton( hDC
, hWnd
, TRUE
, FALSE
) ;
994 DrawButton( hDC
, hWnd
, FALSE
, FALSE
) ;
1001 // DrawSysMenu( HDC hDC, hWnd, BOOL fInvert )
1003 // Draws the little system menu icon.
1005 void PASCAL
DrawSysMenu( HDC hDC
, HWND hWnd
, BOOL fInvert
)
1010 COLORREF rgbIconFace
;
1011 COLORREF rgbWindowFrame
;
1015 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1020 hDC
= GetWindowDC( hWnd
) ;
1027 rgbIconFace
= GetNearestColor( hDC
, RGBLTGRAY
) ;
1028 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1030 GetIconRect( hWnd
, &rcIcon
) ;
1031 GetWindowRect( hWnd
, &rc
) ;
1033 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1037 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1039 rc
= rcIcon
; // separator line
1040 rc
.top
= ++rc
.bottom
- 1 ;
1044 rc
= rcIcon
; // separator line
1045 rc
.left
= ++rc
.right
- 1 ;
1049 SetBkColor( hDC
, rgbIconFace
) ;
1050 DRAWFASTRECT( hDC
, &rcTemp
) ;
1052 // Draw separator line
1053 SetBkColor( hDC
, rgbWindowFrame
) ;
1054 DRAWFASTRECT( hDC
, &rc
) ;
1058 // Draw the little horizontal doo-hickey
1060 rcTemp
.top
= rcIcon
.top
+ ((nCapSize
-1) / 2) ;
1061 rcTemp
.bottom
= rcTemp
.top
+ 3 ;
1062 rcTemp
.left
= rcTemp
.left
+ 3 ;
1063 rcTemp
.right
= rcTemp
.right
- 1 ;
1065 SetBkColor( hDC
, RGBGRAY
) ;
1066 DRAWFASTRECT( hDC
, &rcTemp
) ;
1069 OffsetRect( &rc
, -1, -1 ) ;
1070 SetBkColor( hDC
, RGBBLACK
) ;
1071 DRAWFASTRECT( hDC
, &rc
) ;
1073 InflateRect( &rc
, -1, -1 ) ;
1074 SetBkColor( hDC
, RGBWHITE
) ;
1075 DRAWFASTRECT( hDC
, &rc
) ;
1079 InvertRect( hDC
, &rcIcon
) ;
1082 ReleaseDC( hWnd
, hDC
) ;
1087 // DoMenu( HWND hWnd )
1089 // Pops up the system menu.
1091 BOOL PASCAL
DoMenu( HWND hWnd
)
1100 if (!TestWinStyle(hWnd
, WS_SYSMENU
))
1103 hDC
= GetWindowDC( hWnd
);
1108 DrawSysMenu( hDC
, hWnd
, TRUE
) ;
1112 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1123 GetIconRect( hWnd
, &rcIcon
) ;
1124 GetWindowRect( hWnd
, &rc
) ;
1125 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1127 ClientToScreen( hWnd
, &pt
) ;
1128 ClientToScreen( hWnd
, (LPPOINT
)&rc
.right
) ;
1130 dw
= GetWindowLong( hWnd
, GWL_STYLE
) ;
1131 SetWindowLong( hWnd
, GWL_STYLE
, dw
| WS_SYSMENU
) ;
1133 hMenu
= GetSystemMenu( hWnd
, FALSE
) ;
1134 SetupSystemMenu( hWnd
, hMenu
) ;
1136 SetWindowLong( hWnd
, GWL_STYLE
, dw
) ;
1138 TrackPopupMenu( hMenu
, 0, //TPM_LEFTALIGN,
1145 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
1146 ReleaseDC( hWnd
, hDC
) ;
1152 // SetupSystemMenu( HWND hWnd, HMENU hMenu )
1154 // Enables/Disables the appropriate menu items on the
1155 // menu passed for the window passed.
1157 void PASCAL
SetupSystemMenu( HWND hWnd
, HMENU hMenu
)
1165 // Assume all should be grayed.
1167 wSize
= wMove
= wMinBox
= wMaxBox
= wRestore
= MF_GRAYED
;
1169 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
) || IsIconic( hWnd
))
1170 wMaxBox
= MF_ENABLED
;
1172 if (TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1173 wMinBox
= MF_ENABLED
;
1175 if (IsZoomed( hWnd
))
1176 wRestore
= MF_ENABLED
;
1178 if (TestWinStyle( hWnd
, WS_THICKFRAME
) &&
1179 !(IsIconic( hWnd
) || IsZoomed( hWnd
)))
1180 wSize
= MF_ENABLED
;
1182 if (!IsZoomed( hWnd
) &&
1183 !IsIconic( hWnd
) &&
1184 TestWinStyle( hWnd
, WS_CAPTION
) )
1185 wMove
= MF_ENABLED
;
1187 EnableMenuItem( hMenu
, SC_MOVE
, wMove
) ;
1188 EnableMenuItem( hMenu
, SC_SIZE
, wSize
) ;
1189 EnableMenuItem( hMenu
, SC_MINIMIZE
, wMinBox
) ;
1190 EnableMenuItem( hMenu
, SC_MAXIMIZE
, wMaxBox
) ;
1191 EnableMenuItem( hMenu
, SC_RESTORE
, wRestore
) ;
1193 } // SetupSystemMenu()
1195 // GetCaptionRect( HWND hWnd, LPRECT lprc )
1197 // calcluales the rectangle of the mini-caption in screen coords.
1199 BOOL PASCAL
GetCaptionRect( HWND hWnd
, LPRECT lprc
)
1203 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1205 if (!HASCAPTION( hWnd
))
1207 SetRectEmpty( lprc
) ;
1211 GetWindowRect( hWnd
, lprc
) ;
1213 // the window might have other non-client components like
1216 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
1218 lprc
->left
+= GetSystemMetrics( SM_CXFRAME
) ;
1219 lprc
->top
+= GetSystemMetrics( SM_CYFRAME
) ;
1220 lprc
->right
-= GetSystemMetrics( SM_CXFRAME
) ;
1221 lprc
->bottom
-= GetSystemMetrics( SM_CYFRAME
) ;
1224 if (TestWinStyle( hWnd
, DS_MODALFRAME
)) // if it's a dialog box
1226 lprc
->left
+= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1227 lprc
->top
+= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1228 lprc
->right
-= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1229 lprc
->bottom
-= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1232 if (TestWinStyle( hWnd
, WS_BORDER
))
1234 lprc
->left
+= GetSystemMetrics( SM_CXBORDER
) ;
1235 lprc
->top
+= GetSystemMetrics( SM_CYBORDER
) ;
1236 lprc
->right
-= GetSystemMetrics( SM_CXBORDER
) ;
1237 lprc
->bottom
-= GetSystemMetrics( SM_CYBORDER
) ;
1240 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1241 lprc
->right
= lprc
->left
+ nCapSize
;
1243 lprc
->bottom
= lprc
->top
+ nCapSize
;
1246 } // GetCaptionRect()
1248 // GetIconRect( HWND hWnd, LPRECT lprc )
1250 // Calculates the rect of the icon in screen coordinates.
1252 BOOL PASCAL
GetIconRect( HWND hWnd
, LPRECT lprc
)
1257 fMenu
= TestWinStyle( hWnd
, WS_SYSMENU
) ;
1258 fVert
= TestWinStyle( hWnd
, IBS_VERTCAPTION
) ;
1260 if (!GetCaptionRect( hWnd
, lprc
)) // window coords
1265 SetRectEmpty( lprc
) ;
1269 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1272 lprc
->bottom
= lprc
->top
+ nCapSize
;
1274 lprc
->right
= lprc
->left
+ nCapSize
;
1283 // GetMinButtonRect()
1285 // Calculates the rect of the minimize button in screen
1288 // For horizontal captions, we have the following situation ('Y' is minimize
1289 // and '^' is maximize or restore):
1291 // +---------------------------------+
1293 // +---------------------------------+
1294 // | |.......| <-- This is the width (nSize)
1296 // For vertical captions, we have the following:
1306 // |--| . <-- This is the height of the rectangle (nSize)
1310 // In order to figure out where the minimize button goes, we first need
1311 // to know if there is a maximize button. If so, use GetMaxButtonRect()
1314 BOOL PASCAL
GetMinButtonRect( HWND hWnd
, LPRECT lprc
)
1316 if (!TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1318 SetRectEmpty( lprc
) ;
1322 // The minimize button can be in either position 1 or 2. If there
1323 // is a maximize button, it's in position 2.
1325 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1326 return GetButtonRect( hWnd
, 2, lprc
) ;
1328 return GetButtonRect( hWnd
, 1, lprc
) ;
1331 // GetMaxButtonRect()
1333 // Calculates the rect of the maximize button in screen
1336 // The maximize button, if present, is always to the far right
1339 BOOL PASCAL
GetMaxButtonRect( HWND hWnd
, LPRECT lprc
)
1341 //The maximize button can only be in position 1.
1343 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1344 return GetButtonRect( hWnd
, 1, lprc
) ;
1347 SetRectEmpty( lprc
) ;
1352 // Get the rect where a button would go.
1354 // This function does not care if it's a min or max, just whether
1355 // it is the first from the right/bottom or second from the right/bottom
1358 BOOL PASCAL
GetButtonRect( HWND hWnd
, UINT nPos
, LPRECT lprc
)
1362 if (!GetCaptionRect( hWnd
, lprc
)) //window coords
1365 nSize
= GETCAPTIONSIZE( hWnd
) ;
1367 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1369 lprc
->bottom
-= nSize
* (nPos
-1) ;
1370 lprc
->top
= lprc
->bottom
- nSize
+ 1 ;
1374 lprc
->right
-= nSize
* (nPos
-1) ;
1375 lprc
->left
= lprc
->right
- nSize
+ 1 ;
1379 } // GetButtonRect()
1381 // DrawButton( HDC hDC, HWND hWnd, BOOL fMin, BOOL fDepressed )
1383 // Draws either the min, max, or restore buttons. If fMin is FALSE then it
1384 // will draw either the Max or Restore button. If fDepressed is TRUE it will
1385 // draw the button in a down state.
1387 void PASCAL
DrawButton( HDC hDC
, HWND hWnd
, BOOL fMin
, BOOL fDepressed
)
1391 COLORREF rgbWindowFrame
;
1397 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1399 // If you look at the standard Windows' min/max buttons, you will notice
1400 // that they have two pixels of 'shadow' to the bottom and right. Since
1401 // our buttons can be really, really small, we only want one pixel of
1402 // shadow when they are small. I arbitrarily decided that if the
1403 // caption size is greater than or equal to 20 we will use two
1404 // pixels. That's what this THREASHOLD stuff does.
1406 #define THRESHOLD 20
1407 nOffset
= (nCapSize
>= THRESHOLD
) ? 2 : 1 ;
1412 hDC
= GetWindowDC( hWnd
) ;
1419 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1422 GetMinButtonRect( hWnd
, &rcButton
) ;
1424 GetMaxButtonRect( hWnd
, &rcButton
) ;
1426 GetWindowRect( hWnd
, &rc
) ;
1427 OffsetRect( &rcButton
, -rc
.left
, -rc
.top
) ;
1430 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1432 rc
= rcButton
; //separator line
1433 rc
.bottom
= --rc
.top
+ 1 ;
1438 rc
= rcButton
; //separator line
1439 rc
.right
= --rc
.left
+ 1 ;
1443 //Draw separator line
1444 SetBkColor( hDC
, rgbWindowFrame
) ;
1445 DRAWFASTRECT( hDC
, &rc
) ;
1448 SetBkColor( hDC
, RGBLTGRAY
) ;
1449 DRAWFASTRECT( hDC
, &rcButton
) ;
1453 //The normal min/max buttons have one pixel on the top and left
1454 //sides for the highlight, and two pixels on the bottom and
1455 //right side for the shadow.
1457 //When our caption is 'small' we only use one pixel on all
1460 SetBkColor( hDC
, RGBWHITE
) ;
1463 rc
.right
= rc
.left
+ 1 ;
1464 DRAWFASTRECT( hDC
, &rc
) ;
1468 rc
.bottom
= rc
.top
+ 1 ;
1469 DRAWFASTRECT( hDC
, &rc
) ;
1471 SetBkColor( hDC
, RGBGRAY
) ;
1474 rc
.left
= rc
.right
- 1 ;
1475 DRAWFASTRECT( hDC
, &rc
) ;
1476 if (nCapSize
> THRESHOLD
)
1480 DRAWFASTRECT( hDC
, &rc
) ;
1485 rc
.top
= rc
.bottom
- 1 ;
1486 DRAWFASTRECT( hDC
, &rc
) ;
1487 if (nCapSize
> THRESHOLD
)
1491 DRAWFASTRECT( hDC
, &rc
) ;
1496 rcButton
.right
-= nOffset
;
1497 rcButton
.bottom
-= nOffset
;
1501 //Draw depressed state
1503 SetBkColor( hDC
, RGBGRAY
) ;
1506 rc
.right
= rc
.left
+ nOffset
;
1507 DRAWFASTRECT( hDC
, &rc
) ;
1511 rc
.bottom
= rc
.top
+ nOffset
;
1512 DRAWFASTRECT( hDC
, &rc
) ;
1514 rcButton
.left
+= 2 * nOffset
;
1515 rcButton
.top
+= 2 * nOffset
;
1518 // Now draw the arrows. We do not want the
1519 // arrows to grow too large when we have a bigger than
1520 // normal caption, so we restrict their size.
1522 // rcButton now represents where we can place our
1525 // The maximum size of our arrows (i.e. the width of rcButton)
1526 // has been empirically determined to be SM_CYCAPTION / 2
1528 n
= ((GetSystemMetrics( SM_CYCAPTION
)) / 2) -
1529 (rcButton
.right
- rcButton
.left
) ;
1531 InflateRect( &rcButton
, n
/2-1, n
/2-1 ) ;
1534 DrawArrow( hDC
, &rcButton
, ARROW_DOWN
) ;
1536 if (IsZoomed( hWnd
))
1538 DrawArrow( hDC
, &rcButton
, ARROW_RESTORE
) ;
1541 DrawArrow( hDC
, &rcButton
, ARROW_UP
) ;
1544 ReleaseDC( hWnd
, hDC
) ;
1552 // Draws either a up or down arrow. The arrow is bound by the rectangle
1554 void PASCAL
DrawArrow( HDC hdc
, LPRECT lprc
, UINT uiStyle
)
1560 int nMax
= (lprc
->bottom
- lprc
->top
) >> 1 ;
1562 SetBkColor( hdc
, RGBBLACK
) ;
1564 // We draw the arrow by drawing a series of horizontal lines
1566 xTip
= lprc
->left
+ ((lprc
->right
- lprc
->left
+1) >> 1) ;
1570 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1571 for (row
= 1 ; row
<= nMax
; row
++ )
1573 rc
.left
= xTip
- row
;
1574 rc
.right
= xTip
+ row
- 1 ;
1575 rc
.top
= yTip
+ row
;
1576 rc
.bottom
= rc
.top
+ 1 ;
1577 DRAWFASTRECT( hdc
, &rc
) ;
1582 yTip
= lprc
->bottom
- ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1583 for ( row
= nMax
; row
> 0 ; row
-- )
1585 rc
.left
= xTip
- row
;
1586 rc
.right
= xTip
+ row
- 1 ;
1587 rc
.top
= yTip
- row
;
1588 rc
.bottom
= rc
.top
+ 1 ;
1589 DRAWFASTRECT( hdc
, &rc
) ;
1595 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 3) - 2;
1596 for (row
= 1 ; row
<= nMax
; row
++ )
1598 rc
.left
= xTip
- row
;
1599 rc
.right
= xTip
+ row
- 1 ;
1600 rc
.top
= yTip
+ row
;
1601 rc
.bottom
= rc
.top
+ 1 ;
1602 DRAWFASTRECT( hdc
, &rc
) ;
1605 yTip
+= (nMax
+1) * 2 ;
1606 for ( row
= nMax
; row
> 0 ; row
-- )
1608 rc
.left
= xTip
- row
;
1609 rc
.right
= xTip
+ row
- 1 ;
1610 rc
.top
= yTip
- row
;
1611 rc
.bottom
= rc
.top
+ 1 ;
1612 DRAWFASTRECT( hdc
, &rc
) ;
1619 #endif // wxUSE_ITSY_BITSY