aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-bit-array.h
blob: a9bf113d5f665f65ccee0d868df9f6168c6f8140 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with the program; if not, see <http://www.gnu.org/licenses/>
 *
 *
 * Authors:
 *      Chris Lahey <clahey@ximian.com>
 *
 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
 *
 */

#ifndef _E_BIT_ARRAY_H_
#define _E_BIT_ARRAY_H_

#include <glib-object.h>

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#define E_BIT_ARRAY_TYPE        (e_bit_array_get_type ())
#define E_BIT_ARRAY(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), E_BIT_ARRAY_TYPE, EBitArray))
#define E_BIT_ARRAY_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST((k), E_BIT_ARRAY_TYPE, EBitArrayClass))
#define E_IS_BIT_ARRAY(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_BIT_ARRAY_TYPE))
#define E_IS_BIT_ARRAY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_BIT_ARRAY_TYPE))

#ifndef _E_FOREACH_FUNC_H_
#define _E_FOREACH_FUNC_H_
typedef void (*EForeachFunc) (gint model_row,
                  gpointer closure);
#endif

typedef struct {
    GObject base;

    gint bit_count;
        guint32 *data;
} EBitArray;

typedef struct {
    GObjectClass parent_class;
} EBitArrayClass;


GType      e_bit_array_get_type            (void);
EBitArray *e_bit_array_new                 (gint           count);

gboolean   e_bit_array_value_at            (EBitArray    *selection,
                        gint          n);
void       e_bit_array_foreach             (EBitArray    *selection,
                        EForeachFunc  callback,
                        gpointer      closure);
void       e_bit_array_clear               (EBitArray    *selection);
gint       e_bit_array_selected_count      (EBitArray    *selection);
void       e_bit_array_select_all          (EBitArray    *selection);
void       e_bit_array_invert_selection    (EBitArray    *selection);
gint       e_bit_array_bit_count           (EBitArray    *selection);
void       e_bit_array_change_one_row      (EBitArray    *selection,
                        gint           row,
                        gboolean      grow);
void       e_bit_array_change_range        (EBitArray    *selection,
                        gint           start,
                        gint           end,
                        gboolean      grow);
void       e_bit_array_select_single_row   (EBitArray    *eba,
                        gint           row);
void       e_bit_array_toggle_single_row   (EBitArray    *eba,
                        gint           row);

void       e_bit_array_insert              (EBitArray    *esm,
                        gint           row,
                        gint           count);
void       e_bit_array_delete              (EBitArray    *esm,
                        gint           row,
                        gint           count);
void       e_bit_array_delete_single_mode  (EBitArray    *esm,
                        gint           row,
                        gint           count);
void       e_bit_array_move_row            (EBitArray    *esm,
                        gint           old_row,
                        gint           new_row);

gboolean   e_bit_array_cross_and           (EBitArray    *esm);
gboolean   e_bit_array_cross_or            (EBitArray    *esm);

#ifdef __cplusplus
}
#endif /* __cplusplus */


#endif /* _E_BIT_ARRAY_H_ */