Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Oblomov
gtk
Commits
005f39e0
Commit
005f39e0
authored
Feb 20, 1998
by
Jay Painter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved widget creation to gtk_clist_construct for the gtk-- folks.
parent
75fbe1ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
40 deletions
+56
-40
gtk/gtkclist.c
gtk/gtkclist.c
+49
-38
gtk/gtkclist.h
gtk/gtkclist.h
+7
-2
No files found.
gtk/gtkclist.c
View file @
005f39e0
...
...
@@ -415,20 +415,62 @@ gtk_clist_init (GtkCList * clist)
clist
->
selection
=
NULL
;
}
/* Constructors */
void
gtk_clist_construct
(
GtkCList
*
clist
,
gint
columns
,
gchar
*
titles
[])
{
int
i
;
/* initalize memory chunks */
clist
->
row_mem_chunk
=
g_mem_chunk_new
(
"clist row mem chunk"
,
sizeof
(
GtkCListRow
),
sizeof
(
GtkCListRow
)
*
CLIST_OPTIMUM_SIZE
,
G_ALLOC_AND_FREE
);
clist
->
cell_mem_chunk
=
g_mem_chunk_new
(
"clist cell mem chunk"
,
sizeof
(
GtkCell
)
*
columns
,
sizeof
(
GtkCell
)
*
columns
*
CLIST_OPTIMUM_SIZE
,
G_ALLOC_AND_FREE
);
/* set number of columns, allocate memory */
clist
->
columns
=
columns
;
clist
->
column
=
columns_new
(
clist
);
/* there needs to be at least one column button
* because there is alot of code that will break if it
* isn't there*/
column_button_create
(
clist
,
0
);
/* create scrollbars */
create_scrollbars
(
clist
);
if
(
titles
)
{
GTK_CLIST_SET_FLAGS
(
clist
,
CLIST_SHOW_TITLES
);
for
(
i
=
0
;
i
<
columns
;
i
++
)
gtk_clist_set_column_title
(
clist
,
i
,
titles
[
i
]);
}
else
{
GTK_CLIST_UNSET_FLAGS
(
clist
,
CLIST_SHOW_TITLES
);
}
}
/*
* GTKCLIST PUBLIC INTERFACE
* gtk_clist_new_with_titles
* gtk_clist_new
*/
GtkWidget
*
gtk_clist_new_with_titles
(
int
columns
,
gtk_clist_new_with_titles
(
g
int
columns
,
gchar
*
titles
[])
{
int
i
;
GtkWidget
*
widget
;
GtkCList
*
clist
;
GtkWidget
*
widget
;
if
(
titles
==
NULL
)
if
(
titles
==
NULL
)
return
NULL
;
widget
=
gtk_clist_new
(
columns
);
...
...
@@ -437,51 +479,20 @@ gtk_clist_new_with_titles (int columns,
else
clist
=
GTK_CLIST
(
widget
);
/* set column titles */
GTK_CLIST_SET_FLAGS
(
clist
,
CLIST_SHOW_TITLES
);
for
(
i
=
0
;
i
<
columns
;
i
++
)
{
gtk_clist_set_column_title
(
clist
,
i
,
titles
[
i
]);
}
gtk_clist_construct
(
clist
,
columns
,
titles
);
return
widget
;
}
GtkWidget
*
gtk_clist_new
(
int
columns
)
gtk_clist_new
(
g
int
columns
)
{
GtkCList
*
clist
;
/* sanity check */
if
(
columns
<
1
)
return
NULL
;
clist
=
gtk_type_new
(
gtk_clist_get_type
());
GTK_CLIST_UNSET_FLAGS
(
clist
,
CLIST_SHOW_TITLES
);
/* initalize memory chunks */
clist
->
row_mem_chunk
=
g_mem_chunk_new
(
"clist row mem chunk"
,
sizeof
(
GtkCListRow
),
sizeof
(
GtkCListRow
)
*
CLIST_OPTIMUM_SIZE
,
G_ALLOC_AND_FREE
);
clist
->
cell_mem_chunk
=
g_mem_chunk_new
(
"clist cell mem chunk"
,
sizeof
(
GtkCell
)
*
columns
,
sizeof
(
GtkCell
)
*
columns
*
CLIST_OPTIMUM_SIZE
,
G_ALLOC_AND_FREE
);
/* set number of columns, allocate memory */
clist
->
columns
=
columns
;
clist
->
column
=
columns_new
(
clist
);
/* there needs to be at least one column button
* because there is alot of code that will break if it
* isn't there*/
column_button_create
(
clist
,
0
);
/* create scrollbars */
create_scrollbars
(
clist
);
gtk_clist_construct
(
clist
,
columns
,
NULL
);
return
GTK_WIDGET
(
clist
);
}
...
...
gtk/gtkclist.h
View file @
005f39e0
...
...
@@ -268,9 +268,14 @@ struct _GtkCell
guint
gtk_clist_get_type
(
void
);
/* constructers useful for gtk-- wrappers */
void
gtk_clist_construct
(
GtkCList
*
clist
,
gint
columns
,
gchar
*
titles
[]);
/* create a new GtkCList */
GtkWidget
*
gtk_clist_new
(
int
columns
);
GtkWidget
*
gtk_clist_new_with_titles
(
int
columns
,
GtkWidget
*
gtk_clist_new
(
g
int
columns
);
GtkWidget
*
gtk_clist_new_with_titles
(
g
int
columns
,
gchar
*
titles
[]);
/* set the border style of the clist */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment