Beispiel #1
0
// If this is opaque it obscures the underlying area.
QRegion MHRectangle::GetOpaqueArea()
{
    if (! m_fRunning)
    {
        return QRegion();
    }

    MHRgba lineColour = GetColour(m_LineColour);
    MHRgba fillColour = GetColour(m_FillColour);

    // If the fill is transparent or semi-transparent we return an empty region and
    // ignore the special case where the surrounding box is opaque.
    if (fillColour.alpha() != 255)
    {
        return QRegion();
    }

    if (lineColour.alpha() == 255 || m_nLineWidth == 0)
    {
        return QRegion(QRect(m_nPosX, m_nPosY, m_nBoxWidth, m_nBoxHeight));
    }

    if (m_nBoxWidth <= 2 * m_nLineWidth || m_nBoxHeight <= 2 * m_nLineWidth)
    {
        return QRegion();
    }
    else return QRegion(QRect(m_nPosX + m_nLineWidth, m_nPosY + m_nLineWidth,
                                  m_nBoxWidth - m_nLineWidth * 2, m_nBoxHeight - m_nLineWidth * 2));
}
Beispiel #2
0
void MHRectangle::Display(MHEngine *engine)
{
    if (! m_fRunning) return;
    if (m_nBoxWidth == 0 || m_nBoxHeight == 0) return; // Can't draw zero sized boxes.
    // The bounding box is assumed always to be True.

    MHRgba lineColour = GetColour(m_LineColour);
    MHRgba fillColour = GetColour(m_FillColour);
    MHContext *d = engine->GetContext();
    // Fill the centre.
    if (m_nBoxHeight < m_nLineWidth*2 || m_nBoxWidth < m_nLineWidth*2) {
        // If the area is very small but non-empty fill it with the line colour
        d->DrawRect(m_nPosX, m_nPosY, m_nBoxWidth, m_nBoxHeight, lineColour);
    }
    else {
        d->DrawRect(m_nPosX + m_nLineWidth, m_nPosY + m_nLineWidth,
                m_nBoxWidth - m_nLineWidth*2, m_nBoxHeight - m_nLineWidth*2, fillColour);
        // Draw the lines round the outside.  UK MHEG allows us to treat all line styles as solid.
        // It isn't clear when we draw dashed and dotted lines what colour to put in the spaces.
        d->DrawRect(m_nPosX, m_nPosY, m_nBoxWidth, m_nLineWidth, lineColour);
        d->DrawRect(m_nPosX, m_nPosY + m_nBoxHeight - m_nLineWidth, m_nBoxWidth, m_nLineWidth, lineColour);
        d->DrawRect(m_nPosX, m_nPosY + m_nLineWidth, m_nLineWidth, m_nBoxHeight - m_nLineWidth*2, lineColour);
        d->DrawRect(m_nPosX + m_nBoxWidth - m_nLineWidth, m_nPosY + m_nLineWidth,
            m_nLineWidth, m_nBoxHeight - m_nLineWidth*2, lineColour);
    }
}
Beispiel #3
0
void GUIXGetWindowColours( gui_window * wnd, gui_colour_set * colours )
{
    int i;

    for( i = 0; i < wnd->num_attrs; i++ ) {
        colours[i].fore = GetColour( GETFG( wnd->colours[i] ) );
        colours[i].back = GetColour( GETBG( wnd->colours[i] ) );
    }
}
bool Tapplication::LoadSkin( const char* filename )
{
	IniFile file;
	if ( !file.Load( filename ) )
		return false;

	GetColour( file, "Frame", m_colors[normalColors].frameColor );
	GetColour( file, "Background", m_colors[normalColors].bgColor );
	GetColour( file, "TextForeground", m_colors[normalColors].textColor );

	m_colors[highlightColors].frameColor = m_colors[normalColors].frameColor;
	GetColour( file, "Highlight", m_colors[highlightColors].bgColor );
	GetColour( file, "TextHighlightedForeground", m_colors[highlightColors].textColor );

	m_colors[headerColors].frameColor = m_colors[normalColors].frameColor;
	GetColour( file, "TitleBackground", m_colors[headerColors].bgColor );
	GetColour( file, "TitleForeground", m_colors[headerColors].textColor);

	// default footer colours to the normal colours in case the ini file doesn't contain them
	m_colors[footerColors].frameColor = m_colors[normalColors].frameColor;
	m_colors[footerColors].bgColor = m_colors[normalColors].bgColor;
	m_colors[footerColors].textColor = m_colors[normalColors].textColor;
	GetColour( file, "FooterBackground", m_colors[headerColors].bgColor );
	GetColour( file, "FooterForeground", m_colors[headerColors].textColor);

	m_colors[scrollBarColors].frameColor = m_colors[headerColors].frameColor;
	m_colors[scrollBarColors].bgColor = m_colors[headerColors].bgColor;
	m_colors[scrollBarColors].textColor = m_colors[headerColors].textColor;

	return true;
}
bool CWinGlkWndTextGrid::MeasureStyle(int iStyle, int iHint, glui32* pResult)
{
  bool bMeasured = true;

  CWinGlkStyle* pStyle = GetStyle(iStyle);
  if (pStyle)
  {
    switch (iHint)
    {
    case stylehint_Indentation:
    case stylehint_ParaIndentation:
    case stylehint_Weight:
    case stylehint_Oblique:
    case stylehint_Proportional:
      if (pResult)
        *pResult = 0;
      break;
    case stylehint_Size:
      if (pResult)
        *pResult = pStyle->m_Size;
      break;
    case stylehint_Justification:
      if (pResult)
        *pResult = stylehint_just_LeftFlush;
      break;
    case stylehint_TextColor:
      if (pResult)
      {
        int iColour = GetColour(pStyle->m_TextColour);
        BYTE r = (BYTE)((iColour & 0x00FF0000) >> 16);
        BYTE g = (BYTE)((iColour & 0x0000FF00) >> 8);
        BYTE b = (BYTE)((iColour & 0x000000FF));
        (*pResult) = RGB(r,g,b);
      }
      break;
    case stylehint_BackColor:
      if (pResult)
      {
        int iColour = GetColour(pStyle->m_BackColour);
        BYTE r = (BYTE)((iColour & 0x00FF0000) >> 16);
        BYTE g = (BYTE)((iColour & 0x0000FF00) >> 8);
        BYTE b = (BYTE)((iColour & 0x000000FF));
        (*pResult) = RGB(r,g,b);
      }
      break;
    case stylehint_ReverseColor:
      if (pResult)
        *pResult = pStyle->m_ReverseColour;
      break;
    default:
      bMeasured = false;
      break;
    }
  }
  else
Beispiel #6
0
wxObject * MaxBannerWindowXmlHandler::DoCreateResource()
{
    XRC_MAKE_INSTANCE(banner, MaxBannerWindow)

    banner->Create(m_parentAsWindow,
                   GetID(),
                   GetDirection(wxS("direction")),
                   GetPosition(),
                   GetSize(),
                   GetStyle(wxS("style")),
                   GetName());

	banner->MaxBind(CB_PREF(wx_wxbannerwindow_wxBannerWindow__xrcNew)(banner));

    SetupWindow(banner);

    const wxColour colStart = GetColour(wxS("gradient-start"));
    const wxColour colEnd = GetColour(wxS("gradient-end"));
    if ( colStart.IsOk() || colEnd.IsOk() )
    {
        if ( !colStart.IsOk() || !colEnd.IsOk() )
        {
            ReportError
            (
                "Both start and end gradient colours must be "
                "specified if either one is."
            );
        }
        else
        {
            banner->SetGradient(colStart, colEnd);
        }
    }

    wxBitmap bitmap = GetBitmap();
    if ( bitmap.IsOk() )
    {
        if ( colStart.IsOk() || colEnd.IsOk() )
        {
            ReportError
            (
                "Gradient colours are ignored by wxBannerWindow "
                "if the background bitmap is specified."
            );
        }

        banner->SetBitmap(bitmap);
    }

    banner->SetText(GetText(wxS("title")), GetText(wxS("message")));

    return banner;
}
Beispiel #7
0
void byoSnake::DrawBorder(wxDC* DC)
{
    for ( int i=0; i<m_FieldHoriz+2; i++ )
    {
        DrawBrick(DC,i,2,GetColour(m_BorderColour));
        DrawBrick(DC,i,3+m_FieldVert,GetColour(m_BorderColour));
    }
    for ( int i=0; i<m_FieldVert; i++ )
    {
        DrawBrick(DC,0,i+3,GetColour(m_BorderColour));
        DrawBrick(DC,m_FieldHoriz+1,i+3,GetColour(m_BorderColour));
    }
}
Beispiel #8
0
const wxPen* wxStockGDI::GetPen(Item item)
{
    wxPen* pen = static_cast<wxPen*>(ms_stockObject[item]);
    if (pen == NULL)
    {
        switch (item)
        {
        case PEN_BLACK:
            pen = new wxPen(*GetColour(COLOUR_BLACK), 1, wxPENSTYLE_SOLID);
            break;
        case PEN_BLACKDASHED:
            pen = new wxPen(*GetColour(COLOUR_BLACK), 1, wxPENSTYLE_SHORT_DASH);
            break;
        case PEN_BLUE:
            pen = new wxPen(*GetColour(COLOUR_BLUE), 1, wxPENSTYLE_SOLID);
            break;
        case PEN_CYAN:
            pen = new wxPen(*GetColour(COLOUR_CYAN), 1, wxPENSTYLE_SOLID);
            break;
        case PEN_GREEN:
            pen = new wxPen(*GetColour(COLOUR_GREEN), 1, wxPENSTYLE_SOLID);
            break;
        case PEN_YELLOW:
            pen = new wxPen(*GetColour(COLOUR_YELLOW), 1, wxPENSTYLE_SOLID);
            break;
        case PEN_GREY:
            pen = new wxPen(wxColour(wxT("GREY")), 1, wxPENSTYLE_SOLID);
            break;
        case PEN_LIGHTGREY:
            pen = new wxPen(*GetColour(COLOUR_LIGHTGREY), 1, wxPENSTYLE_SOLID);
            break;
        case PEN_MEDIUMGREY:
            pen = new wxPen(wxColour(wxT("MEDIUM GREY")), 1, wxPENSTYLE_SOLID);
            break;
        case PEN_RED:
            pen = new wxPen(*GetColour(COLOUR_RED), 1, wxPENSTYLE_SOLID);
            break;
        case PEN_TRANSPARENT:
            pen = new wxPen(*GetColour(COLOUR_BLACK), 1, wxPENSTYLE_TRANSPARENT);
            break;
        case PEN_WHITE:
            pen = new wxPen(*GetColour(COLOUR_WHITE), 1, wxPENSTYLE_SOLID);
            break;
        default:
            wxFAIL;
        }
        ms_stockObject[item] = pen;
    }
    return pen;
}
void ColorPicker::Save(wxString const &group)
{
	wxString rkey = group + wxT("red");
	wxString gkey = group + wxT("green");
	wxString bkey = group + wxT("blue");
	wxString akey = group + wxT("alpha");

	wxConfigBase *config = wxConfig::Get();

	config->Write(rkey, GetColour().Red());
	config->Write(gkey, GetColour().Green());
	config->Write(bkey, GetColour().Blue());
	config->Write(akey, GetColour().Alpha());

}
void CColourPopup::ChangeSelection(int nIndex)
{
    CClientDC dc(this);        // device context for drawing

    if (nIndex > m_nNumColours)
        nIndex = CUSTOM_BOX_VALUE; 

    if ((m_nCurrentSel >= 0 && m_nCurrentSel < m_nNumColours) ||
        m_nCurrentSel == CUSTOM_BOX_VALUE || m_nCurrentSel == DEFAULT_BOX_VALUE)
    {
        // Set Current selection as invalid and redraw old selection (this way
        // the old selection will be drawn unselected)
        int OldSel = m_nCurrentSel;
        m_nCurrentSel = INVALID_COLOUR;
        DrawCell(&dc, OldSel);
    }

    // Set the current selection as row/col and draw (it will be drawn selected)
    m_nCurrentSel = nIndex;
    DrawCell(&dc, m_nCurrentSel);

    // Store the current colour
    if (m_nCurrentSel == CUSTOM_BOX_VALUE)
        m_pParent->SendMessage(CPN_SELCHANGE, (WPARAM) m_crInitialColour, 0);
    else if (m_nCurrentSel == DEFAULT_BOX_VALUE)
    {
        m_crColour = CLR_DEFAULT;
        m_pParent->SendMessage(CPN_SELCHANGE, (WPARAM) CLR_DEFAULT, 0);
    }
    else
    {
        m_crColour = GetColour(m_nCurrentSel);
        m_pParent->SendMessage(CPN_SELCHANGE, (WPARAM) m_crColour, 0);
    }
}
Beispiel #11
0
void MusWxDC::SetPen( int colour, int width, int style )
{
    m_pen.SetColour( GetColour( colour ) );
    m_pen.SetWidth( width );
    m_pen.SetStyle( style );
    m_dc->SetPen( m_pen );
}
Beispiel #12
0
void byoSnake::DrawSnake(wxDC* DC)
{
    for ( int i=0; i<m_SnakeLen; i++ )
    {
        DrawBrick(DC,m_SnakeX[i]+1,m_SnakeY[i]+3,GetColour(m_SnakeColour));
    }
}
Beispiel #13
0
void IlluminateButton( uint8_t theId )
{
    volatile t_ATime* KeyTimer = GetKeyTimer( theId );
    volatile uint8_t* SequenceState = GetSequenceState( theId );
    
    if ( ( MaturedTimer( KeyTimer ) ) || ( SequenceState == 0 ) )
    {
        volatile t_Sequences Sequence = GetSequence( theId );
        
        switch ( GetColour( Sequence, SequenceState, KeyTimer ) )
        {
            case e_Off:
                ColourNone( theId );
                break;

            case e_ColourA:
                ColourA( theId );
                break;

            case e_ColourB:
                ColourB( theId );
                break;
        }
    }
}
Beispiel #14
0
	void OverlayTask::Update()
	{
		for (auto it = m_Selected.begin(), end = m_Selected.end(); it != end; ++it)
		{
			const auto& entity = *it;

			auto pos = entity->GetPosition();
			pos.x = ToRenderUnits(pos.x), pos.y = ToRenderUnits(pos.y);
			pos += m_Offset;

			clan::Rectf box(clan::Sizef(50, 50));
			box.translate(pos.x - box.get_width() * 0.5f, pos.y - box.get_height() * 0.5f);

			m_DebugDraw.DrawRectangle(box, GetColour(it));
		}

		if (m_EditCam)
		{
			clan::Colorf rangeColour(1.0f, 0.6f, 0.6f, 0.95f);
			auto center = m_EditCam->GetPosition();
			auto radius = ToRenderUnits(m_CamRange);
			clan::Rectf camRect(center.x - radius, center.y - radius, center.x + radius, center.y + radius);
			m_DebugDraw.DrawRectangle(camRect, rangeColour);
		}

		if (m_PolygonTool && m_PolygonTool->IsActive())
			m_PolygonTool->Draw();
		if (m_RectangleTool && m_RectangleTool->IsActive())
			m_RectangleTool->Draw();
		if (m_CircleTool && m_CircleTool->IsActive())
			m_CircleTool->Draw();
	}
Beispiel #15
0
void GPX::UpdateWPRender(void)
{
	/* iterate through all waypoints and caculate which color to render them in */
	unsigned int e;
	GPXWPRenderRow *frow;

	for(e=0;e<m_labelcolourtable.GetNumChildren();++e)
	{
		frow=static_cast<GPXWPRenderRow *>(m_labelcolourtable.GetChild(e));	/* reset match counters */
		frow->ClearCount();
	}

	for(e=0;e<m_numwpts;++e)
		GetColour(m_wptlist.GetEntry(e));

	/* copy colors to the route table */
	m_routes.CopyColors();

	for(e=0;e<m_labelcolourtable.GetNumChildren();++e)
	{
		frow=static_cast<GPXWPRenderRow *>(m_labelcolourtable.GetChild(e));	/* reset match counters */
		frow->UpdateCount();
	}

	/* since the colours mave have changed, the map needs to be updated */
	MapDirty();
}
Beispiel #16
0
/*******************************************************************************
  Function Name  : FindCellFromColour
  Input(s)       : crColour - Color for which cell to be identified
  Output         : -
  Functionality  : Updates the selection row and col from the color
  Member of      : CColourPopup
  Author(s)      : Raja N
  Date Created   : 09/12/2004
  Modifications  : 
*******************************************************************************/
void CColourPopup::FindCellFromColour(COLORREF crColour)
{
    if (crColour == CLR_DEFAULT && m_strDefaultText.GetLength() > 0)
    {
        m_nChosenColourSel = DEFAULT_BOX_VALUE;
        return;
    }
    // Iterate through list of entries in the color table
    for (int i = 0; i < m_nNumColours; i++)
    {
        if (GetColour(i) == crColour)
        {
            m_nChosenColourSel = i;
            return;
        }
    }
    if( m_strCustomText.GetLength() > 0 )
    {
        m_nChosenColourSel = CUSTOM_BOX_VALUE;
    }
    else
    {
        m_nChosenColourSel = INVALID_COLOUR;
    }
}
Beispiel #17
0
bool RTFcolourtbl::Validate(MAP_INT_INT* FixupMap)
{	
	bool bRes = false;
	
	// If the first colour is not auto make sure it is and fix up the document
	int iThisSize = (x64_int_cast)the_RTFcolourdef.size();
	if(iThisSize)
	{
		if(!GetColour(0)->IsAuto())
		{
			RTFcolourdef cd;
			cd.MakeAuto();
			
			// Add the auto colour
			the_RTFcolourdef.push_back(cd);
			
			// Now make it first it the vector
			RTFcolourdef cdOrig = the_RTFcolourdef[0];
			the_RTFcolourdef[0] = cd;
			the_RTFcolourdef[iThisSize] = cdOrig;
			
			// Update the fixup map
			MAP_INT_INT& rFixupMap = *FixupMap;
			rFixupMap[0] = iThisSize;
			
			bRes = true;
		}
	}  
	return bRes;
}
Beispiel #18
0
void byoSnake::DrawApple(wxDC* DC)
{
    if ( m_AppleX >= 0 && m_AppleY >= 0 )
    {
        DrawBrick(DC,m_AppleX+1,m_AppleY+3,GetColour(m_AppleColour));
    }
}
Beispiel #19
0
COLORREF RTFcolourtbl::GetColourAsRGB(int iIndex)
{
	RTFcolourdef* pRes = GetColour(iIndex);
	if(pRes == NULL)
		return (COLORREF) 0;

	return pRes->GetColourAsRGB();
}
Beispiel #20
0
const wxColour &wxShapeRegion::GetActualColourObject()
{
	if (!m_actualColourObject.IsOk())
		m_actualColourObject = wxTheColourDatabase->Find(GetColour());
	if (!m_actualColourObject.IsOk())
		m_actualColourObject = * wxBLACK;
	return m_actualColourObject;
}
Beispiel #21
0
PLOTLIB_INLINE std::string ColourMap::ToString() const
{
    if ( mStream.str().empty() )
    {
        return "'" + GetColour( Seaborn::Deep, ColourType::None ) + "'";
    }

    return "'" + mStream.str() + "'";
}
void DrawCircle(CDC* pDC, CPoint p, LONG lRadius, COLORREF crBright, COLORREF crDark)
{
	LONG lError, lXoffset, lYoffset;

	//Check to see that the coordinates are valid
	ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
	ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );

	//Set starting values
	lXoffset = lRadius;
	lYoffset = 0;
	lError   = -lRadius;

	do {
		const double Pi = 3.141592654, 
					 Pi_on_2 = Pi * 0.5,
					 Three_Pi_on_2 = Pi * 1.5;
		COLORREF crColour;
		double   dAngle = atan2(lYoffset, lXoffset);

		//Draw the current pixel, reflected across all eight arcs
		crColour = GetColour(dAngle, crBright, crDark);
		pDC->SetPixelV(p.x + lXoffset, p.y + lYoffset, crColour);

		crColour = GetColour(Pi_on_2 - dAngle, crBright, crDark);
		pDC->SetPixelV(p.x + lYoffset, p.y + lXoffset, crColour);

		crColour = GetColour(Pi_on_2 + dAngle, crBright, crDark);
		pDC->SetPixelV(p.x - lYoffset, p.y + lXoffset, crColour);

		crColour = GetColour(Pi - dAngle, crBright, crDark);
		pDC->SetPixelV(p.x - lXoffset, p.y + lYoffset, crColour);

		crColour = GetColour(-Pi + dAngle, crBright, crDark);
		pDC->SetPixelV(p.x - lXoffset, p.y - lYoffset, crColour);

		crColour = GetColour(-Pi_on_2 - dAngle, crBright, crDark);
		pDC->SetPixelV(p.x - lYoffset, p.y - lXoffset, crColour);

		crColour = GetColour(-Pi_on_2 + dAngle, crBright, crDark);
		pDC->SetPixelV(p.x + lYoffset, p.y - lXoffset, crColour);

		crColour = GetColour(-dAngle, crBright, crDark);
		pDC->SetPixelV(p.x + lXoffset, p.y - lYoffset, crColour);

		//Advance the error term and the constant X axis step
		lError += lYoffset++;

		//Check to see if error term has overflowed
		if ((lError += lYoffset) >= 0)
			lError -= --lXoffset * 2;

	} while (lYoffset <= lXoffset);	//Continue until halfway point
} 
Beispiel #23
0
/*----------------------------------------------------------------------
  ----------------------------------------------------------------------*/
void AmayaColorButton::OnLeftButtonDown(wxMouseEvent& event)
{
  wxColour col = GetColour();
  
  if(HasFlag(AMAYA_COLOR_BUTTON_QUERY_ON_CLICK))
      col = ChooseColour();
  
  AmayaColorButtonEvent evt(col, AMAYA_COLOR_CHANGED, GetId());
  ProcessEvent(evt);
}
Beispiel #24
0
//----------------------------------------------------------------------------------------------------------------------
Fragment Sphere::GetFragment(Vector& _rayOrigin, Vector& _ray, const float _distance) {
    // point of intersection in world space
    Vector point = _ray * _distance + _rayOrigin;
    
    // normal = point - center
    Vector normal = point - GetPosition();
    normal.Normalise();
    
    return Fragment(point, normal, GetColour(), GetMaterial());
}
Beispiel #25
0
//-----------------------------------------------------------------------------------------------------------------------------------
void Button::Update(float elapsedSeconds)
{
	ClickableImage::Update(elapsedSeconds);

	if (IsActive())
	{
		// Lerp our current colour to the default one to create effect when mouse over button
		SetColour(Color::Lerp(GetColour(), m_defaultColour, elapsedSeconds * 3));
	}
}
Beispiel #26
0
const wxBrush* wxStockGDI::GetBrush(Item item)
{
    wxBrush* brush = static_cast<wxBrush*>(ms_stockObject[item]);
    if (brush == NULL)
    {
        switch (item)
        {
        case BRUSH_BLACK:
            brush = new wxBrush(*GetColour(COLOUR_BLACK), wxBRUSHSTYLE_SOLID);
            break;
        case BRUSH_BLUE:
            brush = new wxBrush(*GetColour(COLOUR_BLUE), wxBRUSHSTYLE_SOLID);
            break;
        case BRUSH_CYAN:
            brush = new wxBrush(*GetColour(COLOUR_CYAN), wxBRUSHSTYLE_SOLID);
            break;
        case BRUSH_GREEN:
            brush = new wxBrush(*GetColour(COLOUR_GREEN), wxBRUSHSTYLE_SOLID);
            break;
        case BRUSH_YELLOW:
            brush = new wxBrush(*GetColour(COLOUR_YELLOW), wxBRUSHSTYLE_SOLID);
            break;
        case BRUSH_GREY:
            brush = new wxBrush(wxColour(wxT("GREY")), wxBRUSHSTYLE_SOLID);
            break;
        case BRUSH_LIGHTGREY:
            brush = new wxBrush(*GetColour(COLOUR_LIGHTGREY), wxBRUSHSTYLE_SOLID);
            break;
        case BRUSH_MEDIUMGREY:
            brush = new wxBrush(wxColour(wxT("MEDIUM GREY")), wxBRUSHSTYLE_SOLID);
            break;
        case BRUSH_RED:
            brush = new wxBrush(*GetColour(COLOUR_RED), wxBRUSHSTYLE_SOLID);
            break;
        case BRUSH_TRANSPARENT:
            brush = new wxBrush(*GetColour(COLOUR_BLACK), wxBRUSHSTYLE_TRANSPARENT);
            break;
        case BRUSH_WHITE:
            brush = new wxBrush(*GetColour(COLOUR_WHITE), wxBRUSHSTYLE_SOLID);
            break;
        default:
            wxFAIL;
        }
        ms_stockObject[item] = brush;
    }
    return brush;
}
Beispiel #27
0
// On mouse click, create and show a CColourPopup window for colour selection
BOOL CColourPicker::OnClicked()
{
    m_bActive = TRUE;
    CRect rect;
    GetWindowRect(rect);
    new CColourPopup(CPoint(rect.left, rect.bottom),    // Point to display popup
                     GetColour(),                       // Selected colour
                     this,                              // parent
                     m_strDefaultText,                  // "Default" text area
                     m_strCustomText);                  // Custom Text

    CWnd *pParent = GetParent();
    if (pParent)
        pParent->SendMessage(CPN_DROPDOWN, (LPARAM)GetColour(), (WPARAM) GetDlgCtrlID());

    // Docs say I should return FALSE to stop the parent also getting the message.
    // HA! What a joke.

    return TRUE;
}
void CWinGlkWndTextGrid::InitDC(CWinGlkDC& dc, CDC* pdcCompat)
{
  if (pdcCompat)
    dc.CreateCompatibleDC(pdcCompat);

  // Set colours
  dc.SetTextColor(::GetSysColor(COLOR_WINDOWTEXT));
  dc.SetBkColor(GetColour(GetStyle(style_Normal)->m_BackColour));

  dc.SetStyle(style_Normal,false);
}
Beispiel #29
0
// Return the area actually obscured.  This is empty unless the background is opaque.
QRegion MHText::GetOpaqueArea()
{
    if (! m_fRunning || (GetColour(m_bgColour)).alpha() != 255)
    {
        return QRegion();
    }
    else
    {
        return QRegion(QRect(m_nPosX, m_nPosY, m_nBoxWidth, m_nBoxHeight));
    }
}
Beispiel #30
0
void wxListCtrlXmlHandler::HandleListItem()
{
    wxListCtrl * const list = wxDynamicCast(m_parentAsWindow, wxListCtrl);
    wxCHECK_RET( list, "must have wxListCtrl parent" );

    wxListItem item;

    HandleCommonItemAttrs(item);

    if (HasParam(wxT("bg")))
        item.SetBackgroundColour(GetColour(wxT("bg")));
    if (HasParam(wxT("col")))
        item.SetColumn((int)GetLong(wxT("col")));
    if (HasParam(wxT("data")))
        item.SetData(GetLong(wxT("data")));
    if (HasParam(wxT("font")))
        item.SetFont(GetFont(wxT("font"), list));
    if (HasParam(wxT("state")))
        item.SetState(GetStyle(wxT("state")));
    if (HasParam(wxT("textcolour")))
        item.SetTextColour(GetColour(wxT("textcolour")));
    if (HasParam(wxT("textcolor")))
        item.SetTextColour(GetColour(wxT("textcolor")));

    // the list control icon style, may be 0
    int image;
    if ( list->HasFlag(wxLC_ICON) )
        image = GetImageIndex(list, wxIMAGE_LIST_NORMAL);
    else if ( list->HasFlag(wxLC_SMALL_ICON) || list->HasFlag(wxLC_REPORT) || list->HasFlag(wxLC_LIST) )
        image = GetImageIndex(list, wxIMAGE_LIST_SMALL);
    else
        image = wxNOT_FOUND;

    if ( image != wxNOT_FOUND )
        item.SetImage(image);

    // append the list item to the control
    item.SetId(list->GetItemCount());

    list->InsertItem(item);
}