Esempio n. 1
0
/**
 * @brief Changes the position of a child of the box
 * @param box a box
 * @param child the child you want to change the position of
 * @param group the group in which the child will be repacked
 * @param pos the position where to repack @a child (starting from 0). If @a pos <= 0, @a child will be packed at the
 * start of the child-group, and if @a pos is greater than the number of children in the group, it will be packed
 * at the end
 */
void etk_box_child_position_set(Etk_Box *box, Etk_Widget *child, Etk_Box_Group group, int pos)
{
   Etk_Box_Cell *cell;
   Etk_Box_Fill_Policy fill_policy;
   int padding;

   if (!box || !child || !(cell = _etk_box_cell_get(child)))
      return;

   padding = cell->padding;
   fill_policy = cell->fill_policy;
   etk_widget_parent_set(child, NULL);
   etk_box_insert_at(box, child, group, pos, fill_policy, padding);
}
Esempio n. 2
0
void EtkBox::insertAt (EtkWidget &child, Etk_Box_Group group, int pos, Etk_Box_Fill_Policy fillPolicy, int padding)
{
    etk_box_insert_at (ETK_BOX (_o), ETK_WIDGET (child.obj ()), group, pos, fillPolicy, padding);
}
Esempio n. 3
0
/* Called when a widget is added to the toolbar's box */
static Etk_Bool _etk_toolbar_child_added_cb(Etk_Object *object, Etk_Widget *child, void *data)
{
   Etk_Toolbar *toolbar;

   if (!(toolbar = ETK_TOOLBAR(data)) || !child)
      return ETK_TRUE;

   /* Sets the style and the stock size if the new child is a tool-item */
   if (ETK_IS_TOOL_ITEM(child))
   {
      Etk_Button_Style button_style;

      switch (toolbar->style)
      {
         case ETK_TOOLBAR_ICON:
            button_style = ETK_BUTTON_ICON;
            break;
         case ETK_TOOLBAR_TEXT:
            button_style = ETK_BUTTON_TEXT;
            break;
         case ETK_TOOLBAR_BOTH_VERT:
            button_style = ETK_BUTTON_BOTH_VERT;
            break;
         case ETK_TOOLBAR_BOTH_HORIZ:
            button_style = ETK_BUTTON_BOTH_HORIZ;
            break;
         default:
            button_style = ETK_BUTTON_BOTH_VERT;
            break;
      }
      etk_button_style_set(ETK_BUTTON(child), button_style);
      etk_button_stock_size_set(ETK_BUTTON(child), toolbar->stock_size);
   }
   /* Reorientate the separators */
   else if (toolbar->reorientating
      && (((toolbar->orientation == ETK_TOOLBAR_HORIZ) && ETK_IS_VSEPARATOR(child))
         || ((toolbar->orientation == ETK_TOOLBAR_VERT) && ETK_IS_HSEPARATOR(child))))
   {
      Etk_Bool visible;
      Etk_Box_Fill_Policy policy;
      Etk_Box_Group group;
      int pos, padding;

      visible = etk_widget_is_visible(child);
      etk_box_child_position_get(ETK_BOX(toolbar->box), child, &group, &pos);
      etk_box_child_packing_get(ETK_BOX(toolbar->box), child, &policy, &padding);

      etk_object_destroy(ETK_OBJECT(child));
      if (toolbar->orientation == ETK_TOOLBAR_HORIZ)
         child = etk_vseparator_new();
      else
         child = etk_hseparator_new();

      etk_box_insert_at(ETK_BOX(toolbar->box), child, group, pos, policy, padding);
      if (visible)
         etk_widget_show(child);
   }

   if (etk_theme_group_exists(etk_widget_theme_file_get(ETK_WIDGET(toolbar)),
      etk_widget_theme_group_get(child), etk_widget_theme_group_get(ETK_WIDGET(toolbar))))
   {
      etk_widget_theme_parent_set(child, ETK_WIDGET(toolbar));
   }
   //etk_signal_emit(ETK_CONTAINER_CHILD_ADDED_SIGNAL, ETK_OBJECT(toolbar), child);

   return ETK_TRUE;
}
Esempio n. 4
0
/**
 * @brief Adds an item to the toolbar at a specified position
 * @param toolbar a toolbar
 * @param widget the item to add
 * @param pos the position to add the item at
 */
void etk_toolbar_insert_at(Etk_Toolbar *toolbar, Etk_Widget *widget, Etk_Box_Group group, int pos)
{
   if (!toolbar || !widget)
      return;
   etk_box_insert_at(ETK_BOX(toolbar->box), widget, group, pos, ETK_BOX_NONE, 0);
}