Exemple #1
0
void wxComboBox::DoDeleteOneItem(unsigned int n)
{
    wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );

    GtkList *listbox = GTK_LIST( GTK_COMBO(m_widget)->list );

    GList *child = g_list_nth( listbox->children, n );

    if (!child)
    {
        wxFAIL_MSG(wxT("wrong index"));
        return;
    }

    DisableEvents();

    GList *list = g_list_append( NULL, child->data );
    gtk_list_remove_items( listbox, list );
    g_list_free( list );

    wxList::compatibility_iterator node = m_clientObjectList.Item( n );
    if (node)
    {
        m_clientObjectList.Erase( node );
    }

    node = m_clientDataList.Item( n );
    if (node)
        m_clientDataList.Erase( node );

    EnableEvents();

    InvalidateBestSize();
}
Exemple #2
0
void wxListBox::Delete(unsigned int n)
{
    wxCHECK_RET( m_list != NULL, wxT("invalid listbox") );

    GList *child = g_list_nth( m_list->children, n );

    wxCHECK_RET( child, wxT("wrong listbox index") );

    GList *list = g_list_append( (GList*) NULL, child->data );
    gtk_list_remove_items( m_list, list );
    g_list_free( list );

    wxList::compatibility_iterator node = m_clientList.Item( n );
    if ( node )
    {
        if ( m_clientDataItemsType == wxClientData_Object )
        {
            wxClientData *cd = (wxClientData*)node->GetData();
            delete cd;
        }

        m_clientList.Erase( node );
    }

    if ( m_strings )
        m_strings->RemoveAt(n);
}
Exemple #3
0
/* Removes the items from the list. */
int
clip_GTK_LISTREMOVEITEMS(ClipMachine * ClipMachineMemory)
{
   C_widget *clst = _fetch_cw_arg(ClipMachineMemory);

   ClipVar  *cv = _clip_spar(ClipMachineMemory, 2);

   GList    *items = NULL;

   C_widget *citem;

   int       i;

   CHECKCWID(clst, GTK_IS_LIST);
   CHECKARG(2, ARRAY_type_of_ClipVarType);
   for (i = 0; i < cv->ClipArrVar_a_of_ClipVar.count_of_ClipArrVar; i++)
    {
       switch (cv->ClipArrVar_a_of_ClipVar.ClipVar_items_of_ClipArrVar[i].ClipType_t_of_ClipVar.ClipVartype_type_of_ClipType)
	{
	case MAP_type_of_ClipVarType:
	case NUMERIC_type_of_ClipVarType:
	   citem = _fetch_cwidget(ClipMachineMemory, &cv->ClipArrVar_a_of_ClipVar.ClipVar_items_of_ClipArrVar[i]);
	   CHECKCWID(citem, GTK_IS_LIST_ITEM);
	   items = g_list_append(items, citem->widget);
	   break;
	default:
	   break;
	}
    }
   gtk_list_remove_items(GTK_LIST(clst->widget), items);
   return 0;
 err:
   return 1;
}
void UponBuiltinLibOptionsRemoveButtonClicked (GtkWidget * dialogue)
{
    GtkList *sourceList = GTK_LIST (gtk_object_get_data (GTK_OBJECT (dialogue), "SourceList"));
    GList *selection = sourceList->selection;

    if (!selection)
        return;
    GList *copy = g_list_copy (selection);

    gtk_list_remove_items (sourceList, copy);
    g_list_free (copy);
}
Exemple #5
0
void wxComboBox::Delete(unsigned int n)
{
    wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );

#ifdef __WXGTK24__
    if (!gtk_check_version(2,4,0))
    {
        wxCHECK_RET( IsValid(n), wxT("invalid index") );

        GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
        gtk_combo_box_remove_text( combobox, n );
    }
    else
#endif
    {
        GtkList *listbox = GTK_LIST( GTK_COMBO(m_widget)->list );

        GList *child = g_list_nth( listbox->children, n );

        if (!child)
        {
            wxFAIL_MSG(wxT("wrong index"));
            return;
        }

        DisableEvents();

        GList *list = g_list_append( (GList*) NULL, child->data );
        gtk_list_remove_items( listbox, list );
        g_list_free( list );

        EnableEvents();
    }

    wxList::compatibility_iterator node = m_clientObjectList.Item( n );
    if (node)
    {
        wxClientData *cd = (wxClientData*)node->GetData();
        if (cd) delete cd;
        m_clientObjectList.Erase( node );
    }

    node = m_clientDataList.Item( n );
    if (node)
        m_clientDataList.Erase( node );

    InvalidateBestSize();
}
Exemple #6
0
static void
layer_dialog_lower_callback(GtkWidget *widget, gpointer gdata)
{
  Layer *layer;
  Diagram *dia;
  GtkWidget *selected;
  GList *list = NULL;
  int pos;

  dia = layer_dialog->diagram;

  if ((dia != NULL) && (dia->data->layers->len>1)) {
    assert(GTK_LIST(layer_dialog->layer_list)->selection != NULL);
    selected = GTK_LIST(layer_dialog->layer_list)->selection->data;

    pos = gtk_list_child_position(GTK_LIST(layer_dialog->layer_list), selected);

    if (pos < dia->data->layers->len-1) {
      layer = DIA_LAYER_WIDGET(selected)->layer;
      data_lower_layer(dia->data, layer);
      
      list = g_list_prepend(list, selected);

      g_object_ref(selected);
      
      gtk_list_remove_items(GTK_LIST(layer_dialog->layer_list),
			    list);
      
      gtk_list_insert_items(GTK_LIST(layer_dialog->layer_list),
			    list, pos + 1);

      g_object_unref(selected);

      gtk_list_select_item(GTK_LIST(layer_dialog->layer_list), pos+1);
      
      diagram_add_update_all(dia);
      diagram_flush(dia);

      undo_layer(dia, layer, TYPE_LOWER_LAYER, 0);
      undo_set_transactionpoint(dia->undo);
    }

  }
}
Exemple #7
0
void wxListBox::DoDeleteOneItem(unsigned int n)
{
    wxCHECK_RET( m_list != NULL, wxT("invalid listbox") );

    GList *child = g_list_nth( m_list->children, n );

    wxCHECK_RET( child, wxT("wrong listbox index") );

    GList *list = g_list_append( NULL, child->data );
    gtk_list_remove_items( m_list, list );
    g_list_free( list );

    wxList::compatibility_iterator node = m_clientList.Item( n );
    if ( node )
    {
        m_clientList.Erase( node );
    }

    if ( m_strings )
        m_strings->RemoveAt(n);
}