示例#1
0
        void CellRendererToggleToggled(object o, ToggledArgs args)
        {
            TreeIter iter;

            if (store.GetIterFromString(out iter, args.Path))
            {
                CodeFormatOption option = (CodeFormatOption)store.GetValue(iter, objectColumn);
                bool             value  = !(bool)store.GetValue(iter, toggleColumn);
                description.SetValue(settings, option, value ? "True" : "False");
                store.SetValue(iter, toggleColumn, value);
                UpdateExample();
            }
        }
示例#2
0
        /*
         * void AddCategoryPage (CodeFormatCategory category)
         * {
         *      Gtk.Label label = new Gtk.Label (GettextCatalog.GetString (category.DisplayName));
         *
         *      foreach (CodeFormatCategory cat in category.SubCategories) {
         *              AppendCategory (store, TreeIter.Zero, cat);
         *      }
         *      Gtk.TreeView tree = new Gtk.TreeView (store);
         *      tree.AppendColumn (GettextCatalog.GetString ("Key"), new CellRendererText (), "text", keyColumn);
         *      tree.AppendColumn (GettextCatalog.GetString ("Value"), new CellRendererText (), "text", valueDisplayTextColumn);
         *
         *      ScrolledWindow sw = new ScrolledWindow ();
         *      sw.Child = tree;
         *      NotebookCategories.AppendPage (sw, label);
         * }*/

        void TreeSelectionChanged(object sender, EventArgs e)
        {
            Gtk.TreeSelection treeSelection = (Gtk.TreeSelection)sender;
            if (treeSelection.GetSelected(out model, out iter))
            {
                option     = model.GetValue(iter, objectColumn) as CodeFormatOption;
                this.store = model as TreeStore;
                if (option == null)
                {
                    texteditor1.Document.Text = "";
                    return;
                }
                CodeFormatType type = description.GetCodeFormatType(settings, option);
                texteditor1.Document.Text = option.Example;

                comboBoxStore.Clear();
                foreach (KeyValuePair <string, string> v in type.Values)
                {
                    comboBoxStore.AppendValues(v.Key, GettextCatalog.GetString(v.Value));
                }
                UpdateExample();
            }
        }