Программирование с gtkmm (Главы 8-9)

Translate into another language.

Participants

yaskhan1575 points
eReS1247 points
Knivy1081 points
And others...
Join Translated.by to translate! If you already have a Translated.by account, please sign in.
If you do not want to register an account, you can sign in with OpenID.
Pages: ← previous Ctrl next next untranslated

Programming with gtkmm (chapters 8-9)

Программирование с gtkmm (Главы 8-9)

History of edits (Latest: lynx 1 year, 10 months ago) §

8.  The TreeView widget

8. Виджет TreeView

History of edits (Latest: lynx 1 year, 10 months ago) §

The Gtk::TreeView widget can contain lists or trees of data, in columns.

Виджет Gtk::TreeView может содержать списки или деревья данных в столбцах.

History of edits (Latest: lynx 1 year, 10 months ago) §

* 8.1. The Model

*8.1. Модель

History of edits (Latest: lynx 1 year, 10 months ago) §

* 8.2. The View

*8.2. Вид

History of edits (Latest: lynx 1 year, 10 months ago) §

* 8.3. Iterating over Model Rows

*8.3. Итерации по рядам модели

History of edits (Latest: Knivy 1 year, 9 months ago) §

* 8.4. The Selection

* 8.4. Выделение

History of edits (Latest: lynx 1 year, 10 months ago) §

* 8.5.  Sorting

* 8.5. Сортировка

History of edits (Latest: Knivy 1 year, 9 months ago) §

* 8.6. Drag and Drop

*8.6.Перетаскивание

History of edits (Latest: Knivy 1 year, 9 months ago) §

* 8.7.  Popup Context Menu

* 8.7. Контекстное меню

History of edits (Latest: Knivy 1 year, 9 months ago) §

* 8.8. Examples

* 8.8.Примеры

History of edits (Latest: Knivy 1 year, 9 months ago) §

8.1.  The Model

8.1. Модель

History of edits (Latest: Knivy 1 year, 9 months ago) §

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 ("вида") могут показывать различные поля из одной и той же таблицы базы данных.

History of edits (Latest: Knivy 1 year, 9 months ago) §

Although you can theoretically implement your own Model, you will normally use either the ListStore or TreeStore model classes.

Хотя в принципе вы можете реализовать собственную модель, скорее всего вы будете использовать классы моделей ListStore или TreeStore.

History of edits (Latest: Knivy 1 year, 9 months ago) §

Reference

Справочный материал

History of edits (Latest: Knivy 1 year, 9 months ago) §

* 8.1.1. ListStore, for rows

* 8.1.1. ListStore, для рядов

History of edits (Latest: Knivy 1 year, 9 months ago) §

— может по смыслу быть спутано со strings строки Knivy

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

* 8.1.2. TreeStore, for a hierarchy

* 8.1.2. TreeStore, для иерархии

History of edits (Latest: Knivy 1 year, 9 months ago) §

* 8.1.3.  Model Columns

* 8.1.3. Столбцы модели

History of edits (Latest: Knivy 1 year, 9 months ago) §

* 8.1.4. Adding Rows

* 8.1.4. Добавление рядов

History of edits (Latest: Knivy 1 year, 9 months ago) §

* 8.1.5. Setting values

* 8.1.5. Установка значений

History of edits (Latest: Knivy 1 year, 9 months ago) §

* 8.1.6.  Getting values

* 8.1.6. Получение значений

History of edits (Latest: Knivy 1 year, 9 months ago) §

* 8.1.7.  "Hidden" Columns

* 8.1.7. "Скрытые" столбцы

History of edits (Latest: Knivy 1 year, 9 months ago) §

8.1.1.  ListStore, for rows

* 8.1.1. ListStore, для рядов

History of edits (Latest: Knivy 1 year, 9 months ago) §

The ListStore contains simple rows of data, and each row has no children.

ListStore содержит простые ряды данных, у которых нет дочерних рядов.

History of edits (Latest: Knivy 1 year, 9 months ago) §

Figure 8-1 TreeView - ListStore

Рисунок 8-1. TreeView - ListStore

History of edits (Latest: Knivy 1 year, 9 months ago) §

Reference

Справочный материал

History of edits (Latest: Knivy 1 year, 9 months ago) §

8.1.2.  TreeStore, for a hierarchy

* 8.1.2. TreeStore, для иерархии

History of edits (Latest: Knivy 1 year, 9 months ago) §

The TreeStore contains rows of data, and each row may have child rows.

TreeStore содержит ряды данных, у каждого из которых могут быть дочерние ряды.

History of edits (Latest: Knivy 1 year, 9 months ago) §

Figure 8-2 TreeView - TreeStore

Рисунок 8-2. TreeView - TreeStore

History of edits (Latest: Knivy 1 year, 9 months ago) §

Reference

Справочный материал

History of edits (Latest: Knivy 1 year, 9 months ago) §

8.1.3.  Model Columns

8.1.3. Столбцы модели

History of edits (Latest: Knivy 1 year, 9 months ago) §

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 в качестве данных-членов.

History of edits (Latest: Knivy 1 year, 9 months ago) §

— Поскольку названия классов говорящие, есть смысл сделать их список с переводом и вставить отдельно, например, в конце главы или книги. Knivy

— Есть неплохое пособие по етом :) Там класы все что есть, и описание про каждый, перевести тоже стоит) eReS

— Но список все равно был бы кстати, чтобы книгу эту можно было читать без доп. справочников. Knivy

— Согласен :) eReS

class ModelColumns : public Gtk::TreeModelColumnRecord

class ModelColumns : public Gtk::TreeModelColumnRecord

History of edits (Latest: eReS 1 year, 10 months ago) §

{

{

History of edits (Latest: eReS 1 year, 10 months ago) §

public:

public:

History of edits (Latest: eReS 1 year, 10 months ago) §

ModelColumns()

ModelColumns()

History of edits (Latest: eReS 1 year, 10 months ago) §

{ add(m_col_text); add(m_col_number); }

{ add(m_col_text); add(m_col_number); }

History of edits (Latest: eReS 1 year, 10 months ago) §

Gtk::TreeModelColumn<Glib::ustring> m_col_text;

Gtk::TreeModelColumn<Glib::ustring> m_col_text;

History of edits (Latest: eReS 1 year, 10 months ago) §

Gtk::TreeModelColumn<int> m_col_number;

Gtk::TreeModelColumn<int> m_col_number;

History of edits (Latest: eReS 1 year, 10 months ago) §
Pages: ← previous Ctrl next next untranslated

© Copyright © 2002-2006 Murray Cumming. License: GNU FDL