Ejemplo n.º 1
0
 public function Draw(wxGrid $grid, wxGridCellAttr $attr, wxDC $dc, wxRect $rect, $row, $col, $isSelected)
 {
     // fill the background
     $dc->SetBrush(new wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)));
     $dc->DrawRectangle($rect->GetX(), $rect->GetY(), $rect->GetWidth(), $rect->GetHeight());
     // draw a shaded rectangle to emulate a button
     $strength = 1;
     $pen = new wxPen(new wxColour(255, 255, 255), $strength);
     $dc->SetPen($pen);
     $dc->DrawLine($rect->GetLeft() + $strength - 1, $rect->GetTop() + $strength - 1, $rect->GetLeft() + $strength - 1, $rect->GetBottom() - $strength + 1);
     $dc->DrawLine($rect->GetLeft() + $strength - 1, $rect->GetTop() + $strength - 1, $rect->GetRight() - $strength, $rect->GetTop() + $strength - 1);
     $pen = new wxPen(new wxColour(0, 0, 0), $strength);
     $dc->SetPen($pen);
     $dc->DrawLine($rect->GetRight() - $strength, $rect->GetTop(), $rect->GetRight() - $strength, $rect->GetBottom());
     $dc->DrawLine($rect->GetLeft(), $rect->GetBottom(), $rect->GetRight() - $strength, $rect->GetBottom());
     // draw the button-label
     $dc->SetBackgroundMode(wxPENSTYLE_TRANSPARENT);
     $dc->SetTextForeground($attr->GetTextColour());
     $dc->SetFont($attr->GetFont());
     $dc->DrawLabel($this->label, $rect, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL);
 }
Ejemplo n.º 2
0
 protected static function CreateGridAttributeForText()
 {
     $text_attr = new wxGridCellAttr();
     $text_attr->SetEditor(new wxGridCellTextEditor(1024));
     $text_attr->SetRenderer(new wxGridCellStringRenderer());
     $text_attr->SetReadOnly(TRUE);
     return $text_attr;
 }