Beispiel #1
0
/*--------------------------------------------------------------------------*/
void PegMenu::Draw(void)
{
    BeginDraw();

    if (NumColors() >= 4)
    {
	    PegColor Color(muColors[PCI_NORMAL], muColors[PCI_NORMAL], CF_FILL);
	    Rectangle(mReal, Color, 0);
	
	    // outline myself:
	    Color.uForeground = PCLR_HIGHLIGHT;
	    Line(mReal.wLeft + 1, mReal.wTop + 1, mReal.wLeft + 1,
	        mReal.wBottom, Color);
	    Line(mReal.wLeft + 1, mReal.wTop + 1, mReal.wRight - 1,
	        mReal.wTop + 1, Color);
	    Color.uForeground = PCLR_LOWLIGHT;
	    Line(mReal.wLeft + 1, mReal.wBottom - 1, mReal.wRight - 1,
	        mReal.wBottom - 1, Color);
	    Line(mReal.wRight - 1, mReal.wTop + 1, mReal.wRight - 1,
	        mReal.wBottom - 1, Color);
	    Color.uForeground = PCLR_SHADOW;
	    Line(mReal.wLeft, mReal.wBottom, mReal.wRight,
	        mReal.wBottom, Color);
	    Line(mReal.wRight, mReal.wTop, mReal.wRight,
	        mReal.wBottom, Color);
    }
    else
    {
        PegColor Color(PCLR_SHADOW, muColors[PCI_NORMAL], CF_FILL);
        Rectangle(mReal, Color, 1);
    }
    PegThing::Draw();
    EndDraw();
}
Beispiel #2
0
/*--------------------------------------------------------------------------*/
void PegWindow::DrawFrame(BOOL bFill)
{
    PegColor Color(PCLR_BORDER, muColors[PCI_NORMAL], CF_FILL);

    DWORD dColors = NumColors();

    if (dColors < 4)
    {
        Color.uForeground = PCLR_SHADOW;
    }

    if (bFill)
    {
	printf("mwStyle=%x\n",mwStyle);
        switch(mwStyle & FF_MASK)
        {
        case FF_THICK:
		printf("df1\n");
            Rectangle(mReal, Color, PEG_FRAME_WIDTH);
            break;

        case FF_RAISED:
        case FF_RECESSED:
            if (dColors >= 4)
            {
		printf("df2\n");
                Rectangle(mReal, Color, 0);
                break;
                // else for monochrome, fall through to FF_THIN code:
            }

        case FF_THIN:
            Color.uForeground = PCLR_SHADOW;
            Rectangle(mReal, Color, 1);
            break;


        case FF_NONE:
        default:
            Rectangle(mReal, Color, 0);
        }
    }

    if ((dColors >= 4 && (mwStyle & (FF_THICK|FF_RAISED))) ||
        (dColors < 4 && (mwStyle & FF_THICK)))
    {
        Color.uForeground = PCLR_HIGHLIGHT;

        // add highlights:

        Line(mReal.wLeft + 1, mReal.wTop + 1,
            mReal.wLeft + 1, mReal.wBottom, Color);
        Line(mReal.wLeft + 2, mReal.wTop + 1, mReal.wRight - 1,
            mReal.wTop + 1, Color);

        Color.uForeground = PCLR_LOWLIGHT;

        // add edge
        Line(mReal.wRight - 1, mReal.wTop + 1, mReal.wRight - 1,
            mReal.wBottom - 1, Color);
        Line(mReal.wLeft + 1, mReal.wBottom - 1, mReal.wRight - 1,
            mReal.wBottom - 1, Color);

        // add shadows:

        Color.uForeground = PCLR_SHADOW;

        Line(mReal.wRight, mReal.wTop, mReal.wRight,
            mReal.wBottom, Color);
        Line(mReal.wLeft, mReal.wBottom, mReal.wRight,
            mReal.wBottom, Color);

    }

    if (dColors >= 4)
    {
	    if (mwStyle & FF_RECESSED)
	    {
	        Color.uForeground = PCLR_HIGHLIGHT;
	
	        // add highlights:
	
	        Line(mReal.wLeft, mReal.wBottom,
	            mReal.wRight, mReal.wBottom, Color);
	        Line(mReal.wRight, mReal.wTop, mReal.wRight,
	            mReal.wBottom, Color);
	
	        Color.uForeground = PCLR_LOWLIGHT;
	
	        // add edge
	        Line(mReal.wLeft, mReal.wTop, mReal.wRight,
	            mReal.wTop, Color);
	        Line(mReal.wLeft, mReal.wTop + 1, mReal.wLeft,
	            mReal.wBottom, Color);
	
	        Color.uForeground = PCLR_SHADOW;
	
	        // add edge
	        Line(mReal.wLeft + 1, mReal.wTop + 1, mReal.wRight - 2,
	            mReal.wTop + 1, Color);
	        Line(mReal.wLeft + 1, mReal.wTop + 1, mReal.wLeft + 1,
	            mReal.wBottom - 1, Color);
	
	        // add shadows:
	
	        Color.uForeground = PCLR_DIALOG;
	
	        Line(mReal.wLeft + 1, mReal.wBottom - 1,
	            mReal.wRight - 1, mReal.wBottom - 1, Color);
	        Line(mReal.wRight - 1, mReal.wTop + 1,
	            mReal.wRight - 1, mReal.wBottom - 1, Color);
	    }
    }

    if (mwStyle & FF_THICK)
    {
        Color.uForeground = PCLR_HIGHLIGHT;

        Line(mReal.wRight - PEG_FRAME_WIDTH + 2,
             mReal.wTop + PEG_FRAME_WIDTH - 1,
             mReal.wRight - PEG_FRAME_WIDTH + 2,
             mReal.wBottom - PEG_FRAME_WIDTH + 2, Color);
        
        Line(mReal.wLeft + PEG_FRAME_WIDTH - 1,
             mReal.wBottom - PEG_FRAME_WIDTH + 2,
             mReal.wRight - PEG_FRAME_WIDTH + 2,
             mReal.wBottom - PEG_FRAME_WIDTH + 2, Color);

        Color.uForeground = PCLR_LOWLIGHT;

        Line(mReal.wLeft + PEG_FRAME_WIDTH - 1, mClient.wTop - 1,
            mReal.wRight - PEG_FRAME_WIDTH, mClient.wTop - 1, Color);

        Line(mClient.wLeft - 1, mClient.wTop,
            mClient.wLeft - 1, mReal.wBottom - PEG_FRAME_WIDTH + 1, Color);
    }
}
Beispiel #3
0
/*--------------------------------------------------------------------------*/
void PegTextButton::Draw(void)
{
    BeginDraw();
    PegButton::Draw();
    PegColor Color;

   #if defined(ACTIVE_BUTTON_COLOR_CHANGE)
    if (StatusIs(PSF_CURRENT))
    {
        Color.Set(muColors[PCI_STEXT], muColors[PCI_SELECTED], CF_NONE);
    }
    else
    {
        Color.Set(muColors[PCI_NTEXT], muColors[PCI_NORMAL], CF_NONE);
    }
   #else
        Color.Set(muColors[PCI_NTEXT], muColors[PCI_NORMAL], CF_NONE);
   #endif

    if (NumColors() < 4)
    {
        Color.uFlags = CF_FILL;
    }

    if (!(Style() & AF_ENABLED))
    {
        Color.uForeground = PCLR_LOWLIGHT;
    }

    // now draw the text:

    PegPoint Put;
    SIGNED iSize;

    if (Style() & TJ_LEFT)
    {
       #ifdef PEG_DRAW_FOCUS
        Put.x = mClient.wLeft + 3;
       #else
        Put.x = mClient.wLeft + 1;
       #endif
    }
    else
    {
        iSize = TextWidth(mpText, mpFont);

        if (Style() & TJ_RIGHT)
        {
           #ifdef PEG_DRAW_FOCUS
            Put.x = mClient.wRight - iSize - 3;
           #else
            Put.x = mClient.wRight - iSize - 1;
           #endif
        }
        else
        {
            Put.x = mClient.wLeft + (mClient.Width() - iSize) / 2;
        }
    }

    iSize = TextHeight(mpText, mpFont);
    if (iSize <= mClient.Height())
    {
        Put.y = mClient.wTop + (mClient.Height() - iSize) / 2;
    }
    else
    {
        Put.y = mClient.wTop;
    }

    DrawText(Put, mpText, Color, mpFont);

    if (NumColors() < 4)
    {
        if (!(Style() & AF_ENABLED))
        {
            SIGNED yCenter = (mClient.wTop + mClient.wBottom) / 2;
            Line(Put.x, yCenter, Put.x + TextWidth(mpText, mpFont), yCenter, Color);
        }
    }

    if (First())
    {
        DrawChildren();
    }
    EndDraw();
}
Beispiel #4
0
/*--------------------------------------------------------------------------*/
void PegButton::Draw(void)
{
    if (PegThing::Style() & AF_TRANSPARENT)
    {
        return;
    }
    PegColor Color;

    BeginDraw();

    if (NumColors() >= 4)
    {
        Color.Set(PCLR_SHADOW, muColors[PCI_NORMAL], CF_FILL);

       #if defined(ACTIVE_BUTTON_COLOR_CHANGE)
        if (StatusIs(PSF_CURRENT))
        {
            Color.uBackground = muColors[PCI_SELECTED];
        }
       #endif

	    // fill in the face:
	
	    mClient = mReal;
	    mClient--;
	
	    Rectangle(mReal, Color, 0);
	
	    if (mwStyle & FF_NONE)
	    {
           #ifdef PEG_DRAW_FOCUS
            if (StatusIs(PSF_CURRENT))
            {
                DrawFocusIndicator(FALSE);
            }
           #endif

	        EndDraw();
	        return;
	    }
	
	    // draw the highlights:
	
	    Color.uForeground = PCLR_LOWLIGHT;
	
	    if (mwStyle & BF_SELECTED)
	    {
	        Line(mReal.wLeft + 1, mReal.wTop + 1, mReal.wRight - 1,
	            mReal.wTop + 1, Color);
	        Line(mReal.wLeft + 1, mReal.wTop + 2, mReal.wLeft + 1,
	            mReal.wBottom - 1, Color);
	        Color.uForeground = PCLR_SHADOW;
	        mClient.wTop++;
	        mClient.wLeft++;
	    }
	    else
	    {
	        Line(mReal.wRight - 1, mReal.wTop + 1, mReal.wRight - 1,
	            mReal.wBottom - 1, Color);
	        Line(mReal.wLeft + 1, mReal.wBottom - 1, mReal.wRight - 2,
	            mReal.wBottom - 1, Color);
	        Color.uForeground = PCLR_HIGHLIGHT;
	        mClient.wRight--;
	        mClient.wBottom--;
	    }
	
	    if (mwStyle & BF_FULLBORDER)
	    {
	        Line(mReal.wLeft + 1, mReal.wTop + 1, mReal.wLeft + 1,
	             mReal.wBottom, Color);
	        Line(mReal.wLeft + 1, mReal.wTop + 1, mReal.wRight - 1,
	             mReal.wTop + 1, Color);
	        mClient.wTop++;
	        mClient.wLeft++;
	    }
	    else
	    {
	        Line(mReal.wLeft, mReal.wTop, mReal.wLeft,
	             mReal.wBottom, Color);
	        Line(mReal.wLeft, mReal.wTop, mReal.wRight,
	             mReal.wTop, Color);
	    }
	
	    if (mwStyle & BF_SELECTED)
	    {
	        Color.uForeground = PCLR_HIGHLIGHT;
	    }
	    else
	    {
	        Color.uForeground = PCLR_SHADOW;
	    }
	
	    Line(mReal.wLeft, mReal.wBottom, mReal.wRight,
	         mReal.wBottom, Color);
	    Line(mReal.wRight, mReal.wTop, mReal.wRight,
	         mReal.wBottom, Color);
    }
    else
    {
	    // here for monochrome:
	    PegColor Color(PCLR_SHADOW, muColors[PCI_NORMAL], CF_FILL);

       #if defined(ACTIVE_BUTTON_COLOR_CHANGE)

        if (StatusIs(PSF_CURRENT))
        {
            Color.uBackground = muColors[PCI_SELECTED];
        }
       #endif

	    mClient = mReal;
	
	    Rectangle(mReal, Color, 1);
	    mClient--;
	     
	    if (mwStyle & BF_SELECTED)
	    {
	        mClient.wTop++;
	        mClient.wLeft++;
	        Line(mReal.wLeft, mReal.wTop + 1, mReal.wRight, mReal.wTop + 1,
	            Color);
	        Line(mReal.wLeft + 1, mReal.wTop + 2, mReal.wLeft + 1, mReal.wBottom,
	            Color);
	    }
	    else
	    {
	        mClient.wRight--;
	        mClient.wBottom--;
	        Line(mReal.wLeft, mReal.wBottom - 1, mReal.wRight, mReal.wBottom - 1,
	            Color);
	        Line(mReal.wRight - 1, mReal.wTop + 1, mReal.wRight - 1,
	            mReal.wBottom - 1, Color);
	    }
    }

   #ifdef PEG_DRAW_FOCUS
    if (StatusIs(PSF_CURRENT))
    {
        DrawFocusIndicator(FALSE);
    }
   #endif

    EndDraw();
}
Beispiel #5
0
/*--------------------------------------------------------------------------*/
void PegCheckBox::Draw(void)
{
    PegBitmap *pbm;
    PegColor Color;

   #if defined(ACTIVE_BUTTON_COLOR_CHANGE)
    if (StatusIs(PSF_CURRENT))
    {
        Color.Set(muColors[PCI_STEXT], muColors[PCI_SELECTED], CF_NONE);
    }
    else
    {
        Color.Set(muColors[PCI_NTEXT], muColors[PCI_NORMAL], CF_NONE);
    }
   #else
    Color.Set(muColors[PCI_NTEXT], muColors[PCI_NORMAL], CF_NONE);
   #endif

    if (NumColors() < 4)
    {
        Color.uFlags = CF_FILL;
    }

    if (!(mwStyle & AF_ENABLED))
    {
        Color.uForeground = PCLR_LOWLIGHT;
        if (mwStyle & BF_SELECTED)
        {
            pbm = &gbCheckBoxOnDisabledBitmap;
        }
        else
        {
            pbm = &gbCheckBoxOffDisabledBitmap;
        }
    }
    else
    {
        if (mwStyle & BF_SELECTED)
        {
            pbm = &gbCheckBoxOnBitmap;
        }
        else
        {
            pbm = &gbCheckBoxOffBitmap;
        }
    }
    BeginDraw();

    SIGNED yCenter = (mReal.wTop + mReal.wBottom) / 2;
    PegPoint Put;

   #ifdef PEG_DRAW_FOCUS
    Put.x = mReal.wLeft + 3;
   #else
    Put.x = mReal.wLeft;
   #endif
    Put.y = yCenter - (pbm->wHeight / 2);
    Bitmap(Put, pbm);

    // now draw the text:

    Put.x = mReal.wLeft + pbm->wWidth + CBOX_SPACING;
    WORD wSize = TextHeight(mpText, mpFont);
    Put.y = yCenter - (wSize / 2);
    DrawText(Put, mpText, Color, mpFont);

    if (NumColors() < 4)
    {
        if (!(mwStyle & AF_ENABLED))
        {
            Line(Put.x, yCenter, Put.x + TextWidth(mpText, mpFont) - 2, yCenter, Color);
        }
    }

   #ifdef PEG_DRAW_FOCUS
    if (StatusIs(PSF_CURRENT))
    {
        DrawFocusIndicator(FALSE);
    }
   #endif
    EndDraw();
}
//=========================================================================
void Epetra_MapColoring::Print(std::ostream& os) const {
  int MyPID = Map().Comm().MyPID();
  int NumProc = Map().Comm().NumProc();
  
  if (MyPID==0) os 
    << std::endl 
    << " *****************************************" << std::endl
    << " Coloring information arranged map element" << std::endl 
    << " *****************************************" << std::endl
    << std::endl;
  for (int iproc=0; iproc < NumProc; iproc++) {
    if (MyPID==iproc) {
      int NumMyElements1 =Map(). NumMyElements();

      if (MyPID==0) {
  os.width(8);
  os <<  "     MyPID"; os << "    ";
  os.width(12);
  os <<  "GID  ";
  os.width(20);
  os <<  "Color  ";
  os << std::endl;
      }
      for (int i=0; i < NumMyElements1; i++) {
  os.width(10);
  os <<  MyPID; os << "    ";
  os.width(10);

    if(Map().GlobalIndicesInt()) {
#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
        int * MyGlobalElements1 = Map().MyGlobalElements();
        os << MyGlobalElements1[i] << "    ";
#else
        throw ReportError("Epetra_MapColoring::Print: ERROR, GlobalIndicesInt but no API for it.",-1);
#endif
    }
    else if(Map().GlobalIndicesLongLong())
    {
#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
    long long * MyGlobalElements1 = Map().MyGlobalElements64();
    os << MyGlobalElements1[i] << "    ";
#else
        throw ReportError("Epetra_MapColoring::Print: ERROR, GlobalIndicesLongLong but no API for it.",-1);
#endif
    }
    else
    throw ReportError("Epetra_MapColoring::Print: ERROR, Don't know map global index type.",-1);

  os.width(20);
  os <<  ElementColors_[i];
  os << std::endl;
      }
      os << std::flush; 
    }

    // Do a few global ops to give I/O a chance to complete
    Map().Comm().Barrier();
    Map().Comm().Barrier();
    Map().Comm().Barrier();
  }

  if (MyPID==0) os 
    << std::endl 
    << " **************************************" << std::endl
    << " Coloring information arranged by color" << std::endl 
    << " **************************************" << std::endl
    << std::endl;
  {for (int iproc=0; iproc < NumProc; iproc++) {
    if (MyPID==iproc) {
      if (NumColors()==0) os << " No colored elements on processor " << MyPID << std::endl;
      else {
        os << "Number of colors in map = " << NumColors() << std::endl
           << "Default color           = " << DefaultColor() << std::endl << std::endl;
        if (MyPID==0) {
          os.width(8);
          os <<  "     MyPID"; os << "    ";
          os.width(12);
          os <<  "LID  ";
          os.width(20);
          os <<  "Color  ";
          os << std::endl;
        }
        int * ColorValues = ListOfColors();
        for (int ii=0; ii<NumColors(); ii++) {
          int CV = ColorValues[ii];
    int ColorCount = NumElementsWithColor(CV);
    int * LIDList = ColorLIDList(CV);
    
    
    for (int i=0; i < ColorCount; i++) {
      os.width(10);
      os <<  MyPID; os << "    ";
      os.width(10);
      os << LIDList[i] << "    ";
      os.width(20);
      os << CV;
      os << std::endl;
    }
    os << std::flush; 
  }
      }
    }
    // Do a few global ops to give I/O a chance to complete
    Map().Comm().Barrier();
    Map().Comm().Barrier();
    Map().Comm().Barrier();
  }}
  return;
}
Beispiel #7
0
/*--------------------------------------------------------------------------*/
PegPrompt::PegPrompt(SIGNED iLeft, SIGNED iTop, SIGNED iWidth,
 const PEGCHAR *Text, WORD wId, WORD wStyle, PegFont *pFont) :
 PegThing(wId, wStyle), PegTextThing(Text, wStyle & TT_COPY, PEG_PROMPT_FONT)
{
    Type(TYPE_PROMPT);

    if (pFont)
    {
        mpFont = pFont;
    }

    mReal.wLeft = iLeft;
    mReal.wTop = iTop;
    mReal.wRight = mReal.wLeft + iWidth;
    mReal.wBottom = mReal.wTop + TextHeight(lsTEST, mpFont) + 2;

    switch(wStyle & FF_MASK)
    {
    case FF_THICK:
        mReal.wBottom += PEG_FRAME_WIDTH * 2;
        break;

    case FF_THIN:
        mReal.wBottom += 2;
        break;

  #ifdef PEG_RUNTIME_COLOR_CHECK
    case FF_RAISED:
    case FF_RECESSED:
        if (NumColors() >= 4)
        {
            mReal.wBottom += 4;
        }
        else
        {
            mReal.wBottom += 2;
        }
        break;
  #else
   #if (PEG_NUM_COLORS != 2)

    case FF_RAISED:
    case FF_RECESSED:
        mReal.wBottom += 4;
        break;
   #endif
  #endif

    default:
        break;
    }
    
    InitClient();

    if (!(wStyle & AF_ENABLED))
    {
        RemoveStatus(PSF_SELECTABLE|PSF_ACCEPTS_FOCUS);
    }
    else
    {
        AddStatus(PSF_TAB_STOP);
        SetSignals(SIGMASK(PSF_FOCUS_RECEIVED));
    }

    muColors[PCI_NTEXT] = PCLR_NORMAL_TEXT;
    muColors[PCI_SELECTED] = PCLR_HIGH_TEXT_BACK;
    muColors[PCI_STEXT] = PCLR_HIGH_TEXT;
    muColors[PCI_NORMAL] = PCLR_CLIENT;
}
Beispiel #8
0
/*--------------------------------------------------------------------------*/
void PegMenuButton::Draw(void)
{
    BeginDraw();
    PegColor Color;
    PegPoint Put;

    if (mwStyle & BF_SEPERATOR)
    {
        int Center = (mReal.wTop + mReal.wBottom) / 2;
        Color.Set(PCLR_LOWLIGHT);
        Line(mReal.wLeft, Center, mReal.wRight, Center, Color);
        Color.Set(PCLR_HIGHLIGHT);
        Line(mReal.wLeft, Center + 1, mReal.wRight, Center + 1,
             Color);
    }
    else
    {
        Put.x = mReal.wLeft;
        if (Parent()->Type() == TYPE_MENU)
        {
            Put.x += MENU_CHECK_WIDTH * 2;
        }
        Put.y = mReal.wTop + 1;

        if (Parent()->Type() == TYPE_MENU)
        {
            if (NumColors() >= 4)
            {
	            if (mwStyle & AF_ENABLED)
	            {
	                if (mbPointerOver)
	                {
	                    Color.Set(muColors[PCI_STEXT],
                                  muColors[PCI_SELECTED], CF_FILL);
	                }
	                else
	                {
	                    Color.Set(muColors[PCI_NTEXT],
                                  muColors[PCI_NORMAL], CF_FILL);
	                }
	            }
	            else
	            {
	                Color.Set(PCLR_LOWLIGHT, muColors[PCI_NORMAL], CF_FILL);
	            }
	
	            Rectangle(mReal, Color, 0);
            }
            else
            {
                Color.Set(muColors[PCI_NTEXT], muColors[PCI_NORMAL], CF_FILL);

                if (mbPointerOver && (mwStyle & AF_ENABLED))
                {
                    Rectangle(mReal, Color, 2);
                }
                else
                {
                    Rectangle(mReal, Color, 0);
                }
            }
        }
        else
        {
            // here if I am on the menu bar:

            if (NumColors() >= 4)
            {
	            Color.Set(muColors[PCI_NORMAL],
                          muColors[PCI_NORMAL], CF_FILL);
	            Rectangle(mReal, Color, 0);
	            PegMenuBar *pBar = (PegMenuBar *) Parent();
	
	            if (mbPointerOver && (mwStyle & AF_ENABLED) || mbSubVisible)
	            {
	                if (pBar->InFlyoverMode())
	                {
	                    Color.uForeground = PCLR_LOWLIGHT;
	                }
	                else
	                {
	                    Color.uForeground = PCLR_HIGHLIGHT;
	                }
	                Line(mReal.wLeft, mReal.wTop, mReal.wRight,
	                    mReal.wTop, Color);
	                Line(mReal.wLeft, mReal.wTop, mReal.wLeft,
	                    mReal.wBottom, Color);
	
	                if (pBar->InFlyoverMode())
	                {
	                    Color.uForeground = PCLR_HIGHLIGHT;
	                }
	                else
	                {
	                    Color.uForeground = PCLR_LOWLIGHT;
	                }
	                Line(mReal.wLeft + 1, mReal.wBottom,
	                    mReal.wRight, mReal.wBottom, Color);
	                Line(mReal.wRight, mReal.wTop, mReal.wRight,
	                    mReal.wBottom, Color);
	            }
	
	            if (mwStyle & AF_ENABLED)
	            {
	                Color.uForeground = muColors[PCI_NTEXT];
	            }
	            else
	            {
	                Color.uForeground = PCLR_LOWLIGHT;
	            }
            }
            else
            {
	            // here for monochrome
	            
	            Color.Set(muColors[PCI_NTEXT], muColors[PCI_NORMAL], CF_FILL);
	
	            if (mbPointerOver && (mwStyle & AF_ENABLED) || mbSubVisible)
	            {
	                Rectangle(mReal, Color, 1);
	            }
	            else
	            {
	                Rectangle(mReal, Color, 0);
	            }
            }
            Put.x += (mReal.Width() - TextWidth(mpText, mpFont)) / 2;
        }

        // finally put the text on top:

        Color.uFlags = CF_NONE;
        DrawText(Put, mpText, Color, mpFont, mwStrLen);
    }

    if (Parent()->Type() == TYPE_MENU && mpSubMenu)
    {
        Put.x = mReal.wRight - gbMoreBitmap.wWidth * 2;
        Put.y = mReal.wTop;
        Put.y += (mReal.Height() - gbMoreBitmap.wHeight) / 2;
        Bitmap(Put, &gbMoreBitmap);
    }
    else
    {
        if (mwStyle & BF_CHECKED)
        {
            // draw the check mark on my left:
            Put.x = mReal.wLeft + MENU_CHECK_WIDTH / 2;
            Put.y = mReal.wTop;
            Put.y += (mReal.Height() - gbCheckBitmap.wHeight) / 2;
            Bitmap(Put, &gbCheckBitmap);
        }
        else
        {
            if (mwStyle & BF_DOTTED)
            {
                Put.x = mReal.wLeft + MENU_CHECK_WIDTH / 2;
                Put.y = mReal.wTop;
                Put.y += (mReal.Height() - gbDotBitmap.wHeight) / 2;
                Bitmap(Put, &gbDotBitmap);
            }
        }
    }

    if (NumColors() < 4)
    {
        if (!(mwStyle & AF_ENABLED))
        {
            Line(mReal.wLeft + 2, Put.y + mReal.Height() / 2,
                 mReal.wRight - 2, Put.y + mReal.Height() / 2, Color);
        }
    }
    EndDraw();
}