mirror of
https://github.com/ToshioCP/Gtk4-tutorial.git
synced 2025-01-12 20:03:28 +01:00
Bug fixed. GtkListViewItem => GtkListItem.
This commit is contained in:
parent
148736bd26
commit
18dcb7da9f
10 changed files with 32 additions and 27 deletions
2
Rakefile
2
Rakefile
|
@ -43,6 +43,8 @@ file "Readme.md" => mdfilenames do
|
|||
end
|
||||
File.delete("gfm/abstract.md")
|
||||
buf << "\n"
|
||||
buf << "## Table of contents\n\n"
|
||||
buf << "\n"
|
||||
0.upto(srcfiles.size-1) do |i|
|
||||
h = File.open(srcfiles[i].path) { |file| file.readline }
|
||||
h = h.gsub(/^#* */,"").chomp
|
||||
|
|
|
@ -14,6 +14,9 @@ The latest version of the tutorial is located at [Gtk4-tutorial githup repositor
|
|||
You can read it without download.
|
||||
|
||||
|
||||
## Table of contents
|
||||
|
||||
|
||||
1. [Prerequisite and License](gfm/sec1.md)
|
||||
1. [Installation of gtk4 to linux distributions](gfm/sec2.md)
|
||||
1. [GtkApplication and GtkApplicationWindow](gfm/sec3.md)
|
||||
|
|
26
gfm/sec24.md
26
gfm/sec24.md
|
@ -79,34 +79,34 @@ You can also create them alone and add GListModel later.
|
|||
## GtkListView
|
||||
|
||||
GtkListView is a widget to show GListModel items.
|
||||
GtkListViewItem is used by GtkListView to represent items of a list model.
|
||||
But, GtkListViewItem itself is not a widget, so a user needs to set a widget, for example GtkLabel, as a child of GtkListView to display an item of the list model.
|
||||
"item" property of GtkListViewItem points an object that belongs to the list model.
|
||||
GtkListItem is used by GtkListView to represent items of a list model.
|
||||
But, GtkListItem itself is not a widget, so a user needs to set a widget, for example GtkLabel, as a child of GtkListView to display an item of the list model.
|
||||
"item" property of GtkListItem points an object that belongs to the list model.
|
||||
|
||||
![GtkListViewItem](../image/gtklistviewitem.png)
|
||||
![GtkListItem](../image/gtklistitem.png)
|
||||
|
||||
In case the number of items is very big, for example more than a thousand, GtkListViewItem is recycled and connected to another item which is newly displayed.
|
||||
This recycle makes the number of GtkListViewItem objects fairly small, less than 200.
|
||||
In case the number of items is very big, for example more than a thousand, GtkListItem is recycled and connected to another item which is newly displayed.
|
||||
This recycle makes the number of GtkListItem objects fairly small, less than 200.
|
||||
This is very effective to restrain the growth of memory consumption so that GListModel can contain lots of items, for example, more than a million items.
|
||||
|
||||
## GtkListItemFactory
|
||||
|
||||
GtkListItemFactory creates or recycles GtkListViewItem and connects it with an item of the list model.
|
||||
GtkListItemFactory creates or recycles GtkListItem and connects it with an item of the list model.
|
||||
There are two child objects of this factory, GtkSignalListItemFactory and GtkBuilderListItemFactory.
|
||||
|
||||
### GtkSignalListItemFactory
|
||||
|
||||
GtkSignalListItemFactory provides signals for users to configure a GtkListViewItem object.
|
||||
GtkSignalListItemFactory provides signals for users to configure a GtkListItem object.
|
||||
There are four signals.
|
||||
|
||||
1. "setup" is emitted to set up GtkListViewItem object.
|
||||
1. "setup" is emitted to set up GtkListItem object.
|
||||
A user sets its child widget in the handler.
|
||||
For example, creates a GtkLabel widget and sets the child property of GtkListViewItem object to it.
|
||||
This setting is kept even the GtkListViewItem object is recycled (to bind to another item of GModelList).
|
||||
For example, creates a GtkLabel widget and sets the child property of GtkListItem object to it.
|
||||
This setting is kept even the GtkListItem object is recycled (to bind to another item of GModelList).
|
||||
2. "bind" is emitted to bind an item in the list model to the widget.
|
||||
For example, a user gets the item object from "item" property of the GtkListViewItem object.
|
||||
For example, a user gets the item object from "item" property of the GtkListItem object.
|
||||
Then gets the string of the item and sets the label property of the GtkLabel object with the string.
|
||||
This signal is emitted when the GtkListViewItem is newly created and set up, recycled or some changes has happened to the item of the list.
|
||||
This signal is emitted when the GtkListItem is newly created and set up, recycled or some changes has happened to the item of the list.
|
||||
3. "unbind" is emitted to unbind an item.
|
||||
A user undoes everything done in step 2 in the signal handler.
|
||||
If some object are created in step 2, they must be destroyed.
|
||||
|
|
BIN
image/gtklistitem.png
Normal file
BIN
image/gtklistitem.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 30 KiB |
BIN
image/list.png
BIN
image/list.png
Binary file not shown.
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 28 KiB |
BIN
image/list.xcf
BIN
image/list.xcf
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
# lib_gen_main_tex.rb
|
||||
# -- Library ruby script to generate main.tex.
|
||||
|
||||
def gen_main_tex directory, texfilenames, appendixfilenames
|
||||
def gen_main_tex directory, texfilenames, appendixfilenames=nil
|
||||
# parameter: directory: the destination directory to put generated files.
|
||||
# texfilenames: an array of latex files. Each of them is "secXX.tex" where XX is digits.
|
||||
|
||||
|
|
|
@ -85,34 +85,34 @@ You can also create them alone and add GListModel later.
|
|||
## GtkListView
|
||||
|
||||
GtkListView is a widget to show GListModel items.
|
||||
GtkListViewItem is used by GtkListView to represent items of a list model.
|
||||
But, GtkListViewItem itself is not a widget, so a user needs to set a widget, for example GtkLabel, as a child of GtkListView to display an item of the list model.
|
||||
"item" property of GtkListViewItem points an object that belongs to the list model.
|
||||
GtkListItem is used by GtkListView to represent items of a list model.
|
||||
But, GtkListItem itself is not a widget, so a user needs to set a widget, for example GtkLabel, as a child of GtkListView to display an item of the list model.
|
||||
"item" property of GtkListItem points an object that belongs to the list model.
|
||||
|
||||
![GtkListViewItem](../image/gtklistviewitem.png){width=10cm height=7.5cm}
|
||||
![GtkListItem](../image/gtklistitem.png){width=10cm height=7.5cm}
|
||||
|
||||
In case the number of items is very big, for example more than a thousand, GtkListViewItem is recycled and connected to another item which is newly displayed.
|
||||
This recycle makes the number of GtkListViewItem objects fairly small, less than 200.
|
||||
In case the number of items is very big, for example more than a thousand, GtkListItem is recycled and connected to another item which is newly displayed.
|
||||
This recycle makes the number of GtkListItem objects fairly small, less than 200.
|
||||
This is very effective to restrain the growth of memory consumption so that GListModel can contain lots of items, for example, more than a million items.
|
||||
|
||||
## GtkListItemFactory
|
||||
|
||||
GtkListItemFactory creates or recycles GtkListViewItem and connects it with an item of the list model.
|
||||
GtkListItemFactory creates or recycles GtkListItem and connects it with an item of the list model.
|
||||
There are two child objects of this factory, GtkSignalListItemFactory and GtkBuilderListItemFactory.
|
||||
|
||||
### GtkSignalListItemFactory
|
||||
|
||||
GtkSignalListItemFactory provides signals for users to configure a GtkListViewItem object.
|
||||
GtkSignalListItemFactory provides signals for users to configure a GtkListItem object.
|
||||
There are four signals.
|
||||
|
||||
1. "setup" is emitted to set up GtkListViewItem object.
|
||||
1. "setup" is emitted to set up GtkListItem object.
|
||||
A user sets its child widget in the handler.
|
||||
For example, creates a GtkLabel widget and sets the child property of GtkListViewItem object to it.
|
||||
This setting is kept even the GtkListViewItem object is recycled (to bind to another item of GModelList).
|
||||
For example, creates a GtkLabel widget and sets the child property of GtkListItem object to it.
|
||||
This setting is kept even the GtkListItem object is recycled (to bind to another item of GModelList).
|
||||
2. "bind" is emitted to bind an item in the list model to the widget.
|
||||
For example, a user gets the item object from "item" property of the GtkListViewItem object.
|
||||
For example, a user gets the item object from "item" property of the GtkListItem object.
|
||||
Then gets the string of the item and sets the label property of the GtkLabel object with the string.
|
||||
This signal is emitted when the GtkListViewItem is newly created and set up, recycled or some changes has happened to the item of the list.
|
||||
This signal is emitted when the GtkListItem is newly created and set up, recycled or some changes has happened to the item of the list.
|
||||
3. "unbind" is emitted to unbind an item.
|
||||
A user undoes everything done in step 2 in the signal handler.
|
||||
If some object are created in step 2, they must be destroyed.
|
||||
|
|
Loading…
Reference in a new issue