コード例 #1
0
ファイル: tinycapt.cpp プロジェクト: bowlofstew/Meridian59
//
/// Paints a close box on the tiny caption bar. You can override the default box if
/// you want to design your own close box.
//
void
TTinyCaption::PaintCloseBox(TDC& dc, TRect& boxRect, bool pressed)
{
    // Fill the box with light gray & draw bevel if possible
    //
    PaintButton(dc, boxRect, pressed);

    if (pressed)
        boxRect.Offset(1,1);

    // Do something different to differentiate from standard system menu--
    // draw a recessed black box glyph about half the button size, centered
    //
    int glyphWidth  = boxRect.Width() > 7 ?
                      boxRect.Width()-boxRect.Width()/2-1 : boxRect.Width()-3;
    int glyphHeight = boxRect.Height() > 7 ?
                      boxRect.Height()-boxRect.Height()/2-1 : boxRect.Height()-3;
    if (glyphWidth > 1 && glyphHeight > 1) {
        TRect glyphRect(0, 0, glyphWidth, glyphHeight);
        glyphRect.Offset(boxRect.left + (boxRect.Width()-glyphWidth-1)/2,
                         boxRect.top + (boxRect.Height()-glyphHeight-1)/2);

        dc.TextRect(glyphRect, TColor::Sys3dShadow);
        glyphRect.Offset(1,1);
        dc.TextRect(glyphRect, TColor::Sys3dHilight);
        glyphRect.BottomRight().Offset(-1,-1);
        dc.TextRect(glyphRect, TColor::SysBtnText);
    }
}
コード例 #2
0
ファイル: tinycapt.cpp プロジェクト: bowlofstew/Meridian59
//
/// Paints the system box.
//
void
TTinyCaption::PaintSysBox(TDC& dc, TRect& boxRect, bool /*pressed*/)
{
    // Dont paint over the left & top borders
    //
    boxRect.left++;
    boxRect.top++;

    // Fill the box with 3d face
    //
    dc.TextRect(boxRect, TColor::Sys3dFace);

    // Draw the ventilator (sysmenu) box, with shadow
    //
    TPoint begPt = boxRect.TopLeft().OffsetBy(2, (boxRect.Height()-3)/2);
    TRect ventRect(begPt, TSize(boxRect.Width()-5, 3));

    // Draw shadow down and right 1
    //
    dc.TextRect(ventRect.left+1, ventRect.top+1,
                ventRect.right+1, ventRect.bottom+1, TColor::Sys3dShadow);

    // Draw ventilator rectangle
    //
    TBrush btnTextBr(TColor::SysBtnText);
    dc.FrameRect(ventRect, btnTextBr);

    // Draw white interior of ventilator
    //
    dc.TextRect(ventRect.left+1, ventRect.top+1,
                ventRect.right-1, ventRect.top+2, TColor::Sys3dHilight);

    dc.TextRect(boxRect.right, boxRect.top,
                boxRect.right+1, boxRect.bottom, TColor::SysBtnText);
}
コード例 #3
0
ファイル: messageb.cpp プロジェクト: Meridian59/Meridian59
//
/// Adjusts the message bar and paints a highlight line. Then, PaintGadgets either
/// paints the hint text if any is set or calls TGadgetWindow::PaintGadgets to
/// repaint each gadget.
//
void
TMessageBar::PaintGadgets(TDC& dc, bool erase, TRect& rect)
{
  if (HighlightLine && rect.top == 0)
    dc.TextRect(0, 0, rect.right, TUIMetric::CyBorder, TColor::Sys3dHilight);

  if (!HintText.empty())
  {
    TRect clientRect = GetClientRect();
    int y = (clientRect.bottom - GetFontHeight()) / 2;
    if (HighlightLine)
      clientRect.top += TUIMetric::CyBorder;
    dc.SelectObject(GetFont());
    dc.SetBkColor(TColor::Sys3dFace);
    dc.ExtTextOut(5, y, ETO_OPAQUE, &clientRect, HintText, static_cast<int>(HintText.length()));
  }
  else
  {
    TGadgetWindow::PaintGadgets(dc, erase, rect);
  }
}
コード例 #4
0
ファイル: tinycapt.cpp プロジェクト: bowlofstew/Meridian59
//
/// Paints a blank button.
//
void
TTinyCaption::PaintButton(TDC& dc, TRect& r, bool pressed)
{
    TBrush winFrameBr(TColor::SysWindowFrame);
//  dc.OWLFastWindowFrame(winFrameBr, r, 1, 1);
    dc.FrameRect(r, winFrameBr);

    r.Inflate(-1,-1);
    dc.TextRect(r, TColor::Sys3dFace);
    if (r.Width() > 4 && r.Height() > 4) {
        if (pressed) {
            dc.TextRect(r.left, r.top, r.right, r.top+1, TColor::Sys3dShadow);
            dc.TextRect(r.left, r.top+1, r.left+1, r.bottom, TColor::Sys3dShadow);
        }
        else {
            dc.TextRect(r.left, r.top, r.right-1, r.top+1, TColor::Sys3dHilight);
            dc.TextRect(r.left, r.top+1, r.left+1, r.bottom-1, TColor::Sys3dHilight);
            dc.TextRect(r.right-1, r.top+1, r.right, r.bottom, TColor::Sys3dShadow);
            dc.TextRect(r.left+1, r.bottom-1, r.right-1, r.bottom, TColor::Sys3dShadow);
        }
    }
}