Программирование с gtkmm (Главы 8-9) | Participants
|
- Statistics
- Participants
- Translate into Russian
- Translation result
- 75% translated in draft. Almost done, let's finish it!
If you do not want to register an account, you can sign in with OpenID.
Programming with gtkmm (chapters 8-9) | ||
8. The TreeView widget | ||
The Gtk::TreeView widget can contain lists or trees of data, in columns. | Виджет Gtk::TreeView может содержать списки или деревья данных в столбцах. | |
* 8.1. The Model | ||
* 8.2. The View | ||
* 8.3. Iterating over Model Rows | ||
* 8.4. The Selection | ||
* 8.5. Sorting | ||
* 8.6. Drag and Drop | ||
* 8.7. Popup Context Menu | ||
* 8.8. Examples | ||
8.1. The Model | ||
Each Gtk::TreeView has an associated Gtk::TreeModel, which contains the data displayed by the TreeView. Each Gtk::TreeModel can be used by more than one Gtk::TreeView. For instance, this allows the same underlying data to be displayed and edited in 2 different ways at the same time. Or the 2 Views might display different columns from the same Model data, in the same way that 2 SQL queries (or "views") might show different fields from the same database table. | У каждого Gtk::TreeView есть ассоциированная с ним Gtk::TreeModel, содержащая данные, отображаемые TreeView. Каждая Gtk::TreeModel может применяться более чем одним Gtk::TreeView. Например, это позволяет одновременно отображать и редактировать одни и те же данные двумя разными способами. Или два вида могут отображать различные колонки из данных одной и той же модели, аналогично тому как 2 запроса SQL ("вида") могут показывать различные поля из одной и той же таблицы базы данных. | |
Although you can theoretically implement your own Model, you will normally use either the ListStore or TreeStore model classes. | Хотя в принципе вы можете реализовать собственную модель, скорее всего вы будете использовать классы моделей ListStore или TreeStore. | |
Reference | ||
* 8.1.1. ListStore, for rows | ||
* 8.1.2. TreeStore, for a hierarchy | ||
* 8.1.3. Model Columns | ||
* 8.1.4. Adding Rows | ||
* 8.1.5. Setting values | ||
* 8.1.6. Getting values | ||
* 8.1.7. "Hidden" Columns | ||
8.1.1. ListStore, for rows | ||
The ListStore contains simple rows of data, and each row has no children. | ListStore содержит простые ряды данных, у которых нет дочерних рядов. | |
Figure 8-1 TreeView - ListStore | ||
Reference | ||
8.1.2. TreeStore, for a hierarchy | ||
The TreeStore contains rows of data, and each row may have child rows. | TreeStore содержит ряды данных, у каждого из которых могут быть дочерние ряды. | |
Figure 8-2 TreeView - TreeStore | ||
Reference | ||
8.1.3. Model Columns | ||
The TreeModelColumnRecord class is used to keep track of the columns and their data types. You add TreeModelColumn instances to the ColumnRecord and then use those TreeModelColumns when getting and setting the data in model rows. You will probably find it convenient to derive a new TreeModelColumnRecord which has your TreeModelColumn instances as member data. | Класс TreeModelColumnRecord ("записи в столбцах модели дерева данных") используется для отслеживания столбцов и типов данных в них. Вы добавляете объекты класса TreeModelColumn ("столбец модели дерева данных") в ColumnRecord ("запись в столбце"), а затем используете эти объекты TreeModelColumn при получении и установке значений данных в рядах модели. Вы можете счесть удобным наследовать новую TreeModelColumnRecord с вашими объектами TreeModelColumn в качестве данных-членов. | — Поскольку названия классов говорящие, есть смысл сделать их список с переводом и вставить отдельно, например, в конце главы или книги. — Knivy — Есть неплохое пособие по етом :) Там класы все что есть, и описание про каждый, перевести тоже стоит) — eReS — Но список все равно был бы кстати, чтобы книгу эту можно было читать без доп. справочников. — Knivy — Согласен :) — eReS |
class ModelColumns : public Gtk::TreeModelColumnRecord | class ModelColumns : public Gtk::TreeModelColumnRecord | |
{ | ||
public: | ||
ModelColumns() | ||
{ add(m_col_text); add(m_col_number); } | ||
Gtk::TreeModelColumn<Glib::ustring> m_col_text; | ||
Gtk::TreeModelColumn<int> m_col_number; |
© Copyright © 2002-2006 Murray Cumming. License: GNU FDL

— может по смыслу быть спутано со strings строки — Knivy
— По-моему не так критично, ясно ведь, что речь идёт о таблицах. А ряд тут звучит как-то не очень. — netrino