Improvements to the control strip on the nav bar. Fix for the status bar bug

where the status bar isn't taking over the whole area at the bottom like it
should.
This commit is contained in:
hyatt%netscape.com 1998-08-04 08:25:37 +00:00
Родитель e9866e9ec6
Коммит 0cff887d68
5 изменённых файлов: 159 добавлений и 10 удалений

Просмотреть файл

@ -42,19 +42,20 @@ BEGIN_MESSAGE_MAP(CNavTitleBar, CWnd)
ON_WM_LBUTTONUP ( )
ON_WM_MOUSEMOVE()
ON_WM_PAINT()
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CNavTitleBar::CNavTitleBar()
:m_bHasFocus(FALSE)
:m_bHasFocus(FALSE), m_bDrawCloseFrame(FALSE), m_bDrawModeFrame(FALSE)
{
m_pBackgroundImage = NULL;
m_View = NULL;
m_hFocusTimer = 0;
}
CNavTitleBar::~CNavTitleBar()
{
// delete m_pMenuButton;
}
void CNavTitleBar::OnPaint( )
@ -242,7 +243,7 @@ void CNavTitleBar::OnPaint( )
cachedModeRect.top = 0;
cachedModeRect.left = 0;
cachedModeRect.bottom = NAVBAR_CONTROLSTRIP_HEIGHT;
cachedModeRect.right = modeRect.right;
cachedModeRect.right = modeRect.right + 3;
// Now compute the close box rect.
CString closeText("close");
@ -262,22 +263,40 @@ void CNavTitleBar::OnPaint( )
closeRect.top = modeRect.top;
closeRect.bottom = modeRect.bottom;
CRect arrowRect;
arrowRect.top = 0;
arrowRect.left = closeRect.left - 12;
arrowRect.right = arrowRect.left + 12;
arrowRect.bottom = NAVBAR_CONTROLSTRIP_HEIGHT;
DrawArrow(dc.m_hDC, m_ControlStripForegroundColor, LEFT_ARROW, arrowRect, TRUE);
// Cache the rect
cachedCloseRect.top = 0;
cachedCloseRect.left = 0;
cachedCloseRect.left = arrowRect.left;
cachedCloseRect.bottom = NAVBAR_CONTROLSTRIP_HEIGHT;
cachedCloseRect.right = closeRect.right;
cachedCloseRect.right = closeRect.right + 3;
// Draw the text
dc.SetTextColor(m_ControlStripForegroundColor);
dc.DrawText((LPCSTR)closeText, -1, &closeRect, nFormat);
dc.DrawText((LPCSTR)modeText, -1, &modeRect, nFormat);
// See if we're supposed to draw a framing rect.
CBrush controlBrush(m_ControlStripForegroundColor);
if (m_bDrawCloseFrame)
{
dc.FrameRect(cachedCloseRect, &controlBrush);
}
if (m_bDrawModeFrame)
{
dc.FrameRect(cachedModeRect, &controlBrush);
}
dc.SetTextColor(oldColor);
dc.SetBkMode(nOldBkMode);
::SelectObject(dc.m_hDC, hOldFont);
::SelectObject(dc.m_hDC, hOldFont);
}
int CNavTitleBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
@ -330,6 +349,28 @@ void CNavTitleBar::OnMouseMove(UINT nFlags, CPoint point)
}
else
{
BOOL oldCloseFrame = m_bDrawCloseFrame;
BOOL oldModeFrame = m_bDrawModeFrame;
m_bDrawCloseFrame = FALSE;
m_bDrawModeFrame = FALSE;
if (cachedCloseRect.PtInRect(point))
{
m_bDrawCloseFrame = TRUE;
m_hFocusTimer = SetTimer(IDT_STRIPFOCUS, STRIPFOCUS_DELAY_MS, NULL);
}
else if (cachedModeRect.PtInRect(point))
{
m_bDrawModeFrame = TRUE;
m_hFocusTimer = SetTimer(IDT_STRIPFOCUS, STRIPFOCUS_DELAY_MS, NULL);
}
if (oldCloseFrame != m_bDrawCloseFrame)
InvalidateRect(cachedCloseRect);
if (oldModeFrame != m_bDrawModeFrame)
InvalidateRect(cachedModeRect);
}
}
@ -351,3 +392,31 @@ void CNavTitleBar::SetHTView(HT_View view)
m_View = view;
Invalidate();
}
void CNavTitleBar::OnTimer(UINT nIDEvent)
{
if (nIDEvent == IDT_STRIPFOCUS)
{
POINT point;
KillTimer(IDT_STRIPFOCUS);
m_hFocusTimer = 0;
GetCursorPos(&point);
CRect rcClient;
GetWindowRect(&rcClient);
if (!rcClient.PtInRect(point))
{
m_bDrawCloseFrame = FALSE;
m_bDrawModeFrame = FALSE;
Invalidate();
UpdateWindow();
}
else
m_hFocusTimer = SetTimer(IDT_STRIPFOCUS, STRIPFOCUS_DELAY_MS, NULL);
}
CWnd::OnTimer(nIDEvent);
}

Просмотреть файл

@ -48,6 +48,10 @@ class CNavTitleBar : public CWnd, public CCustomImageObject
CRect cachedCloseRect;
CRect cachedModeRect;
BOOL m_bDrawCloseFrame;
BOOL m_bDrawModeFrame;
UINT m_hFocusTimer;
public:
CNavTitleBar();
@ -68,9 +72,14 @@ public:
afx_msg void OnLButtonUp (UINT nFlags, CPoint point );
afx_msg void OnMouseMove (UINT nFlags, CPoint point );
afx_msg void OnSize( UINT nType, int cx, int cy );
afx_msg void OnTimer(UINT nIDEvent);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#define IDT_STRIPFOCUS 30000
#define STRIPFOCUS_DELAY_MS 10
#endif // NAVBAR_H

Просмотреть файл

@ -204,4 +204,13 @@ void Compute3DColors(COLORREF rgbColor, COLORREF &rgbLight, COLORREF &rgbDark);
// use against a custom background.
void ResolveToPaletteColor(COLORREF& color, HPALETTE hPal);
void DrawArrow(HDC hDC, COLORREF arrowColor, int type, CRect rect, BOOL enabled);
// Can be used to draw 4-pixel (1,3,5,7) arrowheads in any direction.
const int LEFT_ARROW = 0;
const int RIGHT_ARROW = 1;
const int DOWN_ARROW = 2;
const int UP_ARROW = 3;
#endif // RDFACC_H

Просмотреть файл

@ -1616,6 +1616,7 @@ void CRDFOutliner::OnMouseMove(UINT nFlags, CPoint point)
SelectItem( m_iSelection, OUTLINER_LBUTTONUP, nFlags );
}
}
if (m_iTipState != TIP_SHOWING)
m_iTipState = TIP_WAITING;
HandleMouseMove( point );
@ -2086,6 +2087,67 @@ GetSystem3DColors(COLORREF rgbBackground, COLORREF& rgbLightColor, COLORREF& rgb
#define COLOR_DARK_THRESHOLD 51
#define COLOR_LIGHT_THRESHOLD 204
void DrawArrow(HDC hDC, COLORREF arrowColor, int type, CRect rect, BOOL enabled)
{
HPEN hArrowPen = ::CreatePen(PS_SOLID, 1, arrowColor);
HPEN hOldPen = (HPEN)::SelectObject(hDC, hArrowPen);
int size = (type == UP_ARROW || type == DOWN_ARROW) ? rect.Width() : rect.Height();
int endPoint = (type == UP_ARROW || type == DOWN_ARROW) ? rect.left : rect.top;
if (type == UP_ARROW)
{
for (int j = 0; j < 4; j++)
{
int yPos = rect.top + (rect.Height()/2) - 2 + j;
int x1 = rect.left + (rect.Width()/2) - j;
int x2 = x1 + 2*j;
::MoveToEx(hDC, x1, yPos,NULL);
::LineTo(hDC, x2+1, yPos);
}
}
else if (type == DOWN_ARROW)
{
// Draw a down arrow.
for (int j = 0; j < 4; j++)
{
int yPos = rect.top + (rect.Height()/2) + 1 - j;
int x1 = rect.left + (rect.Width()/2) - j;
int x2 = x1 + 2*j;
::MoveToEx(hDC,x1,yPos,NULL);
::LineTo(hDC,x2+1,yPos);
}
}
else if (type == LEFT_ARROW)
{
for (int j = 0; j < 4; j++)
{
int xPos = rect.left + (rect.Width()/2) - 2 + j;
int y1 = rect.top + (rect.Height()/2) - j;
int y2 = y1 + 2*j;
::MoveToEx(hDC,xPos,y1,NULL);
::LineTo(hDC,xPos,y2+1);
}
}
else if (type == RIGHT_ARROW)
{
// Draw a down arrow.
for (int j = 0; j < 4; j++)
{
int xPos = rect.left + (rect.Width()/2) + 1 - j;
int y1 = rect.top + (rect.Height()/2) - j;
int y2 = y1 + 2*j;
::MoveToEx(hDC,xPos,y1,NULL);
::LineTo(hDC,xPos,y2+1);
}
}
::SelectObject(hDC, hOldPen);
VERIFY(::DeleteObject(hArrowPen));
}
void Compute3DColors(COLORREF rgbColor, COLORREF &rgbLight, COLORREF &rgbDark)
{
unsigned uRed, uGreen, uBlue;

Просмотреть файл

@ -428,8 +428,8 @@ void CNetscapeStatusBar::SetupMode()
// WHS -- I'm assuming we'll always have these, probably not good in the long term
//
SetPaneInfo( CommandToIndex( ID_SEPARATOR ), ID_SEPARATOR, SBPS_STRETCH, 0 );
idx = CommandToIndex(IDS_TRANSFER_STATUS);
if(idx > -1) {
SetPaneInfo( idx, IDS_TRANSFER_STATUS, SBPS_NORMAL, 90 );