本文整理汇总了C#中Gtk.TreeStore.SetValues方法的典型用法代码示例。如果您正苦于以下问题:C# TreeStore.SetValues方法的具体用法?C# TreeStore.SetValues怎么用?C# TreeStore.SetValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.TreeStore
的用法示例。
在下文中一共展示了TreeStore.SetValues方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTeamSelectionList
/**
* Creates the model for the treeview in the team selection window.
* The model contains a list of all the teams from the leagues in
* the country::leagues array; if show_cup_teams is TRUE, the
* teams from international cups are shown, too.
* @param show_cup_teams Whether or not teams from international
* cups are shown.
* @param show_user_teams Whether or not user teams are shown.
* @return The model containing the team names.
**/
public static TreeModel CreateTeamSelectionList(Country country, bool showCupTeams, bool showUserTeams)
{
#if DEBUG
Console.WriteLine("TreeViewHelper.CreateTeamSelectionList");
#endif
int count = 1;
TreeStore ls = new TreeStore(typeof(int), typeof(Gdk.Pixbuf), typeof(Team), typeof(string), typeof(Team));
for (int i = 0; i < country.Leagues.Count; i++) {
League league = country.Leagues [i];
for (int j = 0; j < league.teams.Count; j++) {
Team team = league.teams [j];
if (!team.IsUserTeam())
{
Pixbuf symbol = PixbufFromFilename (!string.IsNullOrEmpty (team.symbol) ? team.symbol : league.symbol);
TreeIter iter = ls.AppendNode();
ls.SetValues (iter, count++, symbol, team, league.name, team);
}
}
}
if (showCupTeams) {
}
return ls;
}
示例2: CreateUsers
/** Fill a tree model with the users. */
public static TreeModel CreateUsers()
{
#if DEBUG
Console.WriteLine("TreeViewHelper.CreateUsers");
#endif
TreeStore ls = new TreeStore(typeof(int), typeof(string), typeof(string), typeof(string));
for (int i = 0; i < Variables.Users.Count; i++) {
TreeIter iter = ls.AppendNode ();
ls.SetValues (iter, i + 1, Variables.Users [i].Name, Variables.Users [i].Team.name);
if (Variables.status [0] == StatusValue.STATUS_TEAM_SELECTION) {
if (Variables.Users [i].Scout == Quality.QUALITY_NONE) {
ls.SetValue (iter, 3, Variables.LeagueCupGetName(Variables.Users[i].Team.clid));
} else {
int index = (int)Variables.Users [i].Scout;
ls.SetValue (iter, 3, Variables.Country.Leagues[index].name);
}
} else {
ls.SetValue (iter, 3, Variables.LeagueCupGetName(Variables.Users[i].Team.clid));
}
}
return ls;
}
示例3: CreateCountryList
/** Create the model for the startup country files combo.
* @param countryList The List of country files found */
public static TreeModel CreateCountryList(string[] countryList)
{
#if DEBUG
Console.WriteLine("TreeViewHelper.CreateCountryList");
#endif
TreeStore ls = new TreeStore(typeof(Pixbuf), typeof(string));
TreeIter iterContinent = new TreeIter ();
string currentContinent = string.Empty;
foreach (string country in countryList) {
string[] elements = country.Split(new char[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
string continent = elements [0];
if (continent != currentContinent) {
iterContinent = ls.AppendNode ();
ls.SetValue(iterContinent, 1, continent);
currentContinent = continent;
}
Pixbuf flag = PixbufFromFilename (string.Format ("flag_{0}.png", elements [1]));
TreeIter iterCountry = ls.AppendNode (iterContinent);
ls.SetValues(iterCountry, flag, elements[1]);
}
return ls;
}
示例4: Order
public Order()
: base(Gtk.WindowType.Toplevel)
{
this.Build();
notebook1.CurrentPage = 0;
ComboWorks.ComboFillReference(comboExhibition, "exhibition", ComboWorks.ListMode.WithNo, true, "ordinal");
dateArrval.Date = DateTime.Today;
//Создаем таблицу номенклатуры
ComboBox TempCombo = new ComboBox();
ComboWorks.ComboFillReference(TempCombo, "materials", ComboWorks.ListMode.WithNo, true, "ordinal");
MaterialNameList = TempCombo.Model;
TempCombo.Destroy ();
TempCombo = new ComboBox();
ComboWorks.ComboFillReference(TempCombo, "facing", ComboWorks.ListMode.WithNo, true, "ordinal");
FacingNameList = TempCombo.Model;
TempCombo.Destroy ();
ComponentsStore = new TreeStore(
typeof(long), //row_id
typeof(Nomenclature.NomType), //nomenclature_type
typeof(int), //nomenclature_id
typeof(string), //nomenclature
typeof(string), //nomenclature_title
typeof(string), //nomenclature_description
typeof(int), //count
typeof(int), //material_id
typeof(string), //material
typeof(int), //facing_id
typeof(string), //facing
typeof(string), //comment
typeof(string), //price
typeof(string), //price_total
typeof(bool), //editable_count
typeof(bool), //editable_price
typeof(bool), //editable_material
typeof(bool), //editable_facing
typeof(bool), //editable_comment
typeof(bool), //editable_discount
typeof(int), //discount
typeof(bool)); //editable_name
BasisIter = ComponentsStore.AppendValues (
(long)-1,
Enum.Parse(typeof(Nomenclature.NomType), "construct"),
1,
null,
"Каркас",
null,
1,
-1,
"",
-1,
"",
"",
"",
"",
false,
false,
false,
false,
false,
false,
null,
false);
ServiceIter = ComponentsStore.InsertNodeAfter (BasisIter);
ComponentsStore.SetValues (
ServiceIter,
(long)-1,
Enum.Parse (typeof(Nomenclature.NomType), "other"),
1,
null,
"Услуги",
"Кликните правой кнопкой мышы для добавления услуги",
0,
-1,
"",
-1,
"",
"",
"",
"",
false,
false,
false,
false,
false,
false,
null,
false);
ColumnCount = new Gtk.TreeViewColumn ();
ColumnCount.Title = "Кол-во";
Gtk.CellRendererText CellCount = new CellRendererText ();
CellCount.Editable = true;
CellCount.Edited += OnCountEdited;
ColumnCount.PackStart (CellCount, true);
//.........这里部分代码省略.........
示例5: populateTreeStoreFromSession
private TreeStore populateTreeStoreFromSession()
{
TreeStore ts = new TreeStore(typeof(string), typeof(string));
TreeIter iter;
TreeIter parent = ts.AppendNode();
iter = parent;
ts.SetValues(iter, "Nanoc","Human, male");
iter = ts.AppendNode(iter);
ts.SetValues(iter, "Abilities", "");
ts.AppendValues(iter, "Charisma","0");
ts.AppendValues(iter, "Dexterity","+1");
ts.AppendValues(iter, "Intelligence", "0");
ts.AppendValues(iter, "Power","0");
ts.AppendValues(iter, "Perception","+1");
ts.AppendValues(iter, "Strength","+4");
ts.AppendValues(iter, "Stamina","+2");
ts.AppendValues(iter, "Willpower","+1");
iter = ts.AppendNode(parent);
ts.SetValues(iter, "Experience", "");
ts.AppendValues(iter, "Level", "1");
ts.AppendValues(iter, "Barbarian", "230");
iter = ts.AppendNode(parent);
ts.SetValues(iter, "Adventures", "");
return ts;
}
示例6: ShowAdd2Page
private void ShowAdd2Page()
{
Header = CmisSync.Properties_Resources.ResourceManager.GetString("Which", CultureInfo.CurrentCulture);
VBox layout_vertical = new VBox (false, 12);
Button cancel_button = new Button (cancelText);
cancel_button.Clicked += delegate {
Controller.PageCancelled ();
};
Button continue_button = new Button (continueText)
{
Sensitive = false
};
continue_button.Clicked += delegate {
Controller.Add2PageCompleted(
Controller.saved_repository, Controller.saved_remote_path);
};
Button back_button = new Button (backText)
{
Sensitive = true
};
back_button.Clicked += delegate {
Controller.BackToPage1();
};
TreeStore repoStore = new Gtk.TreeStore(typeof (string), typeof (SelectionTreeItem));
TreeIter iter;
foreach (KeyValuePair<String, String> repository in Controller.repositories)
{
iter = repoStore.AppendNode();
repoStore.SetValues(iter, repository.Value , new SelectionTreeItem(repository.Key, "/"));
}
Gtk.TreeView treeView = new Gtk.TreeView(repoStore);
treeView.HeadersVisible = false;
treeView.Selection.Mode = SelectionMode.Single;
treeView.AppendColumn("Name", new CellRendererText(), "text", 0);
treeView.CursorChanged += delegate(object o, EventArgs args) {
TreeSelection selection = (o as TreeView).Selection;
TreeModel model;
if (selection.GetSelected(out model, out iter)) {
SelectionTreeItem sti = model.GetValue(iter, 1) as SelectionTreeItem;
// Identify the selected remote path.
Controller.saved_remote_path = sti.fullPath;
// Identify the selected repository.
TreeIter cnode = iter;
TreeIter pnode = iter;
while (model.IterParent(out pnode, cnode)) {
cnode = pnode;
}
Controller.saved_repository = (model.GetValue(cnode, 1) as SelectionTreeItem).repository;
// Load sub-folders if it has not been done already.
// We use each item's Tag to store metadata: whether this item's subfolders have been loaded or not.
if (sti.childrenLoaded == false)
{
this.GdkWindow.Cursor = wait_cursor;
// Get list of subfolders asynchronously
GetSubfoldersDelegate dlgt = new GetSubfoldersDelegate(CmisUtils.GetSubfolders);
IAsyncResult ar = dlgt.BeginInvoke(Controller.saved_repository,
Controller.saved_remote_path, Controller.saved_address,
Controller.saved_user, Controller.saved_password, null, null);
while (!ar.AsyncWaitHandle.WaitOne(100)) {
while (Application.EventsPending()) {
Application.RunIteration();
}
}
string[] subfolders = dlgt.EndInvoke(ar);
TreePath tp = null;
// Create a sub-item for each subfolder
foreach (string subfolder in subfolders) {
TreeIter newchild = repoStore.AppendNode(iter);
repoStore.SetValues(newchild, System.IO.Path.GetFileName(subfolder),
new SelectionTreeItem(null, subfolder));
if (null == tp) {
tp = repoStore.GetPath(newchild);
}
}
sti.childrenLoaded = true;
if (null != tp) {
treeView.ExpandToPath(tp);
}
this.GdkWindow.Cursor = default_cursor;
}
continue_button.Sensitive = true;
}
};
ScrolledWindow sw = new ScrolledWindow() {
ShadowType = Gtk.ShadowType.In
};
sw.Add(treeView);
//.........这里部分代码省略.........
示例7: DemoMain
public DemoMain ()
{
window = new Gtk.Window ("TestForm1");
Gtk.HBox hbox = new Gtk.HBox (false, 0);
hbox1 = new Gtk.HBox (false, 0);
Gtk.HBox hbox2 = new Gtk.HBox (false, 0);
Gtk.HBox hbox3 = new Gtk.HBox (false, 0);
hbox.Add (hbox1);
window.SetDefaultSize (600, 400);
window.DeleteEvent += new DeleteEventHandler (WindowDelete);
button1 = new Gtk.Button ("button1");
button1.Clicked += Button1Clicked;
button2 = new Gtk.Button ("button2");
button3 = new Gtk.Button ("button3");
Gtk.Button button4 = new Gtk.Button ("button4");
button4.Clicked += Button4Clicked;
Gtk.Button button5 = new Gtk.Button ("button5");
Gtk.Button button6 = new Gtk.Button ("button6");
Gtk.Button button7 = new Gtk.Button ("button7");
button7.Sensitive = false;
scaleButton1 = new Gtk.ScaleButton (0, 0, 100, 10, new string [0]);
hbox1.Add (hbox3);
hbox1.Add (hbox2);
hbox1.Add (button3);
hbox1.Add (button2);
button3.Accessible.Description = "help text 3";
button3.Sensitive = false;
label1 = new Gtk.Label ("label1");
textBox1 = new Gtk.Entry ();
Gtk.Entry textBox2 = new Gtk.Entry ();
textBox2.Visibility = false;
textBox2.Sensitive = false;
textBox2.IsEditable = false;
textBox3 = new Gtk.TextView ();
// TODO: scrollbars
Gtk.CheckButton checkbox1 = new Gtk.CheckButton ("checkbox1");
Gtk.CheckButton checkbox2 = new Gtk.CheckButton ("checkbox2");
checkbox2.Sensitive = false;
Gtk.TreeStore store = new Gtk.TreeStore (typeof (string), typeof (string));
Gtk.TreeIter [] iters = new Gtk.TreeIter [2];
iters [0] = store.AppendNode ();
store.SetValues (iters [0], "item 1", "item 1 (2)");
iters [1] = store.AppendNode (iters [0]);
store.SetValues (iters [1], "item 1a", "item 1a (2)");
iters [0] = store.AppendNode ();
store.SetValues (iters [0], "item 2", "item 2 (2)");
iters [1] = store.AppendNode (iters [0]);
store.SetValues (iters [1], "item 2a", "item 2a (2)");
iters [1] = store.AppendNode (iters [0]);
store.SetValues (iters [1], "item 2b", "item 2b (2)");
treeView1 = new Gtk.TreeView (store);
AddTreeViewColumn (treeView1, 0, "column 1");
treeView1.CollapseAll ();
treeView2 = new Gtk.TreeView (store);
AddTreeViewColumn (treeView2, 0, "column 1");
AddTreeViewColumn (treeView2, 1, "column 2");
treeView2.CollapseAll ();
treeView2.Accessible.Name = "treeView2";
tableStore = new Gtk.TreeStore (typeof (string), typeof (string), typeof (string), typeof (string));
iters [0] = tableStore.AppendNode ();
tableStore.SetValues (iters [0], "False", "Alice", "24", "");
iters [0] = tableStore.AppendNode ();
tableStore.SetValues (iters [0], "True", "Bob", "28", "");
dataGridView1 = new Gtk.TreeView (tableStore);
dataGridView1 = new Gtk.TreeView (tableStore);
dataGridView1 = new Gtk.TreeView (tableStore);
AddTreeViewColumn (dataGridView1, 0, "Gender");
AddTreeViewColumn (dataGridView1, 1, "Name");
AddTreeViewColumn (dataGridView1, 2, "Age");
dataGridView1.Accessible.Name = "dataGridView1";
hboxPanel = new Gtk.HBox ();
Gtk.Button btnRemoveTextBox = new Gtk.Button ("Remove");
btnRemoveTextBox.Clicked += RemoveTextBoxClicked;
Gtk.Button btnAddTextBox = new Gtk.Button ("Add");
btnAddTextBox.Clicked += AddTextBoxClicked;
txtCommand = new Gtk.Entry ();
txtCommand.Accessible.Name = "txtCommand";
Gtk.Button btnRun = new Gtk.Button ("Run");
btnRun.Clicked += btnRunClicked;
hboxPanel.Add (btnRemoveTextBox);
hboxPanel.Add (btnAddTextBox);
Gtk.TreeStore treeStore = new Gtk.TreeStore (typeof (string));
Gtk.TreeIter iter = treeStore.AppendNode ();
treeStore.SetValue (iter, 0, "Item 0");
iter = treeStore.AppendNode ();
treeStore.SetValue (iter, 0, "Item 1");
listView1 = new Gtk.TreeView (treeStore);
AddTreeViewColumn (listView1, 0, "items");
listView1.Accessible.Name = "listView1";
//.........这里部分代码省略.........
示例8: CoverageView
public CoverageView(string fileName, ProgressBar status)
{
store = new TreeStore (typeof (string), typeof (string), typeof (string), typeof (string), typeof (object));
tree = new TreeView (store);
CellRendererText renderer = new CellRendererText ();
CellRendererText coverageRenderer = new CellRendererText ();
// LAME: Why is this property a float instead of a double ?
renderer.Xalign = 0.5f;
tree.AppendColumn ("Classes", new CellRendererText (), "text", 0);
tree.AppendColumn ("Lines Hit", renderer, "text", 1);
tree.AppendColumn ("Lines Missed", renderer, "text", 2);
tree.AppendColumn ("Coverage", coverageRenderer, "text", 3);
tree.GetColumn (0).Resizable = true;
tree.GetColumn (1).Alignment = 0.0f;
tree.GetColumn (1).Resizable = true;
tree.GetColumn (2).Alignment = 0.0f;
tree.GetColumn (2).Resizable = true;
tree.GetColumn (3).Alignment = 0.0f;
tree.GetColumn (3).Resizable = true;
tree.GetColumn (3).SetCellDataFunc (coverageRenderer, new TreeCellDataFunc (RenderCoverage));
tree.HeadersVisible = true;
model = new CoverageModel ();
foreach (string filter in DEFAULT_FILTERS) {
model.AddFilter (filter);
}
this.status = status;
model.Progress += Progress;
model.ReadFromFile (fileName);
TreeItem root = new TreeItem (store, null, model, "PROJECT");
Hashtable classes2 = model.Classes;
namespaces = new Hashtable ();
string[] sorted_names = new string [classes2.Count];
classes2.Keys.CopyTo (sorted_names, 0);
Array.Sort (sorted_names);
Progress ("Building tree", 0.95);
foreach (string name in sorted_names) {
ClassCoverageItem klass = (ClassCoverageItem)classes2 [name];
if (klass.filtered)
continue;
string namespace2 = klass.name_space;
TreeItem nsItem = (TreeItem)namespaces [namespace2];
if (nsItem == null) {
nsItem = new TreeItem (store, root, (CoverageItem)model.Namespaces [namespace2], namespace2);
// nsItem.SetPixmap (0, namespaceOpenPixmap);
namespaces [namespace2] = nsItem;
}
if (nsItem.model.filtered)
continue;
ClassItem classItem = new ClassItem (store, nsItem, klass, klass.name);
if (klass.ChildCount != 0) {
TreeIter treeIter = store.AppendNode (classItem.iter);
store.SetValues (treeIter, "<loading>");
}
}
tree.ExpandRow (store.GetPath (root.Iter), false);
// it becomes very hard to navigate if everything is expanded
//foreach (string ns in namespaces.Keys)
// tree.ExpandRow (store.GetPath (((TreeItem)namespaces [ns]).Iter), false);
tree.RowExpanded += new RowExpandedHandler (OnRowExpanded);
tree.RowCollapsed += new RowCollapsedHandler (OnRowCollapsed);
tree.ButtonPressEvent += new ButtonPressEventHandler (OnButtonPress);
tree.Selection.Mode = SelectionMode.Single;
source_views = new Hashtable ();
window_maps = new Hashtable ();
Progress ("Done", 1.0);
// LAME: Why doesn't widgets visible by default ???
tree.Show ();
}