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 #if !USE_SHARED_LIBRARY
39 IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame
, wxFrame
)
48 #include "wx/minifram.h"
52 #ifndef wxUSE_NORLANDER_HEADERS
53 #include "wx/msw/gnuwin32/extra.h"
58 #if !USE_SHARED_LIBRARY
59 IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame
, wxFrame
)
62 long wxMiniFrame::MSWDefWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
64 if ((GetWindowStyleFlag() & wxTINY_CAPTION_HORIZ
) ||
65 (GetWindowStyleFlag() & wxTINY_CAPTION_VERT
))
66 return ::ibDefWindowProc((HWND
) GetHWND(), nMsg
, wParam
, lParam
);
67 else if ( m_oldWndProc
)
68 return ::CallWindowProc(CASTWNDPROC m_oldWndProc
, (HWND
) GetHWND(), (UINT
) nMsg
, (WPARAM
) wParam
, (LPARAM
) lParam
);
70 return ::DefWindowProc((HWND
) GetHWND(), nMsg
, wParam
, lParam
);
73 wxMiniFrame::~wxMiniFrame(void)
77 /////////////////////////////////////////////////////////////////////////
79 // Project: ItsyBitsy window support module
83 // ItsyBitsy is a support module that allows you to create windows
84 // that look and act very much like a popup window witha system
85 // menu and caption bar, except everything is scaled to about 2/3
88 // For documentation on how to use ItsyBits, read the document
92 // 9/27/91 Charlie Kindel (cek/ckindel)
93 // Wrote and documented it.
96 // 2/23/93 cek Added minimize/maximize buttons.
97 // 3/18/93 cek Fixed system menu bug where system menu
98 // popped back up if you clicked on the
99 // icon again while it was up.
100 // 3/24/93 cek More comments. Fixed DS_MODALDIALOG style
101 // problem. Use auto precompiled headers
104 //////////////////////////////////////////////////////////////////////////
106 #include "wx/window.h"
107 #include "wx/msw/private.h"
111 #if !defined( __WATCOMC__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__)
120 // Some mildly useful macros for the standard 16 colors
121 #define RGBBLACK RGB(0,0,0)
122 #define RGBRED RGB(128,0,0)
123 #define RGBGREEN RGB(0,128,0)
124 #define RGBBLUE RGB(0,0,128)
126 #define RGBBROWN RGB(128,128,0)
127 #define RGBMAGENTA RGB(128,0,128)
128 #define RGBCYAN RGB(0,128,128)
129 #define RGBLTGRAY RGB(192,192,192)
131 #define RGBGRAY RGB(128,128,128)
132 #define RGBLTRED RGB(255,0,0)
133 #define RGBLTGREEN RGB(0,255,0)
134 #define RGBLTBLUE RGB(0,0,255)
136 #define RGBYELLOW RGB(255,255,0)
137 #define RGBLTMAGENTA RGB(255,0,255)
138 #define RGBLTCYAN RGB(0,255,255)
139 #define RGBWHITE RGB(255,255,255)
142 #ifndef GlobalAllocPtr
143 #define GlobalPtrHandle(lp) \
144 ((HGLOBAL)GlobalHandle(lp))
146 #define GlobalLockPtr(lp) \
147 ((BOOL)GlobalLock(GlobalPtrHandle(lp)))
148 #define GlobalUnlockPtr(lp) \
149 GlobalUnlock(GlobalPtrHandle(lp))
151 #define GlobalAllocPtr(flags, cb) \
152 (GlobalLock(GlobalAlloc((flags), (cb))))
153 #define GlobalReAllocPtr(lp, cbNew, flags) \
154 (GlobalUnlockPtr(lp), GlobalLock(GlobalReAlloc(GlobalPtrHandle(lp) , (cbNew), (flags))))
155 #define GlobalFreePtr(lp) \
156 (GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp)))
159 #if defined(__BORLANDC__) || defined(__WATCOMC__)
160 #define max(a,b) (((a) > (b)) ? (a) : (b))
161 #define min(a,b) (((a) < (b)) ? (a) : (b))
164 // CAPTIONXY is the default size of the system menu icon. This
165 // determines the height/width of the caption.
167 // The value that results from the following formula works out
168 // nicely for the veritcal caption on VGA, 8514 (Large Fonts),
169 // 8514 (Small Fonts), XGA (Small Fonts), XGA (Large Fonts),
170 // and TIGA (Small Fonts). It may not be good on other displays.
172 // The problem is that TT fonts turn into bitmap fonts when they
173 // are sized below a certain threshold. The idea is to make the
174 // size of the caption just big enough to get the smallest TT
175 // (scalable) font to fit.
177 #define CAPTIONXY (GetSystemMetrics( SM_CYCAPTION ) / 2 + 1)
179 #define TestWinStyle( hWnd, dwStyleBit ) \
180 (((DWORD)GetWindowLong( hWnd, GWL_STYLE ) & (DWORD)dwStyleBit) ? TRUE : FALSE )
181 #define HASCAPTION( hwnd ) (TestWinStyle( hwnd, IBS_VERTCAPTION ) ||\
182 TestWinStyle( hwnd, IBS_HORZCAPTION ))
184 #define SETCAPTIONSIZE(h,i) (UINT)SetProp(h,T("ibSize"),(HANDLE)i)
185 #define GETCAPTIONSIZE(h) (UINT)GetProp(h,T("ibSize"))
186 #define FREECAPTIONSIZE(h) RemoveProp(h,T("ibSize"))
188 #define SETMENUWASUPFLAG(h,i) (UINT)SetProp(h,T("ibFlag"),(HANDLE)i)
189 #define GETMENUWASUPFLAG(h) (UINT)GetProp(h,T("ibFlag"))
190 #define FREEMENUWASUPFLAG(h) RemoveProp(h,T("ibFlag"))
192 /////////////////////////////////////////////////////////////////////
193 // Little known fact:
194 // ExtTextOut() is the fastest way to draw a filled rectangle
195 // in Windows (if you don't want dithered colors or borders).
197 // Unfortunately there is a bug in the Windows 3.0 8514 driver
198 // in using ExtTextOut() to a memory DC. If you are drawing
199 // to an off screen bitmap, then blitting that bitmap to the
200 // display, do not #define wxUSE_EXTTEXTOUT below.
202 // The following macro (DRAWFASTRECT) draws a filled rectangle
203 // with no border and a solid color. It uses the current back-
204 // ground color as the fill color.
205 //////////////////////////////////////////////////////////////////////
206 #define wxUSE_EXTTEXTOUT
207 #ifdef wxUSE_EXTTEXTOUT
208 #define DRAWFASTRECT(hdc,lprc) ExtTextOut(hdc,0,0,ETO_OPAQUE,lprc,NULL,0,NULL)
210 #define DRAWFASTRECT(hdc,lprc) {\
211 HBRUSH hbr = CreateSolidBrush( GetBkColor( hdc ) ) ;\
212 hbr = SelectObject(hdc, hbr) ;\
213 PatBlt(hdc,(lprc)->left,(lprc)->top,(lprc)->right-(lprc)->left,(lprc)->bottom-(lprc)->top,PATCOPY) ;\
214 hbr = SelectObject(hdc, hbr) ;\
215 DeleteObject( hbr ) ;\
219 // The DrawArrow function takes the following to indicate what
220 // kind of arrow to draw.
224 #define ARROW_RESTORE 2
226 BOOL PASCAL
DepressMinMaxButton( HWND hWnd
, UINT uiHT
, LPRECT
) ;
227 BOOL PASCAL
DoMenu( HWND hWnd
) ;
228 void PASCAL
SetupSystemMenu( HWND hWnd
, HMENU hMenu
) ;
229 BOOL PASCAL
GetCaptionRect( HWND hWnd
, LPRECT lprc
) ;
230 BOOL PASCAL
GetIconRect( HWND hWnd
, LPRECT lprc
) ;
231 BOOL PASCAL
GetButtonRect( HWND hWnd
, UINT nPos
, LPRECT lprc
) ;
232 BOOL PASCAL
GetMinButtonRect( HWND hWnd
, LPRECT lprc
) ;
233 BOOL PASCAL
GetMaxButtonRect( HWND hWnd
, LPRECT lprc
) ;
234 BOOL PASCAL
DrawCaption( HDC hDC
, HWND hWnd
, LPRECT lprc
,
235 BOOL fVert
, BOOL fSysMenu
,
236 BOOL fMin
, BOOL fMax
, BOOL fActive
) ;
237 void PASCAL
DrawSysMenu( HDC hDC
, HWND hWnd
, BOOL fInvert
) ;
238 void PASCAL
DrawButton( HDC hDC
, HWND hWnd
, BOOL fMin
, BOOL fDepressed
) ;
239 void PASCAL
DrawArrow( HDC hdc
, LPRECT lprc
, UINT uiStyle
) ;
245 ///////////////////////////////////////////////////////////////////////
246 // External/Public functions
247 ///////////////////////////////////////////////////////////////////////
249 /////////////////////////////////////////////////////////////////
250 // UINT WINAPI ibGetCaptionSize( HWND hWnd )
254 // Gets the size of the caption (height if horz, width if
259 ///////////////////////////////////////////////////////////////
260 UINT WINAPI
ibGetCaptionSize( HWND hWnd
)
262 return GETCAPTIONSIZE( hWnd
) + 1 ;
263 } // ibSetCaptionSize()
265 /////////////////////////////////////////////////////////////////
266 // UINT WINAPI ibSetCaptionSize( HWND hWnd, UINT nSize )
270 // Changes the size of the caption (height if horz, width if
275 //////////////////////////////////////////////////////////////////
276 UINT WINAPI
ibSetCaptionSize( HWND hWnd
, UINT nSize
)
284 ui
= SETCAPTIONSIZE( hWnd
, nSize
) ;
286 // Once we change the window style, we need a WM_NCCALCRECT
289 // SWP_FRAMECHANGED is not documented in the 3.1 SDK docs,
290 // but *is* in WINDOWS.H.
292 SetWindowPos( hWnd
, NULL
, 0, 0, 0, 0, SWP_FRAMECHANGED
|
293 SWP_NOSIZE
| SWP_NOMOVE
|
294 SWP_NOACTIVATE
| SWP_NOZORDER
) ;
298 } // ibSetCaptionSize()
300 /////////////////////////////////////////////////////////////////
301 // LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam )
305 // This function should be called instead of DefWindowProc() for
306 // windows that want to have itsybitsy captions.
310 //////////////////////////////////////////////////////////////////
311 LRESULT WINAPI
ibDefWindowProc( HWND hWnd
, UINT uiMsg
, WPARAM wParam
, LPARAM lParam
)
320 // was hit then pop up the menu
322 if (HASCAPTION( hWnd
) && (wParam
== VK_SPACE
))
336 DWORD dw
= GetWindowLong( hWnd
, GWL_STYLE
) ;
338 // Fool DefWindowProc into thinking we do not have
339 // a system menu. Otherwise it will try to
342 SetWindowLong( hWnd
, GWL_STYLE
, dw
&~WS_SYSMENU
) ;
343 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
344 SetWindowLong( hWnd
, GWL_STYLE
, dw
) ;
350 // The menu that is poped up for the system menu with
351 // TrackPopupMenu() sends it's notifications as WM_COMMAND
352 // messages. We need to translate these into
353 // WM_SYSCOMMAND messages. All standard WM_SYSCOMMAND
354 // ids are greater than 0xF000.
356 // This could be a possible cause of confusion if the
357 // itsybitsy window had children that used SC_MOVE or SC_CLOSE
358 // as their IDs. Take note and be careful.
360 // Also, because ibDefWindowProc looks at WM_COMMAND messages,
361 // you will need to be careful to call ibDefWindowProc() for
362 // any wm_command messages that you would normally ignore.
363 // Otherwise the system menu won't work.
365 if (wParam
>= 0xF000)
366 // Call PostMessage() here instead of SendMessage!
368 // Our menu was created by TrackPopupMenu(). TPM() does
369 // not return until after the menu has been destroyed
370 // (and thus the command associated with the menu selection
371 // sent). Therefore when we get here, we are still
372 // *inside* TPM(). If we Send WM_SYSCOMMAND, SC_CLOSE
373 // to the window, the window will be destroyed before
374 // TPM() returns to our code within DoMenu() below. Wel...
375 // We do stuff with the window handle after DoMenu()
376 // returns (namely GetProp()). Since the window has
377 // been destroyed,this is bad.
378 PostMessage( hWnd
, WM_SYSCOMMAND
, wParam
, lParam
) ;
380 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
382 case WM_GETMINMAXINFO
:
384 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
385 if (HASCAPTION( hWnd
) && TestWinStyle( hWnd
, WS_THICKFRAME
))
387 LPPOINT lppt
= (LPPOINT
)lParam
;
392 int cx
, cy
; // window frame/border width
394 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
396 cx
= GetSystemMetrics( SM_CXFRAME
) ;
397 cy
= GetSystemMetrics( SM_CYFRAME
) ;
399 else if (TestWinStyle(hWnd
, WS_BORDER
))
401 cx
= GetSystemMetrics( SM_CXBORDER
) ;
402 cy
= GetSystemMetrics( SM_CYBORDER
) ;
406 // VZ: I don't know what should be here, but the vars must
408 wxFAIL_MSG(T("don't know how to initialize cx, cy"));
413 GetIconRect( hWnd
, &rcMenu
) ;
414 GetMinButtonRect( hWnd
, &rcMin
) ;
415 GetMaxButtonRect( hWnd
, &rcMax
) ;
416 nX
= (rcMenu
.right
-rcMenu
.left
) +
417 (rcMin
.right
-rcMin
.left
) +
418 (rcMin
.right
-rcMin
.left
) ;
421 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
) )
423 lppt
[3].x
= nCapSize
+ cx
* 2 - 1 ;
424 lppt
[3].y
= nX
+ (2* nCapSize
) ;
428 lppt
[3].x
= nX
+ (2* nCapSize
) ;
429 lppt
[3].y
= nCapSize
+ cy
* 2 - 1 ;
432 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
436 /////////////////////////////////////////////////////////////////////
437 // Non-client area messages. These are used to allow the
438 // minature caption bar to be handled correctly.
444 // We have two things that we need to store somewhere:
445 // 1) The caption height (width).
446 // and 2) A flag indicating whether the sysmenu was
449 // CAPTIONXY is a macro that calls GetSystemMetrics.
451 SETCAPTIONSIZE( hWnd
, CAPTIONXY
) ;
453 // Set our flag that tells us whether the system menu was
456 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
458 // Are we in 3.1? If so we have some neat features
459 // we can use like rotated TrueType fonts.
461 fWin31
= (BOOL
)(LOWORD( GetVersion() ) >= 0x030A) ;
463 // If IBS_????CAPTION was specified and the WS_DLGFRAME (or
464 // WS_DLGFRAME 'cause it == WS_CAPTION | WS_BORDER)
465 // was specified the creator made a mistake. Things get really
466 // ugly if DefWindowProc sees WS_DLGFRAME, so we strip
467 // the WS_DLGFRAME part off!
469 dwStyle
= GetWindowLong( hWnd
, GWL_STYLE
) ;
470 if ((dwStyle
& IBS_VERTCAPTION
|| dwStyle
& IBS_HORZCAPTION
) &&
471 dwStyle
& WS_DLGFRAME
)
473 dwStyle
&= (DWORD
)~WS_DLGFRAME
;
474 SetWindowLong( hWnd
, GWL_STYLE
, dwStyle
) ;
477 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
480 // We store the caption size in a window prop. so we
481 // must remove props.
483 FREECAPTIONSIZE( hWnd
) ;
484 FREEMENUWASUPFLAG( hWnd
) ;
485 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
488 // This is sent when the window manager wants to find out
489 // how big our client area is to be. If we have a mini-caption
490 // then we trap this message and calculate the cleint area rect,
491 // which is the client area rect calculated by DefWindowProc()
492 // minus the width/height of the mini-caption bar
494 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
495 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
))
497 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
499 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
) )
500 ((LPRECT
)lParam
)->left
+= nCapSize
;
502 ((LPRECT
)lParam
)->top
+= nCapSize
;
507 // This message is sent whenever the mouse moves over us.
508 // We will depend on DefWindowProc for everything unless
509 // there is a mini-caption, in which case we will
510 // return HTCAPTION or HTSYSMENU. When the user clicks
511 // or double clicks, NC_LBUTTON/ message are sent with
512 // wParam equal to what we return here.
513 // This means that this is an ideal place to figure out
516 // let defwindowproc handle the standard borders etc...
518 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
519 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
) && lRet
== HTNOWHERE
)
527 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
529 // if DefWindowProc returned HTCAPTION then we have to
530 // refine the area and return HTSYSMENU if appropriate
532 pt
.x
= LOWORD( lParam
) ;
533 pt
.y
= HIWORD( lParam
) ;
535 GetCaptionRect( hWnd
, &rc
) ; // window coords
536 if (PtInRect( &rc
, pt
))
540 // rely on the fact that Get???Rect() return an invalid
541 // (empty) rectangle if the menu/buttons don't exist
543 GetIconRect( hWnd
, &rcMenu
) ;
544 GetMinButtonRect( hWnd
, &rcMinButton
) ;
545 GetMaxButtonRect( hWnd
, &rcMaxButton
) ;
547 if (PtInRect( &rcMenu
, pt
))
550 if (PtInRect( &rcMinButton
, pt
))
553 if (PtInRect( &rcMaxButton
, pt
))
557 if (lRet
!= HTSYSMENU
)
558 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
561 case WM_NCLBUTTONDBLCLK
:
562 // Windows recieve WM_NC?BUTTONDBLCLK messages whether they
563 // have CS_DBLCLKS or not. We watch for one of these
564 // to see if the user double clicked on the system menu (to
565 // close the window) or on the caption (to maximize the window).
567 if (!IsIconic( hWnd
) && HASCAPTION( hWnd
) && wParam
== HTSYSMENU
)
569 SendMessage( hWnd
, WM_CLOSE
, 0, 0L ) ;
572 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
574 case WM_NCLBUTTONDOWN
:
578 // If we're iconic or we don't have a caption then
579 // DefWindowProc will do the job just fine.
581 if (IsIconic( hWnd
) || !HASCAPTION( hWnd
))
582 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
584 // Here's were we handle the system menu, the min and max buttons.
585 // If you wanted to change the behavior of the min/max buttons
586 // do something like swap tool palettes or something, you
587 // would change the SendMessage() calls below.
592 if (GETMENUWASUPFLAG( hWnd
) == FALSE
&& DoMenu( hWnd
))
593 SETMENUWASUPFLAG( hWnd
, TRUE
) ;
595 SETMENUWASUPFLAG( hWnd
, FALSE
) ;
599 GetMinButtonRect( hWnd
, &rc
) ;
600 // Note that DepressMinMaxButton() goes into
601 // a PeekMessage() loop waiting for the mouse
604 if (DepressMinMaxButton( hWnd
, wParam
, &rc
))
605 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_MINIMIZE
, lParam
) ;
609 GetMaxButtonRect( hWnd
, &rc
) ;
610 // Note that DepressMinMaxButton() goes into
611 // a PeekMessage() loop waiting for the mouse
614 if (DepressMinMaxButton( hWnd
, wParam
, &rc
))
617 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_RESTORE
, lParam
) ;
619 SendMessage( hWnd
, WM_SYSCOMMAND
, SC_MAXIMIZE
, lParam
) ;
624 // Well, it appears as though the user clicked somewhere other
625 // than the buttons. We let DefWindowProc do it's magic.
626 // This is where things like dragging and sizing the
629 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
636 if (IsIconic( hWnd
))
637 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
639 // Paint the non-client area here. We will call DefWindowProc
640 // after we are done so it can paint the borders and so
643 lRet
= DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
644 if (HASCAPTION( hWnd
))
648 HDC hDC
= GetWindowDC( hWnd
) ;
651 GetCaptionRect( hWnd
, &rcCap
) ; // Convert to window coords
652 GetWindowRect( hWnd
, &rc
) ;
653 OffsetRect( &rcCap
, -rc
.left
, -rc
.top
) ;
655 if (uiMsg
== WM_NCPAINT
)
656 fActive
= (hWnd
== GetActiveWindow()) ;
660 DrawCaption( hDC
, hWnd
, &rcCap
,
661 TestWinStyle(hWnd
, IBS_VERTCAPTION
),
662 TestWinStyle(hWnd
, WS_SYSMENU
),
663 TestWinStyle(hWnd
, WS_MINIMIZEBOX
),
664 TestWinStyle(hWnd
, WS_MAXIMIZEBOX
),
667 ReleaseDC( hWnd
, hDC
) ;
673 return DefWindowProc( hWnd
, uiMsg
, wParam
, lParam
) ;
678 } // ibDefWindowProc()
680 // ibAdjustWindowRect( HWND hWnd, LPRECT lprc )
682 // Does the same thing as the USER function AdjustWindowRect(),
683 // but knows about itsybitsy windows. AdjustWindowRect() is
684 // bogus for stuff like this.
686 void WINAPI
ibAdjustWindowRect( HWND hWnd
, LPRECT lprc
)
688 short cx
= 0, cy
= 0 ;
691 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
693 // First check Windows's styles, then our own.
695 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
697 cx
= GetSystemMetrics( SM_CXFRAME
) ;
698 cy
= GetSystemMetrics( SM_CYFRAME
) ;
701 if (TestWinStyle(hWnd
, DS_MODALFRAME
))
703 cx
= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
704 cy
= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
707 if (TestWinStyle(hWnd
, WS_BORDER
))
709 cx
= GetSystemMetrics( SM_CXBORDER
) ;
710 cy
= GetSystemMetrics( SM_CYBORDER
) ;
713 InflateRect( lprc
, cx
, cy
) ;
715 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
716 lprc
->left
-= nCapSize
;
718 if (TestWinStyle( hWnd
, IBS_HORZCAPTION
))
719 lprc
->top
-= nCapSize
;
721 } // ibAdjustWindowRect()
724 ///////////////////////////////////////////////////////////////////////
725 // Internal functions
726 ///////////////////////////////////////////////////////////////////////
728 // DepressMinMaxButton()
730 // This function is called when the user has pressed either the min or
731 // max button (i.e. WM_NCLBUTTONDOWN). We go into a Peekmessage() loop,
732 // waiting for the mouse to come back up. This allows us to make the
733 // button change up/down state like a real button does.
735 // lprc points to the rectangle that describes the button the
736 // user has clicked on.
738 BOOL PASCAL
DepressMinMaxButton( HWND hWnd
, UINT uiHT
, LPRECT lprc
)
740 BOOL fDepressed
= TRUE
;
743 // Draw button in down state
744 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
) ;
749 if (PeekMessage((LPMSG
)&msg
, NULL
, WM_MOUSEFIRST
, WM_MOUSELAST
, PM_REMOVE
))
755 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, !fDepressed
) ;
757 return PtInRect( lprc
, msg
.pt
) ;
760 if (PtInRect( lprc
, msg
.pt
))
763 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
= TRUE
) ;
768 DrawButton( NULL
, hWnd
, uiHT
== HTMINBUTTON
, fDepressed
= FALSE
) ;
775 } // DepressMinMaxButton()
777 // DrawCaption( HDC hDC, HWND hWnd, LPRECT lprc,
778 // BOOL fVert, BOOL fSysMenu, BOOL fActive )
780 // This function draws an itsy bitsy caption bar with or
781 // without system menu to the dc specified by hDC. The
782 // caption is drawn to fit within the lprc RECT and is
783 // drawn//withOut/ borders.
785 BOOL PASCAL
DrawCaption( HDC hDC
, HWND hWnd
, LPRECT lprc
,
786 BOOL fVert
, BOOL fSysMenu
, BOOL fMin
,
787 BOOL fMax
, BOOL fActive
)
791 COLORREF rgbCaptionBG
;
793 COLORREF rgbWindowFrame
;
798 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
802 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
804 // if we have focus use the active caption color
805 // otherwise use the inactive caption color
809 rgbText
= GetSysColor( COLOR_CAPTIONTEXT
) ;
810 rgbCaptionBG
= GetSysColor( COLOR_ACTIVECAPTION
) ;
815 rgbText
= GetSysColor( COLOR_INACTIVECAPTIONTEXT
) ;
817 rgbText
= GetSysColor( COLOR_CAPTIONTEXT
) ;
819 rgbCaptionBG
= GetSysColor( COLOR_INACTIVECAPTION
) ;
822 SetBkMode( hDC
, TRANSPARENT
) ;
823 SelectObject( hDC
, GetStockObject( NULL_BRUSH
) ) ;
824 SelectObject( hDC
, GetStockObject( NULL_PEN
) ) ;
831 rcCap
.top
+= nCapSize
;
833 rcCap
.left
+= nCapSize
;
839 rcCap
.bottom
-= nCapSize
;
841 rcCap
.right
-= nCapSize
;
847 rcCap
.bottom
-= nCapSize
;
849 rcCap
.right
-= nCapSize
;
854 rc
.left
= lprc
->right
- 1 ;
855 rc
.right
= lprc
->right
;
857 rc
.bottom
= lprc
->bottom
;
861 rc
.left
= lprc
->left
;
862 rc
.right
= lprc
->right
;
863 rc
.bottom
= lprc
->bottom
;
864 rc
.top
= rc
.bottom
- 1 ;
867 SetBkColor( hDC
, rgbWindowFrame
) ;
868 DRAWFASTRECT( hDC
, &rc
) ;
870 hbrCaption
= CreateSolidBrush( rgbCaptionBG
) ;
871 hbrCaption
= (HBRUSH
) SelectObject( hDC
, hbrCaption
) ;
872 SelectObject( hDC
, (HPEN
) GetStockObject( NULL_PEN
) ) ;
874 Rectangle( hDC
, rcCap
.left
, rcCap
.top
, rcCap
.right
, rcCap
.bottom
+ 1 ) ;
876 Rectangle( hDC
, rcCap
.left
, rcCap
.top
, rcCap
.right
+1, rcCap
.bottom
) ;
877 hbrCaption
= (HBRUSH
) SelectObject( hDC
, hbrCaption
) ;
878 DeleteObject( hbrCaption
) ;
881 // Draw caption text here. Only do it in 3.1 'cause 3.1 gives
884 ui
= GetWindowTextLength( hWnd
) ;
895 lpsz
= (wxChar
*)GlobalAllocPtr( GHND
, (ui
+ 2) * sizeof(wxChar
) );
900 GetWindowText( hWnd
, lpsz
, ui
+ 1 ) ;
901 nBkMode
= SetBkMode( hDC
, TRANSPARENT
) ;
902 rgbText
= SetTextColor( hDC
, rgbText
) ;
904 memset( &lf
, '\0', sizeof(LOGFONT
) ) ;
906 lf
.lfHeight
= -(int)(nCapSize
- 3) ;
907 lf
.lfCharSet
= ANSI_CHARSET
;
908 lf
.lfQuality
= DEFAULT_QUALITY
;
909 lf
.lfClipPrecision
= CLIP_LH_ANGLES
| CLIP_STROKE_PRECIS
;
912 lf
.lfWeight
= FW_BOLD
;
917 // Can only rotate true type fonts (well, ok, we could
918 // try and use "modern").
919 wxStrcpy( lf
.lfFaceName
, T("Arial") ) ;
920 lf
.lfPitchAndFamily
= FF_SWISS
| 0x04;
921 lf
.lfEscapement
= 900 ;
923 // Note: The Win 3.1 documentation for CreateFont() say's
924 // that the lfOrientation member is ignored. It appears,
925 // that on Windows 16 3.1 this is true, but when running
926 // as a 16 bit WinApp on WindowsNT 3.1 the lfOrientation
927 // must be set or the text does not rotate!
929 lf
.lfOrientation
= 900 ;
931 hFont
= CreateFontIndirect( &lf
) ;
932 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
934 GetTextExtentPoint( hDC
, lpsz
, ui
, &Size
) ;
935 cx
= rcCap
.bottom
- ((rcCap
.bottom
- rcCap
.top
- Size
.cx
) / 2) ;
936 cy
= rcCap
.left
- 1 + ((rcCap
.right
- rcCap
.left
- Size
.cy
) / 2) ;
938 // Make sure we got a rotatable font back.
940 GetTextMetrics( hDC
, &tm
) ;
941 if (tm
.tmPitchAndFamily
& TMPF_VECTOR
||
942 tm
.tmPitchAndFamily
& TMPF_TRUETYPE
)
946 min( (long)cx
, rcCap
.bottom
),
951 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
952 DeleteObject( hFont
) ;
956 // Use small fonts always for the horizontal. Cause it looks
957 // more like "System" than Arial.
959 lf
.lfPitchAndFamily
= FF_SWISS
;
961 hFont
= CreateFontIndirect( &lf
) ;
962 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
964 GetTextExtentPoint( hDC
, lpsz
, ui
, &Size
) ;
965 cx
= rcCap
.left
+ ((rcCap
.right
- rcCap
.left
- Size
.cx
) / 2) ;
966 cy
= rcCap
.top
+ ((rcCap
.bottom
- rcCap
.top
- Size
.cy
) / 2) ;
968 // Figger out how big the string is
971 max( (long)cx
, rcCap
.left
),
976 hFont
= (HFONT
) SelectObject( hDC
, hFont
) ;
977 DeleteObject( hFont
) ;
982 rgbText
= SetTextColor( hDC
, rgbText
) ;
983 SetBkMode( hDC
, nBkMode
) ;
986 GlobalFreePtr( (unsigned int)(DWORD
) lpsz
) ;
988 GlobalFreePtr( lpsz
) ;
994 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
997 DrawButton( hDC
, hWnd
, TRUE
, FALSE
) ;
1000 DrawButton( hDC
, hWnd
, FALSE
, FALSE
) ;
1007 // DrawSysMenu( HDC hDC, hWnd, BOOL fInvert )
1009 // Draws the little system menu icon.
1011 void PASCAL
DrawSysMenu( HDC hDC
, HWND hWnd
, BOOL fInvert
)
1016 COLORREF rgbIconFace
;
1017 COLORREF rgbWindowFrame
;
1021 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1026 hDC
= GetWindowDC( hWnd
) ;
1033 rgbIconFace
= GetNearestColor( hDC
, RGBLTGRAY
) ;
1034 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1036 GetIconRect( hWnd
, &rcIcon
) ;
1037 GetWindowRect( hWnd
, &rc
) ;
1039 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1043 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1045 rc
= rcIcon
; // separator line
1046 rc
.top
= ++rc
.bottom
- 1 ;
1050 rc
= rcIcon
; // separator line
1051 rc
.left
= ++rc
.right
- 1 ;
1055 SetBkColor( hDC
, rgbIconFace
) ;
1056 DRAWFASTRECT( hDC
, &rcTemp
) ;
1058 // Draw separator line
1059 SetBkColor( hDC
, rgbWindowFrame
) ;
1060 DRAWFASTRECT( hDC
, &rc
) ;
1064 // Draw the little horizontal doo-hickey
1066 rcTemp
.top
= rcIcon
.top
+ ((nCapSize
-1) / 2) ;
1067 rcTemp
.bottom
= rcTemp
.top
+ 3 ;
1068 rcTemp
.left
= rcTemp
.left
+ 3 ;
1069 rcTemp
.right
= rcTemp
.right
- 1 ;
1071 SetBkColor( hDC
, RGBGRAY
) ;
1072 DRAWFASTRECT( hDC
, &rcTemp
) ;
1075 OffsetRect( &rc
, -1, -1 ) ;
1076 SetBkColor( hDC
, RGBBLACK
) ;
1077 DRAWFASTRECT( hDC
, &rc
) ;
1079 InflateRect( &rc
, -1, -1 ) ;
1080 SetBkColor( hDC
, RGBWHITE
) ;
1081 DRAWFASTRECT( hDC
, &rc
) ;
1085 InvertRect( hDC
, &rcIcon
) ;
1088 ReleaseDC( hWnd
, hDC
) ;
1093 // DoMenu( HWND hWnd )
1095 // Pops up the system menu.
1097 BOOL PASCAL
DoMenu( HWND hWnd
)
1106 if (!TestWinStyle(hWnd
, WS_SYSMENU
))
1109 hDC
= GetWindowDC( hWnd
);
1114 DrawSysMenu( hDC
, hWnd
, TRUE
) ;
1118 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1129 GetIconRect( hWnd
, &rcIcon
) ;
1130 GetWindowRect( hWnd
, &rc
) ;
1131 OffsetRect( &rcIcon
, -rc
.left
, -rc
.top
) ;
1133 ClientToScreen( hWnd
, &pt
) ;
1134 ClientToScreen( hWnd
, (LPPOINT
)&rc
.right
) ;
1136 dw
= GetWindowLong( hWnd
, GWL_STYLE
) ;
1137 SetWindowLong( hWnd
, GWL_STYLE
, dw
| WS_SYSMENU
) ;
1139 hMenu
= GetSystemMenu( hWnd
, FALSE
) ;
1140 SetupSystemMenu( hWnd
, hMenu
) ;
1142 SetWindowLong( hWnd
, GWL_STYLE
, dw
) ;
1144 TrackPopupMenu( hMenu
, 0, //TPM_LEFTALIGN,
1151 DrawSysMenu( hDC
, hWnd
, FALSE
) ;
1152 ReleaseDC( hWnd
, hDC
) ;
1158 // SetupSystemMenu( HWND hWnd, HMENU hMenu )
1160 // Enables/Disables the appropriate menu items on the
1161 // menu passed for the window passed.
1163 void PASCAL
SetupSystemMenu( HWND hWnd
, HMENU hMenu
)
1171 // Assume all should be grayed.
1173 wSize
= wMove
= wMinBox
= wMaxBox
= wRestore
= MF_GRAYED
;
1175 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
) || IsIconic( hWnd
))
1176 wMaxBox
= MF_ENABLED
;
1178 if (TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1179 wMinBox
= MF_ENABLED
;
1181 if (IsZoomed( hWnd
))
1182 wRestore
= MF_ENABLED
;
1184 if (TestWinStyle( hWnd
, WS_THICKFRAME
) &&
1185 !(IsIconic( hWnd
) || IsZoomed( hWnd
)))
1186 wSize
= MF_ENABLED
;
1188 if (!IsZoomed( hWnd
) &&
1189 !IsIconic( hWnd
) &&
1190 TestWinStyle( hWnd
, WS_CAPTION
) )
1191 wMove
= MF_ENABLED
;
1193 EnableMenuItem( hMenu
, SC_MOVE
, wMove
) ;
1194 EnableMenuItem( hMenu
, SC_SIZE
, wSize
) ;
1195 EnableMenuItem( hMenu
, SC_MINIMIZE
, wMinBox
) ;
1196 EnableMenuItem( hMenu
, SC_MAXIMIZE
, wMaxBox
) ;
1197 EnableMenuItem( hMenu
, SC_RESTORE
, wRestore
) ;
1199 } // SetupSystemMenu()
1201 // GetCaptionRect( HWND hWnd, LPRECT lprc )
1203 // calcluales the rectangle of the mini-caption in screen coords.
1205 BOOL PASCAL
GetCaptionRect( HWND hWnd
, LPRECT lprc
)
1209 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1211 if (!HASCAPTION( hWnd
))
1213 SetRectEmpty( lprc
) ;
1217 GetWindowRect( hWnd
, lprc
) ;
1219 // the window might have other non-client components like
1222 if (TestWinStyle( hWnd
, WS_THICKFRAME
))
1224 lprc
->left
+= GetSystemMetrics( SM_CXFRAME
) ;
1225 lprc
->top
+= GetSystemMetrics( SM_CYFRAME
) ;
1226 lprc
->right
-= GetSystemMetrics( SM_CXFRAME
) ;
1227 lprc
->bottom
-= GetSystemMetrics( SM_CYFRAME
) ;
1230 if (TestWinStyle( hWnd
, DS_MODALFRAME
)) // if it's a dialog box
1232 lprc
->left
+= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1233 lprc
->top
+= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1234 lprc
->right
-= GetSystemMetrics( SM_CXDLGFRAME
) + GetSystemMetrics( SM_CXBORDER
) ;
1235 lprc
->bottom
-= GetSystemMetrics( SM_CYDLGFRAME
) + GetSystemMetrics( SM_CYBORDER
) ;
1238 if (TestWinStyle( hWnd
, WS_BORDER
))
1240 lprc
->left
+= GetSystemMetrics( SM_CXBORDER
) ;
1241 lprc
->top
+= GetSystemMetrics( SM_CYBORDER
) ;
1242 lprc
->right
-= GetSystemMetrics( SM_CXBORDER
) ;
1243 lprc
->bottom
-= GetSystemMetrics( SM_CYBORDER
) ;
1246 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1247 lprc
->right
= lprc
->left
+ nCapSize
;
1249 lprc
->bottom
= lprc
->top
+ nCapSize
;
1252 } // GetCaptionRect()
1254 // GetIconRect( HWND hWnd, LPRECT lprc )
1256 // Calculates the rect of the icon in screen coordinates.
1258 BOOL PASCAL
GetIconRect( HWND hWnd
, LPRECT lprc
)
1263 fMenu
= TestWinStyle( hWnd
, WS_SYSMENU
) ;
1264 fVert
= TestWinStyle( hWnd
, IBS_VERTCAPTION
) ;
1266 if (!GetCaptionRect( hWnd
, lprc
)) // window coords
1271 SetRectEmpty( lprc
) ;
1275 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1278 lprc
->bottom
= lprc
->top
+ nCapSize
;
1280 lprc
->right
= lprc
->left
+ nCapSize
;
1289 // GetMinButtonRect()
1291 // Calculates the rect of the minimize button in screen
1294 // For horizontal captions, we have the following situation ('Y' is minimize
1295 // and '^' is maximize or restore):
1297 // +---------------------------------+
1299 // +---------------------------------+
1300 // | |.......| <-- This is the width (nSize)
1302 // For vertical captions, we have the following:
1312 // |--| . <-- This is the height of the rectangle (nSize)
1316 // In order to figure out where the minimize button goes, we first need
1317 // to know if there is a maximize button. If so, use GetMaxButtonRect()
1320 BOOL PASCAL
GetMinButtonRect( HWND hWnd
, LPRECT lprc
)
1322 if (!TestWinStyle( hWnd
, WS_MINIMIZEBOX
))
1324 SetRectEmpty( lprc
) ;
1328 // The minimize button can be in either position 1 or 2. If there
1329 // is a maximize button, it's in position 2.
1331 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1332 return GetButtonRect( hWnd
, 2, lprc
) ;
1334 return GetButtonRect( hWnd
, 1, lprc
) ;
1337 // GetMaxButtonRect()
1339 // Calculates the rect of the maximize button in screen
1342 // The maximize button, if present, is always to the far right
1345 BOOL PASCAL
GetMaxButtonRect( HWND hWnd
, LPRECT lprc
)
1347 //The maximize button can only be in position 1.
1349 if (TestWinStyle( hWnd
, WS_MAXIMIZEBOX
))
1350 return GetButtonRect( hWnd
, 1, lprc
) ;
1353 SetRectEmpty( lprc
) ;
1358 // Get the rect where a button would go.
1360 // This function does not care if it's a min or max, just whether
1361 // it is the first from the right/bottom or second from the right/bottom
1364 BOOL PASCAL
GetButtonRect( HWND hWnd
, UINT nPos
, LPRECT lprc
)
1368 if (!GetCaptionRect( hWnd
, lprc
)) //window coords
1371 nSize
= GETCAPTIONSIZE( hWnd
) ;
1373 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1375 lprc
->bottom
-= nSize
* (nPos
-1) ;
1376 lprc
->top
= lprc
->bottom
- nSize
+ 1 ;
1380 lprc
->right
-= nSize
* (nPos
-1) ;
1381 lprc
->left
= lprc
->right
- nSize
+ 1 ;
1385 } // GetButtonRect()
1387 // DrawButton( HDC hDC, HWND hWnd, BOOL fMin, BOOL fDepressed )
1389 // Draws either the min, max, or restore buttons. If fMin is FALSE then it
1390 // will draw either the Max or Restore button. If fDepressed is TRUE it will
1391 // draw the button in a down state.
1393 void PASCAL
DrawButton( HDC hDC
, HWND hWnd
, BOOL fMin
, BOOL fDepressed
)
1397 COLORREF rgbWindowFrame
;
1403 nCapSize
= GETCAPTIONSIZE( hWnd
) ;
1405 // If you look at the standard Windows' min/max buttons, you will notice
1406 // that they have two pixels of 'shadow' to the bottom and right. Since
1407 // our buttons can be really, really small, we only want one pixel of
1408 // shadow when they are small. I arbitrarily decided that if the
1409 // caption size is greater than or equal to 20 we will use two
1410 // pixels. That's what this THREASHOLD stuff does.
1412 #define THRESHOLD 20
1413 nOffset
= (nCapSize
>= THRESHOLD
) ? 2 : 1 ;
1418 hDC
= GetWindowDC( hWnd
) ;
1425 rgbWindowFrame
= GetSysColor( COLOR_WINDOWFRAME
) ;
1428 GetMinButtonRect( hWnd
, &rcButton
) ;
1430 GetMaxButtonRect( hWnd
, &rcButton
) ;
1432 GetWindowRect( hWnd
, &rc
) ;
1433 OffsetRect( &rcButton
, -rc
.left
, -rc
.top
) ;
1436 if (TestWinStyle( hWnd
, IBS_VERTCAPTION
))
1438 rc
= rcButton
; //separator line
1439 rc
.bottom
= --rc
.top
+ 1 ;
1444 rc
= rcButton
; //separator line
1445 rc
.right
= --rc
.left
+ 1 ;
1449 //Draw separator line
1450 SetBkColor( hDC
, rgbWindowFrame
) ;
1451 DRAWFASTRECT( hDC
, &rc
) ;
1454 SetBkColor( hDC
, RGBLTGRAY
) ;
1455 DRAWFASTRECT( hDC
, &rcButton
) ;
1459 //The normal min/max buttons have one pixel on the top and left
1460 //sides for the highlight, and two pixels on the bottom and
1461 //right side for the shadow.
1463 //When our caption is 'small' we only use one pixel on all
1466 SetBkColor( hDC
, RGBWHITE
) ;
1469 rc
.right
= rc
.left
+ 1 ;
1470 DRAWFASTRECT( hDC
, &rc
) ;
1474 rc
.bottom
= rc
.top
+ 1 ;
1475 DRAWFASTRECT( hDC
, &rc
) ;
1477 SetBkColor( hDC
, RGBGRAY
) ;
1480 rc
.left
= rc
.right
- 1 ;
1481 DRAWFASTRECT( hDC
, &rc
) ;
1482 if (nCapSize
> THRESHOLD
)
1486 DRAWFASTRECT( hDC
, &rc
) ;
1491 rc
.top
= rc
.bottom
- 1 ;
1492 DRAWFASTRECT( hDC
, &rc
) ;
1493 if (nCapSize
> THRESHOLD
)
1497 DRAWFASTRECT( hDC
, &rc
) ;
1502 rcButton
.right
-= nOffset
;
1503 rcButton
.bottom
-= nOffset
;
1507 //Draw depressed state
1509 SetBkColor( hDC
, RGBGRAY
) ;
1512 rc
.right
= rc
.left
+ nOffset
;
1513 DRAWFASTRECT( hDC
, &rc
) ;
1517 rc
.bottom
= rc
.top
+ nOffset
;
1518 DRAWFASTRECT( hDC
, &rc
) ;
1520 rcButton
.left
+= 2 * nOffset
;
1521 rcButton
.top
+= 2 * nOffset
;
1524 // Now draw the arrows. We do not want the
1525 // arrows to grow too large when we have a bigger than
1526 // normal caption, so we restrict their size.
1528 // rcButton now represents where we can place our
1531 // The maximum size of our arrows (i.e. the width of rcButton)
1532 // has been empirically determined to be SM_CYCAPTION / 2
1534 n
= ((GetSystemMetrics( SM_CYCAPTION
)) / 2) -
1535 (rcButton
.right
- rcButton
.left
) ;
1537 InflateRect( &rcButton
, n
/2-1, n
/2-1 ) ;
1540 DrawArrow( hDC
, &rcButton
, ARROW_DOWN
) ;
1542 if (IsZoomed( hWnd
))
1544 DrawArrow( hDC
, &rcButton
, ARROW_RESTORE
) ;
1547 DrawArrow( hDC
, &rcButton
, ARROW_UP
) ;
1550 ReleaseDC( hWnd
, hDC
) ;
1558 // Draws either a up or down arrow. The arrow is bound by the rectangle
1560 void PASCAL
DrawArrow( HDC hdc
, LPRECT lprc
, UINT uiStyle
)
1566 int nMax
= (lprc
->bottom
- lprc
->top
) >> 1 ;
1568 SetBkColor( hdc
, RGBBLACK
) ;
1570 // We draw the arrow by drawing a series of horizontal lines
1572 xTip
= lprc
->left
+ ((lprc
->right
- lprc
->left
+1) >> 1) ;
1576 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1577 for (row
= 1 ; row
<= nMax
; row
++ )
1579 rc
.left
= xTip
- row
;
1580 rc
.right
= xTip
+ row
- 1 ;
1581 rc
.top
= yTip
+ row
;
1582 rc
.bottom
= rc
.top
+ 1 ;
1583 DRAWFASTRECT( hdc
, &rc
) ;
1588 yTip
= lprc
->bottom
- ((lprc
->bottom
- lprc
->top
-1) >> 2) ;
1589 for ( row
= nMax
; row
> 0 ; 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
) ;
1601 yTip
= lprc
->top
+ ((lprc
->bottom
- lprc
->top
-1) >> 3) - 2;
1602 for (row
= 1 ; row
<= nMax
; row
++ )
1604 rc
.left
= xTip
- row
;
1605 rc
.right
= xTip
+ row
- 1 ;
1606 rc
.top
= yTip
+ row
;
1607 rc
.bottom
= rc
.top
+ 1 ;
1608 DRAWFASTRECT( hdc
, &rc
) ;
1611 yTip
+= (nMax
+1) * 2 ;
1612 for ( row
= nMax
; row
> 0 ; row
-- )
1614 rc
.left
= xTip
- row
;
1615 rc
.right
= xTip
+ row
- 1 ;
1616 rc
.top
= yTip
- row
;
1617 rc
.bottom
= rc
.top
+ 1 ;
1618 DRAWFASTRECT( hdc
, &rc
) ;
1625 #endif // wxUSE_ITSY_BITSY