display the info page from comments in the source
and add missing descriptions svn path=/trunk/gtk-sharp/; revision=38236
This commit is contained in:
parent
a990c6af9a
commit
8fc739e12c
12 changed files with 97 additions and 21 deletions
|
@ -1,3 +1,8 @@
|
|||
/* Clipboard
|
||||
*
|
||||
* GtkClipboard is used for clipboard handling. This demo shows how to
|
||||
* copy and paste text to and from the clipboard.
|
||||
*/
|
||||
using System;
|
||||
using Gtk;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//
|
||||
// Copyright (C) 2003, Ximian Inc.
|
||||
|
||||
/*
|
||||
/* Color Selector
|
||||
*
|
||||
* GtkColorSelection lets the user choose a color. GtkColorSelectionDialog is
|
||||
* a prebuilt dialog containing a GtkColorSelection.
|
||||
|
|
|
@ -5,10 +5,9 @@
|
|||
//
|
||||
// Copyright (C) 2003, Ximian Inc.
|
||||
|
||||
/*
|
||||
*
|
||||
*Dialog widgets are used to pop up a transient window for user feedback.
|
||||
/* Dialog and Message Boxes
|
||||
*
|
||||
* Dialog widgets are used to pop up a transient window for user feedback.
|
||||
*/
|
||||
|
||||
// TODO: - Couldn't find a good equivalent to gtk_dialog_new_with_buttons
|
||||
|
|
|
@ -211,7 +211,7 @@ namespace GtkDemo
|
|||
|
||||
if ((state & ModifierType.Button1Mask) != 0 && pixmap != null)
|
||||
DrawBrush (x, y);
|
||||
/* We've handled it, stop processing */
|
||||
// We've handled it, stop processing
|
||||
args.RetVal = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
/* Entry Completion
|
||||
*
|
||||
* GtkEntryCompletion provides a mechanism for adding support for
|
||||
* completion in GtkEntry.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using Gtk;
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
/* Expander
|
||||
*
|
||||
* GtkExpander allows to provide additional content that is initially hidden.
|
||||
* This is also known as "disclosure triangle".
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using Gtk;
|
||||
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
//
|
||||
// Author: John Luke <john.luke@gmail.com>
|
||||
// ported from gtk-demo in GTK+
|
||||
// Demostrates HyperLinks in the TextView
|
||||
// Demonstrates HyperLinks in the TextView
|
||||
//
|
||||
|
||||
/* Text Widget/Hypertext
|
||||
*
|
||||
* Usually, tags modify the appearance of text in the view, e.g. making it
|
||||
* bold or colored or underlined. But tags are not restricted to appearance.
|
||||
* They can also affect the behavior of mouse and key presses, as this demo
|
||||
* shows.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using Gtk;
|
||||
|
||||
|
|
|
@ -20,11 +20,6 @@
|
|||
* application binary can be self-contained.
|
||||
*/
|
||||
|
||||
// TODO:
|
||||
// Finish implementing the callback, I can't get the image
|
||||
// to show up, and I'm stuck in the ProgressivePreparedCallback
|
||||
// because I can't get a white background to appear
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
@ -121,7 +116,7 @@ namespace GtkDemo
|
|||
{
|
||||
Widget[] children = vbox.Children;
|
||||
foreach (Widget widget in children)
|
||||
/* don't disable our toggle */
|
||||
// don't disable our toggle
|
||||
if (widget.GetType () != o.GetType () )
|
||||
widget.Sensitive = !widget.Sensitive;
|
||||
}
|
||||
|
@ -129,7 +124,7 @@ namespace GtkDemo
|
|||
private uint timeout_id;
|
||||
private void StartProgressiveLoading ()
|
||||
{
|
||||
/* This is obviously totally contrived (we slow down loading
|
||||
/* This is obviously totally contrived (we slow down loading
|
||||
* on purpose to show how incremental loading works).
|
||||
* The real purpose of incremental loading is the case where
|
||||
* you are reading data from a slow source such as the network.
|
||||
|
|
|
@ -49,6 +49,10 @@ namespace GtkDemo
|
|||
hbox.PackStart (notebook, true, true, 0);
|
||||
|
||||
notebook.AppendPage (CreateText (infoBuffer, false), new Label ("_Info"));
|
||||
TextTag heading = new TextTag ("heading");
|
||||
heading.Scale = heading.Scale * 2;
|
||||
infoBuffer.TagTable.Add (heading);
|
||||
|
||||
notebook.AppendPage (CreateText (sourceBuffer, true), new Label ("_Source"));
|
||||
|
||||
window.ShowAll ();
|
||||
|
@ -59,12 +63,12 @@ namespace GtkDemo
|
|||
Stream file = Assembly.GetExecutingAssembly ().GetManifestResourceStream (filename);
|
||||
if (file != null)
|
||||
{
|
||||
LoadStream (file, filename);
|
||||
LoadStream (file);
|
||||
}
|
||||
else if (File.Exists (filename))
|
||||
{
|
||||
file = File.OpenRead (filename);
|
||||
LoadStream (file, filename);
|
||||
LoadStream (file);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -75,15 +79,56 @@ namespace GtkDemo
|
|||
Fontify ();
|
||||
}
|
||||
|
||||
private void LoadStream (Stream file, string filename)
|
||||
private void LoadStream (Stream file)
|
||||
{
|
||||
StreamReader sr = new StreamReader (file);
|
||||
string s = sr.ReadToEnd ();
|
||||
bool insideComment = false;
|
||||
bool headingValid = true;
|
||||
|
||||
infoBuffer.Text = "";
|
||||
sourceBuffer.Text = "";
|
||||
|
||||
// mostly broken comment parsing for splitting
|
||||
// out the special comments to display in the infobuffer
|
||||
string line, trimmed;
|
||||
while (sr.Peek () != -1) {
|
||||
line = sr.ReadLine ();
|
||||
trimmed = line.Trim ();
|
||||
if (headingValid && line.Trim ().StartsWith ("//"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (headingValid && trimmed.StartsWith ("/*"))
|
||||
{
|
||||
TextIter iter = infoBuffer.EndIter;
|
||||
infoBuffer.InsertWithTagsByName (ref iter, trimmed.Substring (2) + Environment.NewLine, "heading");
|
||||
infoBuffer.Insert (ref iter, Environment.NewLine);
|
||||
insideComment = true;
|
||||
}
|
||||
else if (headingValid && trimmed.StartsWith ("*/"))
|
||||
{
|
||||
insideComment = false;
|
||||
headingValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (insideComment)
|
||||
{
|
||||
TextIter iter = infoBuffer.EndIter;
|
||||
if (trimmed.StartsWith ("*"))
|
||||
infoBuffer.Insert (ref iter, trimmed.Substring (1));
|
||||
else
|
||||
infoBuffer.Insert (ref iter, trimmed);
|
||||
}
|
||||
else
|
||||
{
|
||||
TextIter iter = sourceBuffer.EndIter;
|
||||
sourceBuffer.Insert (ref iter, line + Environment.NewLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
sr.Close ();
|
||||
file.Close ();
|
||||
|
||||
infoBuffer.Text = filename;
|
||||
sourceBuffer.Text = s;
|
||||
}
|
||||
|
||||
// this is to highlight the sourceBuffer
|
||||
|
|
|
@ -5,6 +5,14 @@
|
|||
//
|
||||
// (C) 2003 Ximian, Inc.
|
||||
|
||||
/* Stock Item and Icon Browser
|
||||
*
|
||||
* This source code for this demo doesn't demonstrate anything
|
||||
* particularly useful in applications. The purpose of the "demo" is
|
||||
* just to provide a handy place to browse the available stock icons
|
||||
* and stock items.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Gtk;
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
/* UI Manager
|
||||
*
|
||||
* The GtkUIManager object allows the easy creation of menus
|
||||
* from an array of actions and a description of the menu hierarchy.
|
||||
*/
|
||||
using System;
|
||||
using Gtk;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ General
|
|||
|
||||
DemoMain
|
||||
- syntax highlighting
|
||||
- display summary info page
|
||||
|
||||
DemoStockBrowser
|
||||
- underline _label properly
|
||||
|
|
Loading…
Reference in a new issue