Exemple #1
0
void SymbolSymmetryEditor::draw(DC& dc) {
	if (symmetry) {
		control.highlightPart(dc, *symmetry, HIGHLIGHT_BORDER);
		Color color(255,100,0);
		Vector2D center = control.rotation.tr(symmetry->center);
		Vector2D handle = control.rotation.tr(symmetry->center + symmetry->handle);
		if (symmetry->kind == SYMMETRY_REFLECTION) {
			// draw line to handle
			dc.SetPen(wxPen(color,1,wxDOT));
			dc.DrawLine(int(center.x), int(center.y), int(handle.x), int(handle.y));
			// draw handle
			dc.SetPen(*wxBLACK_PEN);
			dc.SetBrush(color);
			dc.DrawCircle(int(handle.x), int(handle.y), hovered == SELECTION_HANDLE ? 7 : 4);
		}
		// draw center
		dc.SetPen(*wxBLACK_PEN);
		dc.SetBrush(color);
		dc.DrawCircle(int(center.x), int(center.y), hovered == SELECTION_CENTER ? 8 : 5);
	}
}
void DropDownList::drawItem(DC& dc, int y, size_t item) {
    if (y + item_size.height <= 0 || y >= dc.GetSize().y) return; // not visible
    // draw background
    dc.SetPen(*wxTRANSPARENT_PEN);
    if (item == selected_item) {
        if (itemEnabled(item)) {
            dc.SetBrush         (wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
            dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
        } else {
            dc.SetBrush         (wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
            dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
        }
        dc.DrawRectangle(marginW, y, (int)item_size.width, (int)item_size.height);
    } else if (!itemEnabled(item)) {
        // mix between foreground and background
        dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
    } else if (highlightItem(item)) {
        // mix a color between selection and window
        dc.SetBrush         (lerp(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT),
                                  wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW), 0.75));
        dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
        dc.DrawRectangle(marginW, y, (int)item_size.width, (int)item_size.height);
    } else {
        dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
    }
    // draw text and icon
    drawIcon(dc, marginW, y, item, item == selected_item);
    dc.DrawText(capitalize(itemText(item)), marginW + (int)icon_size.width + 1, y + text_offset);
    // draw popup icon
    if (submenu(item)) {
        draw_menu_arrow(this, dc, RealRect(marginW, y, item_size.width, item_size.height), item == selected_item);
    }
    // draw line below
    if (lineBelow(item) && item != itemCount()) {
        dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
        dc.DrawLine(marginW, y + (int)item_size.height, marginW + (int)item_size.width, y + (int)item_size.height);
    }
}