Contents Up Previous Next

wxDividedShape overview

Classes: wxDividedShape

A wxDividedShape is a rectangle with a number of vertical divisions. Each division may have its text formatted with independent characteristics, and the size of each division relative to the whole image may be specified.

Once a wxDividedShape has been created, the user may move the divisions with the mouse. By pressing Ctrl while right-clicking, the region attributes can be edited.

Here are examples of creating wxDividedShape objects:

  /*
   * Divided rectangle with 3 regions
   *
   */

  wxDividedShape *dividedRect = new wxDividedShape(50, 60);

  wxShapeRegion *region = new wxShapeRegion;
  region->SetProportions(0.0, 0.25);
  dividedRect->AddRegion(region);

  region = new wxShapeRegion;
  region->SetProportions(0.0, 0.5);
  dividedRect->AddRegion(region);

  region = new wxShapeRegion;
  region->SetProportions(0.0, 0.25);
  dividedRect->AddRegion(region);
  
  dividedRect->SetSize(50, 60); // Allow it to calculate region sizes
  dividedRect->SetPen(wxBLACK_PEN);
  dividedRect->SetBrush(wxWHITE_BRUSH);
  dividedRect->Show(TRUE);
  dividedRect->NameRegions();

  /*
   * Divided rectangle with 3 regions, rounded
   *
   */

  wxDividedShape *dividedRect3 = new wxDividedShape(50, 60);
  dividedRect3->SetCornerRadius(-0.4);

  region = new wxShapeRegion;
  region->SetProportions(0.0, 0.25);
  dividedRect3->AddRegion(region);

  region = new wxShapeRegion;
  region->SetProportions(0.0, 0.5);
  dividedRect3->AddRegion(region);

  region = new wxShapeRegion;
  region->SetProportions(0.0, 0.25);
  dividedRect3->AddRegion(region);
  
  dividedRect3->SetSize(50, 60); // Allow it to calculate region sizes
  dividedRect3->SetPen(wxBLACK_PEN);
  dividedRect3->SetBrush(wxWHITE_BRUSH);
  dividedRect3->Show(TRUE);
  dividedRect3->NameRegions();