Author: miguel
Date: 2007-07-04 15:09:09 -0400 (Wed, 04 Jul 2007)
New Revision: 81351
Added:
trunk/mono-curses/docs/
trunk/mono-curses/docs/Mono.Terminal.xml
trunk/mono-curses/docs/index.xml
trunk/mono-curses/mono-curses.source
Modified:
trunk/mono-curses/
trunk/mono-curses/Makefile
trunk/mono-curses/gui.cs
Log:
Add documentation
Property changes on: trunk/mono-curses
___________________________________________________________________
Name: svn:ignore
- *.mdb
*.dll
*exe
*.so
config.make
monotorrent
binding.cs
constants.cs
attrib
+ *.mdb
*.dll
*exe
*.so
config.make
monotorrent
binding.cs
constants.cs
attrib
mono-curses.tree
mono-curses.zip
mono-curses.xml
Modified: trunk/mono-curses/Makefile
===================================================================
--- trunk/mono-curses/Makefile 2007-07-04 18:37:29 UTC (rev 81350)
+++ trunk/mono-curses/Makefile 2007-07-04 19:09:09 UTC (rev 81351)
@@ -19,7 +19,7 @@
TORRENTDIR=/cvs/bitsharp/src
TORRENTLIBS=`pkg-config --libs monotorrent`
-all: config.make mono-curses.dll libmono-curses.so monotorrent.exe monotorrent
+all: config.make mono-curses.dll libmono-curses.so monotorrent.exe monotorrent
mono-curses.zip
monotorrent: monotorrent.in Makefile
sed "s,@prefix@,$(prefix)," < monotorrent.in > monotorrent
@@ -42,9 +42,14 @@
run: monotorrent.exe
DYLD_LIBRARY_PATH=. MONO_PATH=$(TORRENTDIR)/bin:$(TORRENTDIR)/Libs mono
--debug monotorrent.exe || stty sane
-mono-curses.dll: $(SOURCES)
- gmcs -debug -target:library -out:mono-curses.dll -debug $(SOURCES)
+mono-curses.dll mono-curses.xml: $(SOURCES)
+ gmcs -doc:mono-curses.xml -debug -target:library -out:mono-curses.dll
-debug $(SOURCES)
+#
+mono-curses.tree mono-curses.zip: mono-curses.xml mono-curses.dll
docs/Mono.Terminal.xml docs/index.xml
+ monodocer -importslashdoc:mono-curses.xml -path:docs
-assembly:mono-curses.dll
+ mdassembler --ecma docs/ --out mono-curses
+
binding.cs: binding.cs.in Makefile
if test `uname` = Darwin; then make t-bugosx; else make detect; fi
@@ -79,6 +84,7 @@
cp mono-curses.dll MonoTorrent.dll monotorrent.exe
$(prefix)/lib/monotorrent
cp libmono-curses* $(prefix)/lib/monotorrent
cp monotorrent $(prefix)/bin
+ cp mono-curses.tree mono-curses.zip mono-curses.source `pkg-config
--variable sourcesdir monodoc`
config.make:
echo You must run configure first
Added: trunk/mono-curses/docs/Mono.Terminal.xml
===================================================================
--- trunk/mono-curses/docs/Mono.Terminal.xml 2007-07-04 18:37:29 UTC (rev
81350)
+++ trunk/mono-curses/docs/Mono.Terminal.xml 2007-07-04 19:09:09 UTC (rev
81351)
@@ -0,0 +1,6 @@
+<Namespace Name="Mono.Terminal">
+ <Docs>
+ <summary>A toolkit for building terminal applications with
curses.</summary>
+ <remarks></remarks>
+ </Docs>
+</Namespace>
Added: trunk/mono-curses/docs/index.xml
===================================================================
--- trunk/mono-curses/docs/index.xml 2007-07-04 18:37:29 UTC (rev 81350)
+++ trunk/mono-curses/docs/index.xml 2007-07-04 19:09:09 UTC (rev 81351)
@@ -0,0 +1,35 @@
+<Overview>
+ <Assemblies>
+ <Assembly Name="mono-curses" Version="0.0.0.0">
+ <Attributes>
+ <Attribute>
+
<AttributeName>System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true)</AttributeName>
+ </Attribute>
+ </Attributes>
+ </Assembly>
+ </Assemblies>
+ <Remarks>To be added.</Remarks>
+ <Copyright>To be added.</Copyright>
+ <Types>
+ <Namespace Name="Mono.Terminal">
+ <Type Name="Window" />
+ <Type Name="Screen" />
+ <Type Name="Curses" />
+ <Type Name="Curses+MouseEvent" />
+ <Type Name="Anchor" />
+ <Type Name="Fill" />
+ <Type Name="Widget" />
+ <Type Name="Label" />
+ <Type Name="TrimLabel" />
+ <Type Name="Entry" />
+ <Type Name="Button" />
+ <Type Name="IListProvider" />
+ <Type Name="ListView" />
+ <Type Name="Container" />
+ <Type Name="Frame" />
+ <Type Name="Dialog" />
+ <Type Name="Application" />
+ </Namespace>
+ </Types>
+ <Title>mono-curses</Title>
+</Overview>
Modified: trunk/mono-curses/gui.cs
===================================================================
--- trunk/mono-curses/gui.cs 2007-07-04 18:37:29 UTC (rev 81350)
+++ trunk/mono-curses/gui.cs 2007-07-04 19:09:09 UTC (rev 81351)
@@ -52,7 +52,10 @@
Horizontal = 1,
Vertical = 2
}
-
+
+ /// <summary>
+ /// Base class for creating curses widgets
+ /// </summary>
public abstract class Widget {
public Container Container;
public int x, y, w, h;
@@ -63,6 +66,16 @@
static StreamWriter l;
+ /// <summary>
+ /// Utility function to log messages
+ /// </summary>
+ /// <remarks>
+ /// <para>This is a utility function that you can use to log
messages
+ /// that will be stored in a file (as curses has taken over
the
+ /// screen and you can not really log information
there).</para>
+ /// <para>
+ /// The data is written to the file "log2" for now</para>
+ /// </remarks>
public static void Log (string s)
{
if (l == null)
@@ -72,11 +85,30 @@
l.Flush ();
}
+ /// <summary>
+ /// Utility function to log messages
+ /// </summary>
+ /// <remarks>
+ /// <para>This is a utility function that you can use to log
messages
+ /// that will be stored in a file (as curses has taken over
the
+ /// screen and you can not really log information there).
</para>
+ /// <para>
+ /// The data is written to the file "log2" for now</para>
+ /// </remarks>
public static void Log (string s, params object [] args)
{
Log (String.Format (s, args));
}
+ /// <summary>
+ /// Public constructor for widgets
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Constructs a widget that starts at positio (x,y) and
has width w and height h.
+ /// These parameters are used by the methods <see
cref="Clear"/> and <see cref="Redraw"/>
+ /// </para>
+ /// </remarks>
public Widget (int x, int y, int w, int h)
{
this.x = x;
@@ -86,6 +118,17 @@
Container = Application.EmptyContainer;
}
+ /// <summary>
+ /// Focus status of this widget
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// This is used typically by derived classes to flag
whether
+ /// this widget can receive focus or not. Focus is
activated
+ /// by either clicking with the mouse on that widget or by
using
+ //// the tab key.
+ /// </para>
+ /// </remarks>
public bool CanFocus {
get {
return can_focus;
@@ -96,6 +139,15 @@
}
}
+ /// <summary>
+ /// Gets or sets the current focus status.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// A widget can grab the focus by setting this value to
true and
+ /// the current focus status can be inquired by using this
property.
+ /// </para>
+ /// </remarks>
public bool HasFocus {
get {
return has_focus;
@@ -107,19 +159,65 @@
}
}
- // Moves inside the first location inside the container
+ /// <summary>
+ /// Moves inside the first location inside the container
+ /// </summary>
+ /// <remarks>
+ /// <para>This moves the current cursor position to the
specified
+ /// line and column relative to the container
+ /// client area where this widget is located.</para>
+ /// <para>The difference between this
+ /// method and <see cref="BaseMove"/> is that this
+ /// method goes to the beginning of the client area
+ /// inside the container while <see cref="BaseMove"/> goes
to the first
+ /// position that container uses.</para>
+ /// <para>
+ /// For example, a Frame usually takes up a couple
+ /// of characters for padding. This method would
+ /// position the cursor inside the client area,
+ /// while <see cref="BaseMove"/> would position
+ /// the cursor at the top of the frame.
+ /// </para>
+ /// </remarks>
public void Move (int line, int col)
{
Container.ContainerMove (line, col);
}
- // Move relative to the top of the container
+ /// <summary>
+ /// Move relative to the top of the container
+ /// </summary>
+ /// <remarks>
+ /// <para>This moves the current cursor position to the
specified
+ /// line and column relative to the start of the container
+ /// where this widget is located.</para>
+ /// <para>The difference between this
+ /// method and <see cref="Move"/> is that this
+ /// method goes to the beginning of the container,
+ /// while <see cref="Move"/> goes to the first
+ /// position that widgets should use.</para>
+ /// <para>
+ /// For example, a Frame usually takes up a couple
+ /// of characters for padding. This method would
+ /// position the cursor at the beginning of the
+ /// frame, while <see cref="Move"/> would position
+ /// the cursor within the frame.
+ /// </para>
+ /// </remarks>
public void BaseMove (int line, int col)
{
Container.ContainerBaseMove (line, col);
}
+ /// <summary>
+ /// Clears the widget region withthe current color.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// This clears the entire region used by this widget.
+ /// </para>
+ /// </remarks>
public void Clear ()
{
for (int line = 0; line < h; line++){
@@ -130,6 +228,21 @@
}
}
+ /// <summary>
+ /// Redraws the current widget, must be overwritten.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// This method should be overwritten by classes
+ /// that derive from Widget. The default
+ /// implementation of this method just fills out
+ /// the region with the character 'x'.
+ /// </para>
+ /// <para>
+ /// Widgets are responsible for painting the
+ /// entire region that they have been allocated.
+ /// </para>
+ /// </remarks>
public virtual void Redraw ()
{
for (int line = 0; line < h; line++){
@@ -140,29 +253,124 @@
}
}
+ /// <summary>
+ /// If the widget is focused, gives the widget a
+ /// chance to process the keystroke.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Widgets can override this method if they are
+ /// interested in processing the given keystroke.
+ /// If they consume the keystroke, they must
+ /// return true to stop the keystroke from being
+ /// processed by other widgets or consumed by the
+ /// widget engine. If they return false, the
+ /// keystroke will be passed out to other widgets
+ /// for processing.
+ /// </para>
+ /// </remarks>
public virtual bool ProcessKey (int key)
{
return false;
}
+ /// <summary>
+ /// Gives widgets a chance to process the given
+ /// mouse event.
+ /// </summary>
+ /// <remarks>
+ /// Widgets can inspect the value of
+ /// ev.ButtonState to determine if this is a
+ /// message they are interested in (typically
+ /// ev.ButtonState & Curses.BUTTON1_CLICKED).
+ /// </remarks>
public virtual void ProcessMouse (Curses.MouseEvent ev)
{
}
+ /// <summary>
+ /// This method can be overwritten by widgets that
+ /// want to provide accelerator functionality
+ /// (Alt-key for example).
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Before keys are sent to the widgets on the
+ /// current Container, all the widgets are
+ /// processed and the key is passed to the widgets
+ /// to allow some of them to process the keystroke
+ /// as a hot-key. </para>
+ /// <para>
+ /// For example, if you implement a button that
+ /// has a hotkey ok "o", you would catch the
+ /// combination Alt-o here. If the event is
+ /// caught, you must return true to stop the
+ /// keystroke from being dispatched to other
+ /// widgets.
+ /// </para>
+ /// <para>
+ /// Typically to check if the keystroke is an
+ /// Alt-key combination, you would use
+ /// Curses.IsAlt(key) and then Char.ToUpper(key)
+ /// to compare with your hotkey.
+ /// </para>
+ /// </remarks>
public virtual bool ProcessHotKey (int key)
{
return false;
}
+ /// <summary>
+ /// Moves inside the first location inside the container
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// A helper routine that positions the cursor at
+ /// the logical beginning of the widget. The
+ /// default implementation merely puts the cursor at
+ /// the beginning, but derived classes should find a
+ /// suitable spot for the cursor to be shown.
+ /// </para>
+ /// <para>
+ /// This method must be overwritten by most
+ /// widgets since screen repaints can happen at
+ /// any point and it is important to leave the
+ /// cursor in a position that would make sense for
+ /// the user (as not all terminals support hiding
+ /// the cursor), and give the user an impression of
+ /// where the cursor is. For a button, that
+ /// would be the position where the hotkey is, for
+ /// an entry the location of the editing cursor
+ /// and so on.
+ /// </para>
+ /// </remarks>
public virtual void PositionCursor ()
{
Move (y, x);
}
+ /// <summary>
+ /// Method to relayout on size changes.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// This method can be overwritten by widgets that
+ /// might be interested in adjusting their
+ /// contents or children (if they are
+ /// containers).
+ /// </para>
+ /// </remarks>
public virtual void DoSizeChanged ()
{
}
+ /// <summary>
+ /// Utility function to draw frames
+ /// </summary>
+ /// <remarks>
+ /// Draws a frame with the current color in the
+ /// specified coordinates.
+ /// </remarks>
static public void DrawFrame (int col, int line, int width, int
height)
{
int b;
@@ -187,24 +395,37 @@
Curses.addch (Curses.ACS_LRCORNER);
}
+ /// <summary>
+ /// The color used for rendering an unfocused widget.
+ /// </summary>
public int ColorNormal {
get {
return Container.ContainerColorNormal;
}
}
+ /// <summary>
+ /// The color used for rendering a focused widget.
+ /// </summary>
public int ColorFocus {
get {
return Container.ContainerColorFocus;
}
}
+ /// <summary>
+ /// The color used for rendering the hotkey on an
+ /// unfocused widget.
+ /// </summary>
public int ColorHotNormal {
get {
return Container.ContainerColorHotNormal;
}
}
+ /// <summary>
+ /// The color used to render a hotkey in a focused widget.
+ /// </summary>
public int ColorHotFocus {
get {
return Container.ContainerColorHotFocus;
@@ -212,10 +433,17 @@
}
}
+ /// <summary>
+ /// Label widget, displays a string at a given position.
+ /// </summary>
public class Label : Widget {
protected string text;
public int Color = -1;
+ /// <summary>
+ /// Public constructor: creates a label at the given
+ /// coordinate with the given string.
+ /// </summary>
public Label (int x, int y, string s) : base (x, y, s.Length, 1)
{
text = s;
@@ -232,6 +460,10 @@
Curses.addstr (text);
}
+
+ /// <summary>
+ /// The text displayed by this widget.
+ /// </summary>
public virtual string Text {
get {
return text;
@@ -247,9 +479,22 @@
}
}
+ /// <summary>
+ /// A label that can be trimmed to a given position
+ /// </summary>
+ /// <remarks>
+ /// Just like a label, but it can be trimmed to a given
+ /// position if the text being displayed overflows the
+ /// specified width.
+ /// </remarks>
public class TrimLabel : Label {
string original;
+ /// <summary>
+ /// Public constructor.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
public TrimLabel (int x, int y, int w, string s) : base (x, y,
s)
{
original = s;
@@ -291,10 +536,22 @@
}
}
+ /// <summary>
+ /// Text data entry widget
+ /// </summary>
+ /// <remarks>
+ /// The Entry widget provides Emacs-like editing
+ /// functionality, and mouse support.
+ /// </remarks>
public class Entry : Widget {
string text, kill;
int first, point;
+ /// <summary>
+ /// Public constructor.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
public Entry (int x, int y, int w, string s) : base (x, y, w, 1)
{
if (s == null)
@@ -306,6 +563,11 @@
CanFocus = true;
}
+ /// <summary>
+ /// Sets or gets the text in the entry.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
public string Text {
get {
return text;
@@ -453,20 +715,70 @@
}
}
+ /// <summary>
+ /// Button widget
+ /// </summary>
+ /// <remarks>
+ /// Provides a button that can be clicked, or pressed with
+ /// the enter key and processes hotkeys (the first uppercase
+ /// letter in the button becomes the hotkey).
+ /// </remarks>
public class Button : Widget {
public string text;
char hot_key;
int hot_pos = -1;
bool is_default;
+ /// <summary>
+ /// Clicked event, raised when the button is clicked.
+ /// </summary>
+ /// <remarks>
+ /// Client code can hook up to this event, it is
+ /// raised when the button is activated either with
+ /// the mouse or the keyboard.
+ /// </remarks>
public event EventHandler Clicked;
+ /// <summary>
+ /// Public constructor, creates a button based on
+ /// the given text at position 0,0
+ /// </summary>
+ /// <remarks>
+ /// The size of the button is computed based on the
+ /// text length. This button is not a default button.
+ /// </remarks>
public Button (string s) : this (0, 0, s) {}
+ /// <summary>
+ /// Public constructor, creates a button based on
+ /// the given text.
+ /// </summary>
+ /// <remarks>
+ /// If the value for is_default is true, a special
+ /// decoration is used, and the enter key on a
+ /// dialog would implicitly activate this button.
+ /// </remarks>
public Button (string s, bool is_default) : this (0, 0, s,
is_default) {}
+ /// <summary>
+ /// Public constructor, creates a button based on
+ /// the given text at the given position.
+ /// </summary>
+ /// <remarks>
+ /// The size of the button is computed based on the
+ /// text length. This button is not a default button.
+ /// </remarks>
public Button (int x, int y, string s) : this (x, y, s, false)
{}
+ /// <summary>
+ /// Public constructor, creates a button based on
+ /// the given text at the given position.
+ /// </summary>
+ /// <remarks>
+ /// If the value for is_default is true, a special
+ /// decoration is used, and the enter key on a
+ /// dialog would implicitly activate this button.
+ /// </remarks>
public Button (int x, int y, string s, bool is_default)
: base (x, y, s.Length + 4 + (is_default ? 2 : 0), 1)
{
@@ -546,16 +858,69 @@
}
}
+ /// <summary>
+ /// Model for the <see cref="ListView"/> widget.
+ /// </summary>
+ /// <remarks>
+ /// Consumers of the <see cref="ListView"/> widget should
+ /// implement this interface
+ /// </remarks>
public interface IListProvider {
+ /// <summary>
+ /// Number of items in the model.
+ /// </summary>
+ /// <remarks>
+ /// This should return the number of items in the
+ /// model.
+ /// </remarks>
int Items { get; }
+
+ /// <summary>
+ /// Whether the ListView should allow items to be
+ /// marked.
+ /// </summary>
bool AllowMark { get; }
+
+ /// <summary>
+ /// Whether the given item is marked.
+ /// </summary>
bool IsMarked (int item);
+
+ /// <summary>
+ /// This should render the item at the given line,
+ /// col with the specified width.
+ /// </summary>
void Render (int line, int col, int width, int item);
+
+ /// <summary>
+ /// Callback: this is the way that the model is
+ /// hooked up to its actual view.
+ /// </summary>
void SetListView (ListView target);
+
+ /// <summary>
+ /// Allows the model to process the given keystroke.
+ /// </summary>
+ /// <remarks>
+ /// The model should return true if the key was
+ /// processed, false otherwise.
+ /// </remarks>
bool ProcessKey (int ch);
+
+ /// <summary>
+ /// Callback: invoked when the selected item has changed.
+ /// </summary>
void SelectedChanged ();
}
+ /// <summary>
+ /// A Listview widget.
+ /// </summary>
+ /// <remarks>
+ /// This widget renders a list of data. The actual
+ /// rendering is implemented by an instance of the class
+ /// IListProvider that must be supplied at construction time.
+ /// </remarks>
public class ListView : Widget {
int items;
int top;
@@ -563,6 +928,11 @@
bool allow_mark;
IListProvider provider;
+ /// <summary>
+ /// Public constructor.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
public ListView (int x, int y, int w, int h, IListProvider
provider) : base (x, y, w, h)
{
CanFocus = true;
@@ -573,6 +943,16 @@
allow_mark = provider.AllowMark;
}
+ /// <summary>
+ /// This method can be invoked by the model to
+ /// notify the view that the contents of the model
+ /// have changed.
+ /// </summary>
+ /// <remarks>
+ /// Invoke this method to invalidate the contents of
+ /// the ListView and force the ListView to repaint
+ /// the contents displayed.
+ /// </remarks>
public void ProviderChanged ()
{
if (provider.Items != items){
@@ -697,6 +1077,9 @@
PositionCursor ();
}
+ /// <summary>
+ /// Returns the index of the currently selected item.
+ /// </summary>
public int Selected {
get {
if (items == 0)
@@ -732,6 +1115,15 @@
}
}
+ /// <summary>
+ /// Container widget, can host other widgets.
+ /// </summary>
+ /// <remarks>
+ /// This implements the foundation for other containers
+ /// (like Dialogs and Frames) that can host other widgets
+ /// inside their boundaries. It provides focus handling
+ /// and event routing.
+ /// </remarks>
public class Container : Widget {
ArrayList widgets = new ArrayList ();
Widget focused = null;
@@ -748,6 +1140,11 @@
{
}
+ /// <summary>
+ /// Public constructor.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
public Container (int x, int y, int w, int h) : base (x, y, w,
h)
{
ContainerColorNormal = Application.ColorNormal;
@@ -756,11 +1153,20 @@
ContainerColorHotFocus = Application.ColorHotFocus;
}
- // Called on top level containers before starting up.
+ /// <summary>
+ /// Called on top-level container before starting up.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
public virtual void Prepare ()
{
}
+ /// <summary>
+ /// Used to redraw all the children in this container.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
public void RedrawChildren ()
{
foreach (Widget w in widgets){
@@ -785,6 +1191,15 @@
focused.PositionCursor ();
}
+ /// <summary>
+ /// Focuses the specified widget in this container.
+ /// </summary>
+ /// <remarks>
+ /// Focuses the specified widge, taking the focus
+ /// away from any previously focused widgets. This
+ /// method only works if the widget specified
+ /// supports being focused.
+ /// </remarks>
public void SetFocus (Widget w)
{
if (!w.CanFocus)
@@ -801,12 +1216,19 @@
focused.PositionCursor ();
}
+ /// <summary>
+ /// Focuses the first possible focusable widget in
+ /// the contained widgets.
+ /// </summary>
public void EnsureFocus ()
{
if (focused == null)
FocusFirst();
}
+ /// <summary>
+ /// Focuses the first widget in the contained widgets.
+ /// </summary>
public void FocusFirst ()
{
foreach (Widget w in widgets){
@@ -817,6 +1239,9 @@
}
}
+ /// <summary>
+ /// Focuses the last widget in the contained widgets.
+ /// </summary>
public void FocusLast ()
{
for (int i = widgets.Count; i > 0; ){
@@ -830,6 +1255,11 @@
}
}
+ /// <summary>
+ /// Focuses the previous widget.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
public bool FocusPrev ()
{
if (focused == null){
@@ -868,6 +1298,11 @@
return false;
}
+ /// <summary>
+ /// Focuses the next widget.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
public bool FocusNext ()
{
if (focused == null){
@@ -906,6 +1341,15 @@
return false;
}
+ /// <summary>
+ /// Returns the base position for child widgets to
+ /// paint on.
+ /// </summary>
+ /// <remarks>
+ /// This method is typically overwritten by
+ /// containers that want to have some padding (like
+ /// Frames or Dialogs).
+ /// </remarks>
public virtual void GetBase (out int row, out int col)
{
row = 0;
@@ -928,6 +1372,11 @@
Curses.move (row + y, col + x);
}
+ /// <summary>
+ /// Adds a widget to this container.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
public virtual void Add (Widget w)
{
widgets.Add (w);
@@ -1012,8 +1461,19 @@
}
}
+ /// <summary>
+ /// Raised when the size of this container changes.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
public event EventHandler SizeChangedEvent;
+ /// <summary>
+ /// This method is invoked when the size of this
+ /// container changes.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
public void SizeChanged ()
{
if (SizeChangedEvent != null)
@@ -1022,13 +1482,30 @@
}
}
+ /// <summary>
+ /// Framed-container widget.
+ /// </summary>
+ /// <remarks>
+ /// A container that provides a frame around its children,
+ /// and an optional title.
+ /// </remarks>
public class Frame : Container {
public string Title;
+ /// <summary>
+ /// Creates an empty frame, with the given title
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
public Frame (string title) : this (0, 0, 0, 0, title)
{
}
+ /// <summary>
+ /// Public constructor, a frame, with the given title.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
public Frame (int x, int y, int w, int h, string title) : base
(x, y, w, h)
{
Title = title;
@@ -1068,15 +1545,32 @@
}
}
- //
- // A container with a border, and with a default set of colors
- //
+ /// <summary>
+ /// A Dialog is a container that can also have a number of
+ /// buttons at the bottom
+ /// </summary>
+ /// <remarks>
+ /// <para>Dialogs are containers that can have a set of buttons at
+ /// the bottom. Dialogs are automatically centered on the
+ /// screen, and on screen changes the buttons are
+ /// relaid out.</para>
+ /// <para>
+ /// To make the dialog box run until an option has been
+ /// executed, you would typically create the dialog box and
+ /// then call Application.Run on the Dialog instance.
+ /// </para>
+ /// </remarks>
public class Dialog : Frame {
int button_len;
ArrayList buttons;
const int button_space = 3;
+ /// <summary>
+ /// Public constructor.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
public Dialog (int w, int h, string title)
: base ((Application.Cols - w) / 2,
(Application.Lines-h)/2, w, h, title)
{
@@ -1108,6 +1602,11 @@
}
}
+ /// <summary>
+ /// Adds a button to the dialog
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
public void AddButton (Button b)
{
if (buttons == null)
@@ -1165,26 +1664,89 @@
}
}
+ /// <summary>
+ /// gui.cs Application driver.
+ /// </summary>
+ /// <remarks>
+ /// Before using gui.cs, you must call Application.Init, then
+ /// you would create your toplevel container (typically by
+ /// calling: new Container (0, 0, Application.Cols,
+ /// Application.Lines), adding widgets to it and finally
+ /// calling Application.Run on the toplevel container.
+ /// </remarks>
public class Application {
+ /// <summary>
+ /// Color used for unfocused widgets.
+ /// </summary>
public static int ColorNormal;
+ /// <summary>
+ /// Color used for focused widgets.
+ /// </summary>
public static int ColorFocus;
+ /// <summary>
+ /// Color used for hotkeys in unfocused widgets.
+ /// </summary>
public static int ColorHotNormal;
+ /// <summary>
+ /// Color used for hotkeys in focused widgets.
+ /// </summary>
public static int ColorHotFocus;
+ /// <summary>
+ /// Color used for marked entries.
+ /// </summary>
public static int ColorMarked;
+ /// <summary>
+ /// Color used for marked entries that are currently
+ /// selected with the cursor.
+ /// </summary>
public static int ColorMarkedSelected;
+ /// <summary>
+ /// Color for unfocused widgets on a dialog.
+ /// </summary>
public static int ColorDialogNormal;
+ /// <summary>
+ /// Color for focused widgets on a dialog.
+ /// </summary>
public static int ColorDialogFocus;
+ /// <summary>
+ /// Color for hotkeys in an unfocused widget on a dialog.
+ /// </summary>
public static int ColorDialogHotNormal;
+ /// <summary>
+ /// Color for a hotkey in a focused widget on a dialog.
+ /// </summary>
public static int ColorDialogHotFocus;
+ /// <summary>
+ /// Color used for error text.
+ /// </summary>
public static int ColorError;
- // Every timeout milliseconds to wait
+ /// <summary>
+ /// The time before we timeout on a curses call.
+ /// </summary>
+ /// <remarks>
+ /// This is needed for applications that need to
+ /// poll or update other bits of information at
+ /// specified intervals.
+ /// <para>The default value -1, means to wait until
+ /// an event is ready. If the value is zero, then
+ /// events are only processed if they are available,
+ /// otherwise it is timeout in milliseconds to wait
+ /// for an event to arrive before running an
+ /// iteration on the main loop. See <see
cref="Iteration"/>.</para>
+ /// </remarks>
static public int Timeout = -1;
- // Iteration, on each cycle of Application.Run
+ /// <summary>
+ /// This event is raised on each iteration of the
+ /// main loop.
+ /// </summary>
+ /// <remarks>
+ /// See also <see cref="Timeout"/>
+ /// </remarks>
static public event EventHandler Iteration;
// Private variables
@@ -1206,6 +1768,10 @@
}
}
+ /// <summary>
+ /// Initializes the runtime. The boolean flag
+ /// indicates whether we are forcing color to be off.
+ /// </summary>
public static void Init (bool disable_color)
{
empty_container = new Container (0, 0,
Application.Cols, Application.Lines);
@@ -1258,12 +1824,18 @@
}
}
+ /// <summary>
+ /// The number of lines on the screen
+ /// </summary>
static public int Lines {
get {
return Curses.Lines;
}
}
+ /// <summary>
+ /// The number of columns on the screen
+ /// </summary>
static public int Cols {
get {
return Curses.Cols;
@@ -1278,6 +1850,13 @@
Window.Standard.keypad (true);
}
+ /// <summary>
+ /// Displays a message on a modal dialog box.
+ /// </summary>
+ /// <remarks>
+ /// The error boolean indicates whether this is an
+ /// error message box or not.
+ /// </remarks>
static public void Msg (bool error, string caption, string t)
{
ArrayList lines = new ArrayList ();
@@ -1315,11 +1894,22 @@
Application.Run (d);
}
+ /// <summary>
+ /// Displays an error message.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
static public void Error (string caption, string text)
{
Msg (true, caption, text);
}
+ /// <summary>
+ /// Displays an error message.
+ /// </summary>
+ /// <remarks>
+ /// Overload that allows for String.Format parameters.
+ /// </remarks>
static public void Error (string caption, string format, params
object [] pars)
{
string t = String.Format (format, pars);
@@ -1327,11 +1917,22 @@
Msg (true, caption, t);
}
+ /// <summary>
+ /// Displays an informational message.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
static public void Info (string caption, string text)
{
Msg (false, caption, text);
}
+ /// <summary>
+ /// Displays an informational message.
+ /// </summary>
+ /// <remarks>
+ /// Overload that allows for String.Format parameters.
+ /// </remarks>
static public void Info (string caption, string format, params
object [] pars)
{
string t = String.Format (format, pars);
@@ -1350,6 +1951,11 @@
Curses.refresh ();
}
+ /// <summary>
+ /// Forces a repaint of the screen.
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
public static void Refresh ()
{
Container last = null;
@@ -1363,6 +1969,14 @@
last.PositionCursor ();
}
+ /// <summary>
+ /// Runs the main loop on the given container.
+ /// </summary>
+ /// <remarks>
+ /// This method is used to start processing events
+ /// for the main application, but it is also used to
+ /// run modal dialog boxes.
+ /// </remarks>
static public void Run (Container container)
{
Init (false);
Added: trunk/mono-curses/mono-curses.source
===================================================================
--- trunk/mono-curses/mono-curses.source 2007-07-04 18:37:29 UTC (rev
81350)
+++ trunk/mono-curses/mono-curses.source 2007-07-04 19:09:09 UTC (rev
81351)
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<monodoc>
+ <source provider="ecma" basefile="mono-curses" path="various"/>
+</monodoc>
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches