예제 #1
0
  SimpleColors(ColorPopup* colorPopup, TooltipManager* tooltips) {
    for (int i=0; i<g_simplePal->size(); ++i) {
      doc::color_t c = g_simplePal->getEntry(i);
      app::Color color =
        app::Color::fromRgb(doc::rgba_getr(c),
                            doc::rgba_getg(c),
                            doc::rgba_getb(c),
                            doc::rgba_geta(c));

      Item* item = new Item(colorPopup, color);
      item->InitTheme.connect(
        [item]{
          item->setSizeHint(gfx::Size(16, 16)*ui::guiscale());
          item->setStyle(skin::SkinTheme::instance()->styles.simpleColor());
        });
      item->initTheme();
      addChild(item);

      tooltips->addTooltipFor(
        item, g_simplePal->getEntryName(i), BOTTOM);
    }
  }
예제 #2
0
 void deselect() {
   for (int i=0; i<g_simplePal->size(); ++i) {
     children()[i]->setSelected(false);
   }
 }
예제 #3
0
 void selectColor(int index) {
   for (int i=0; i<g_simplePal->size(); ++i) {
     children()[i]->setSelected(i == index);
   }
 }