示例#1
0
 // Colored table
 void FancyTable(wxArrayString& header, wxArrayPtrVoid& data)
 {
   // Colors, line width and bold font
   SetFillColour(wxColour(255,0,0));
   SetTextColour(255);
   SetDrawColour(wxColour(128,0,0));
   SetLineWidth(.3);
   SetFont(wxS(""),wxS("B"));
   //Header
   double w[4] = {40,35,40,45};
   size_t i;
   for (i = 0; i < header.GetCount(); i++)
   {
     Cell(w[i],7,header[i],wxPDF_BORDER_FRAME, 0, wxPDF_ALIGN_CENTER, 1);
   }
   Ln();
   // Color and font restoration
   SetFillColour(wxColour(224,235,255));
   SetTextColour(0);
   SetFont(wxS(""));
   // Data
   int fill = 0;
   size_t j;
   for (j = 0; j < data.GetCount(); j++)
   {
     wxArrayString* row = (wxArrayString*) data[j];
     Cell(w[0],6,(*row)[0],wxPDF_BORDER_LEFT | wxPDF_BORDER_RIGHT,0,wxPDF_ALIGN_LEFT,fill);
     Cell(w[1],6,(*row)[1],wxPDF_BORDER_LEFT | wxPDF_BORDER_RIGHT,0,wxPDF_ALIGN_LEFT,fill);
     Cell(w[2],6,(*row)[2],wxPDF_BORDER_LEFT | wxPDF_BORDER_RIGHT,0,wxPDF_ALIGN_RIGHT,fill);
     Cell(w[3],6,(*row)[3],wxPDF_BORDER_LEFT | wxPDF_BORDER_RIGHT,0,wxPDF_ALIGN_RIGHT,fill);
     Ln();
     fill = 1 - fill;
   }
   Cell((w[0]+w[1]+w[2]+w[3]),0,wxS(""),wxPDF_BORDER_TOP);
 }
示例#2
0
文件: console.cpp 项目: jennmat/Cinch
	Console::Console( const int width, const int height, const int bg_colour )
		: mConsoleHandle(nullptr), mForeGroundColour(15), mBackgroundColour(0)
	{
		assert(bg_colour >= 0 && bg_colour < 16);
		// Open i/o channel to console screen
// 		mHandle = CreateFile(TEXT("CONOUT$"),
// 			GENERIC_WRITE | GENERIC_READ,
// 			FILE_SHARE_READ | FILE_SHARE_WRITE,
// 			0L, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0L);
		AllocConsole();
		RedirectStandardIO();
		mConsoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);

		mCursor.dwSize = 100;
		mCursor.bVisible = true;

		COORD console_size = {width, height};
		SetConsoleScreenBufferSize(mConsoleHandle, console_size);
		SetConsoleCursorInfo(mConsoleHandle, &mCursor);
		GetConsoleScreenBufferInfo(mConsoleHandle, &mConsoleInfo);

		SetBackgroundColour(bg_colour);
		SetTextColour(mForeGroundColour);
		Clear();
	}
示例#3
0
void HKWidgetLabel::SetProperty(const char *pProperty, const char *pValue)
{
	if(!MFString_CaseCmp(pProperty, "text"))
		SetText(pValue);
	else if(!MFString_CaseCmp(pProperty, "text_colour"))
		SetTextColour(HKWidget_GetColourFromString(pValue));
	else if(!MFString_CaseCmp(pProperty, "text_height"))
		SetTextHeight(MFString_AsciiToFloat(pValue));
	else if(!MFString_CaseCmp(pProperty, "text_shadowDepth"))
		SetShadowDepth(MFString_AsciiToFloat(pValue));
	else if(!MFString_CaseCmp(pProperty, "text_font"))
	{
		if(bOwnFont)
			MFFont_Release(pFont);
		pFont = MFFont_Create(pValue);
		bOwnFont = true;

		if(bAutoTextHeight)
			textHeight = MFFont_GetFontHeight(pFont);

		AdjustSize();
	}
	else if(!MFString_CaseCmp(pProperty, "text_align"))
		SetTextJustification((MFFontJustify)HKWidget_GetEnumValue(pValue, sJustifyKeys));
	else
		HKWidget::SetProperty(pProperty, pValue);
}
示例#4
0
/// ---------------------------------------------------------------------------
/// Sets the console text and background colours
/// ---------------------------------------------------------------------------
void prConsoleWindow::SetConsoleColours(prConsoleColour foreground, prConsoleColour background)
{
    if (scrbuf != INVALID_HANDLE_VALUE)
    {
        WORD fore = SetTextColour(foreground);
        WORD back = SetBackgroundColour(background);
        SetConsoleTextAttribute(scrbuf, fore | back);

        //DWORD written = 0;
        //COORD writeCoord = {0};
        //WORD attribute;
        //for (int y = 0; y < mConsoleHeight; y++)
        //{
        //    for (int x = 0; x < mConsoleWidth; x++)
        //    {
        //        writeCoord.X = x; 
        //        writeCoord.Y = y;
        //        ReadConsoleOutputAttribute(scrbuf, &attribute, 1, writeCoord, &written);
        //        attribute &= 0xFF0F;    // Clear background color
        //        attribute |= back;      // Change to new background color
        //        FillConsoleOutputAttribute(scrbuf, attribute, 1, writeCoord, &written);
        //    }
        //}
    }
    else
    {
        prTrace(prLogLevel::LogError, "Failed to set console colours. Invalid screen buffer\n");
    }
}
示例#5
0
void WinConsole::Print(const TCHAR *str, WORD text_colour, WORD background_colour)
{
	SaveColour();
	SetTextColour(text_colour, background_colour);
	Print(str);
	RestoreColour();
}
示例#6
0
void WinConsole::RestoreColour(void)
{
	if (colour != INVALID_COLOUR) {
		::SetConsoleTextAttribute(output, colour);
	} else {
		SetTextColour(kWhite, kBlack);
	}
}
示例#7
0
void wxExListItem::SetReadOnly(bool readonly)
{
  SetTextColour(readonly ? 
    wxConfigBase::Get()->ReadObject(_("List Colour"), wxColour("RED")):
    *wxBLACK);

  m_ListView->SetItem(*this);

  // Using GetTextColour did not work, so keep state in boolean.
  m_IsReadOnly = readonly;
  m_ListView->SetItemData(GetId(), m_IsReadOnly);
}
示例#8
0
CColourPicker::CColourPicker()
{
    SetBkColour(GetSysColor(COLOR_3DFACE));
    SetTextColour(GetSysColor(COLOR_BTNTEXT));

    m_bTrackSelection = FALSE;
    m_nSelectionMode = CP_MODE_BK;
    m_bActive = FALSE;

    m_strDefaultText = _T("Automatic");
    m_strCustomText  = _T("More Colours...");
}
示例#9
0
文件: console.cpp 项目: jennmat/Cinch
	void Console::SwitchTextColour( const int colour )
	{
		SetTextColour(colour);

		// Number of cells in current buffer
		int console_size = mConsoleInfo.dwSize.X * mConsoleInfo.dwSize.Y;

		DWORD cCharsWritten;
		COORD coordScreen = { 0, 0 };
		GetConsoleScreenBufferInfo(mConsoleHandle, &mConsoleInfo);
		// Set buffer attributes
		FillConsoleOutputAttribute( mConsoleHandle, mConsoleInfo.wAttributes,
			console_size, coordScreen, &cCharsWritten );
	}
示例#10
0
void wxMenuItem::Init()
{
    m_vRadioGroup.m_nStart = -1;
    m_bIsRadioGroupStart = FALSE;

#if  wxUSE_OWNER_DRAWN
    //
    // Set default menu colors
    //
    SetTextColour(wxNullColour);
    SetBackgroundColour(wxNullColour);

    //
    // We don't want normal items be owner-drawn
    //
    SetOwnerDrawn(false);
#endif // wxUSE_OWNER_DRAWN
} // end of wxMenuItem::Init
示例#11
0
void wxMenuItem::Init()
{
#if  wxUSE_OWNER_DRAWN

    // when the color is not valid, wxOwnerDraw takes the default ones.
    // If we set the colors here and they are changed by the user during
    // the execution, then the colors are not updated until the application
    // is restarted and our menus look bad
    SetTextColour(wxNullColour);
    SetBackgroundColour(wxNullColour);

    // setting default colors switched ownerdraw on: switch it off again
    SetOwnerDrawn(false);

    //  switch ownerdraw back on if using a non default margin
    if ( !IsSeparator() )
        SetMarginWidth(GetMarginWidth());

#endif // wxUSE_OWNER_DRAWN
}
示例#12
0
wxFlatButton::wxFlatButton(wxWindow* parent,
                           const wxString& label,
                           const wxFlatButton::eTheme theme,
                           const wxBitmap& bmp,
                           const wxSize& size,
                           int style)
    : wxFlatButtonBase(parent)
    , m_theme(theme)
    , m_state(kStateNormal)
    , m_text(label)
    , m_bmp(bmp)
    , m_accelIndex(wxNOT_FOUND)
    , m_kind(kKindNormal)
    , m_isChecked(false)
    , m_contextMenu(NULL)
    , m_isDisabled(false)
    , m_style(style)
{
    SetBackgroundStyle(wxBG_STYLE_PAINT);

    // Parse the label
    wxString tmpLabel;
    m_text.Replace("&&", "@@");
    // Parse the label
    for(size_t i = 0; i < m_text.length(); ++i) {
        if(m_accelIndex == wxNOT_FOUND && m_text.GetChar(i) == '&') {
            m_accelIndex = i;
            continue;
        } else {
            tmpLabel << m_text.GetChar(i);
        }
    }

    tmpLabel.Replace("@@", "&");
    m_text.swap(tmpLabel);

    // Colours - dark theme
    if(m_theme == kThemeDark) {
        SetPenNormalColour("rgb(48, 48, 48)");
        SetPenPressedColour("rgb(125, 125, 125)");
        SetBgPressedColour("rgb(48, 48, 48)");
        SetBgHoverColour("rgb(80, 80, 80)");
        SetBgColour("rgb(65, 65, 65)");
        m_penHoverColourInner = "rgb(160, 160, 160)";
        m_penHoverOuterColour = GetPenNormalColour();
        SetTextColour("rgb(248, 248, 242)");
        SetTextColourDisabled("rgb(109, 109, 109)");
        if(m_bmp.IsOk()) {
            m_bmpDisabled = m_bmp.ConvertToDisabled(100);
        }

    } else {
        wxColour paneColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
        wxColour bgColour = paneColour.ChangeLightness(150);
        wxColour penColour = paneColour.ChangeLightness(90);

        SetPenNormalColour(penColour);
        SetBgColour(bgColour);

        SetPenPressedColour("rgb(90, 90, 90)");
        SetBgPressedColour("rgb(120, 120, 120)");

        SetBgHoverColour(bgColour);
        m_penHoverColourInner = "WHITE";
        m_penHoverOuterColour = "TURQUOISE";
        SetTextColour("rgb(15, 15, 15)");
        SetTextColourDisabled(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
        if(m_bmp.IsOk()) {
            m_bmpDisabled = m_bmp.ConvertToDisabled();
        }
    }

    SetTextFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
    if(size != wxDefaultSize) {
        SetMinSize(size);
    } else {
        SetMinSize(GetBestSize());
    }
}
示例#13
0
void CColourPicker::SetColour(COLORREF crColour)
{ 
    (m_nSelectionMode == CP_MODE_TEXT)? 
        SetTextColour(crColour): SetBkColour(crColour); 
}
示例#14
0
LRESULT CTextProgressCtrl::OnSetTextColor(WPARAM, LPARAM Colour)
{
    return (LRESULT)SetTextColour((COLORREF)Colour);
}
示例#15
0
void FontButton::handleEvent()
{

    //Get mouse position
       int x, y;
       SDL_GetMouseState( &x, &y );

       //Check if mouse is in button
       bool inside = true;

       //Mouse is left of the button
       if( x < mPosition.x )
       {
           inside = false;
       }
       //Mouse is right of the button
       else if( x > mPosition.x + button.w )
       {
           inside = false;
       }
       //Mouse above the button
       else if( y < mPosition.y )
       {
           inside = false;
       }
       //Mouse below the button
       else if( y > mPosition.y + button.h )
       {
           inside = false;
       }

       //Mouse is outside button
       if( !inside )
       {
           SetTextColour(250,250,250);

       }
       //Mouse is inside button
       else
       {

           //Set mouse over sprite
           switch( setup->getMainEvent()->type )
           {
               case SDL_MOUSEMOTION:

               //Render green outlined quad
               SetTextColour(150,150,150);
               std:: cout << "over the button" << std::endl;
               break;

               case SDL_MOUSEBUTTONDOWN:
               // button pressed
               SetTextColour(50,50,50);
               std::cout <<"pressed" << std::endl;


               break;

               case SDL_MOUSEBUTTONUP:
               std::cout <<"released" << std::endl;
                SetTextColour(150,150,150);
               // button released


               pressed = true;

               break;
           }

   }
}