2002-07-06 Rachel Hestilow <hestilow@ximian.com>

* ObjectGen.cs: Support static string elements. Do
	not generate Ctors or Signals if it is not a GObject.

	* parser/gapi2xml.pl: Add stock defines.

svn path=/trunk/gtk-sharp/; revision=5616
This commit is contained in:
Rachel Hestilow 2002-07-06 07:08:19 +00:00
parent add44c6965
commit c653c18543
4 changed files with 142 additions and 1 deletions

View file

@ -1,3 +1,10 @@
2002-07-06 Rachel Hestilow <hestilow@ximian.com>
* ObjectGen.cs: Support static string elements. Do
not generate Ctors or Signals if it is not a GObject.
* parser/gapi2xml.pl: Add stock defines.
2002-07-05 Rachel Hestilow <hestilow@ximian.com>
* glue/Makefile.am: Make this work cleanly, with all automake.

View file

@ -14,6 +14,7 @@ namespace GtkSharp.Generation {
public class ObjectGen : ClassBase, IGeneratable {
private ArrayList ctors = new ArrayList();
private ArrayList strings = new ArrayList();
public ObjectGen (XmlElement ns, XmlElement elem) : base (ns, elem)
{
@ -32,6 +33,10 @@ namespace GtkSharp.Generation {
ctors.Add (new Ctor (LibraryName, member));
break;
case "static-string":
strings.Add (node);
break;
default:
if (!IsNodeNameHandled (node.Name))
Console.WriteLine ("Unexpected node " + node.Name + " in " + CName);
@ -78,7 +83,7 @@ namespace GtkSharp.Generation {
}
}
if (has_sigs)
if (has_sigs && Elem.HasAttribute("parent"))
{
sw.WriteLine("\t\tprivate Hashtable Signals = new Hashtable();");
GenSignals (sw, true);
@ -106,6 +111,11 @@ namespace GtkSharp.Generation {
}
}
foreach (XmlElement str in strings) {
sw.Write ("\t\tpublic static string " + str.GetAttribute ("name"));
sw.WriteLine (" {\n\t\t\t get { return \"" + str.GetAttribute ("value") + "\"; }\n\t\t}");
}
AppendCustom(sw);
sw.WriteLine ("\t}");
@ -151,6 +161,8 @@ namespace GtkSharp.Generation {
private void GenCtors (StreamWriter sw)
{
if (!Elem.HasAttribute("parent"))
return;
sw.WriteLine("\t\tpublic " + Name + "(IntPtr raw) : base(raw) {}");
sw.WriteLine();

View file

@ -4706,6 +4706,39 @@
<field cname="relay_func" type="GtkCallbackMarshal"/>
<field cname="destroy_func" type="GtkDestroyNotify"/>
</struct>
<object name="Stock" cname="GnomeStock">
<static-string cname="GNOME_STOCK_ABOUT" name="About" value="gnome-stock-about"/>
<static-string cname="GNOME_STOCK_ATTACH" name="Attach" value="gnome-stock-attach"/>
<static-string cname="GNOME_STOCK_BLANK" name="Blank" value="gnome-stock-blank"/>
<static-string cname="GNOME_STOCK_BOOK_BLUE" name="BookBlue" value="gnome-stock-book-blue"/>
<static-string cname="GNOME_STOCK_BOOK_GREEN" name="BookGreen" value="gnome-stock-book-green"/>
<static-string cname="GNOME_STOCK_BOOK_OPEN" name="BookOpen" value="gnome-stock-book-open"/>
<static-string cname="GNOME_STOCK_BOOK_RED" name="BookRed" value="gnome-stock-book-red"/>
<static-string cname="GNOME_STOCK_BOOK_YELLOW" name="BookYellow" value="gnome-stock-book-yellow"/>
<static-string cname="GNOME_STOCK_LINE_IN" name="LineIn" value="gnome-stock-line-in"/>
<static-string cname="GNOME_STOCK_MAIL" name="Mail" value="gnome-stock-mail"/>
<static-string cname="GNOME_STOCK_MAIL_FWD" name="MailFwd" value="gnome-stock-mail-fwd"/>
<static-string cname="GNOME_STOCK_MAIL_NEW" name="MailNew" value="gnome-stock-mail-new"/>
<static-string cname="GNOME_STOCK_MAIL_RCV" name="MailRcv" value="gnome-stock-mail-rcv"/>
<static-string cname="GNOME_STOCK_MAIL_RPL" name="MailRpl" value="gnome-stock-mail-rpl"/>
<static-string cname="GNOME_STOCK_MAIL_SND" name="MailSnd" value="gnome-stock-mail-snd"/>
<static-string cname="GNOME_STOCK_MIC" name="Mic" value="gnome-stock-mic"/>
<static-string cname="GNOME_STOCK_MIDI" name="Midi" value="gnome-stock-midi"/>
<static-string cname="GNOME_STOCK_MULTIPLE_FILE" name="MultipleFile" value="gnome-stock-multiple-file"/>
<static-string cname="GNOME_STOCK_NOT" name="Not" value="gnome-stock-not"/>
<static-string cname="GNOME_STOCK_SCORES" name="Scores" value="gnome-stock-scores"/>
<static-string cname="GNOME_STOCK_TABLE_BORDERS" name="TableBorders" value="gnome-stock-table-borders"/>
<static-string cname="GNOME_STOCK_TABLE_FILL" name="TableFill" value="gnome-stock-table-fill"/>
<static-string cname="GNOME_STOCK_TEXT_BULLETED_LIST" name="TextBulletedList" value="gnome-stock-text-bulleted-list"/>
<static-string cname="GNOME_STOCK_TEXT_INDENT" name="TextIndent" value="gnome-stock-text-indent"/>
<static-string cname="GNOME_STOCK_TEXT_NUMBERED_LIST" name="TextNumberedList" value="gnome-stock-text-numbered-list"/>
<static-string cname="GNOME_STOCK_TEXT_UNINDENT" name="TextUnindent" value="gnome-stock-text-unindent"/>
<static-string cname="GNOME_STOCK_TIMER" name="Timer" value="gnome-stock-timer"/>
<static-string cname="GNOME_STOCK_TIMER_STOP" name="TimerStop" value="gnome-stock-timer-stop"/>
<static-string cname="GNOME_STOCK_TRASH" name="Trash" value="gnome-stock-trash"/>
<static-string cname="GNOME_STOCK_TRASH_FULL" name="TrashFull" value="gnome-stock-trash-full"/>
<static-string cname="GNOME_STOCK_VOLUME" name="Volume" value="gnome-stock-volume"/>
</object>
</namespace>
<namespace name="Gtk" library="libgtkhtml-3.0.so.0">
<enum name="HTMLCommandType" cname="GtkHTMLCommandType" type="enum">
@ -21014,6 +21047,78 @@
<field cname="default_is_geometry" bits="1" type="*"/>
<field cname="last" type="GtkWindowLastGeometryInfo"/>
</struct>
<object name="Stock" cname="GtkStock">
<static-string cname="GTK_STOCK_ADD" name="Add" value="gtk-add"/>
<static-string cname="GTK_STOCK_APPLY" name="Apply" value="gtk-apply"/>
<static-string cname="GTK_STOCK_BOLD" name="Bold" value="gtk-bold"/>
<static-string cname="GTK_STOCK_CANCEL" name="Cancel" value="gtk-cancel"/>
<static-string cname="GTK_STOCK_CDROM" name="Cdrom" value="gtk-cdrom"/>
<static-string cname="GTK_STOCK_CLEAR" name="Clear" value="gtk-clear"/>
<static-string cname="GTK_STOCK_CLOSE" name="Close" value="gtk-close"/>
<static-string cname="GTK_STOCK_CONVERT" name="Convert" value="gtk-convert"/>
<static-string cname="GTK_STOCK_COPY" name="Copy" value="gtk-copy"/>
<static-string cname="GTK_STOCK_CUT" name="Cut" value="gtk-cut"/>
<static-string cname="GTK_STOCK_DELETE" name="Delete" value="gtk-delete"/>
<static-string cname="GTK_STOCK_DIALOG_ERROR" name="DialogError" value="gtk-dialog-error"/>
<static-string cname="GTK_STOCK_DIALOG_INFO" name="DialogInfo" value="gtk-dialog-info"/>
<static-string cname="GTK_STOCK_DIALOG_QUESTION" name="DialogQuestion" value="gtk-dialog-question"/>
<static-string cname="GTK_STOCK_DIALOG_WARNING" name="DialogWarning" value="gtk-dialog-warning"/>
<static-string cname="GTK_STOCK_DND" name="Dnd" value="gtk-dnd"/>
<static-string cname="GTK_STOCK_DND_MULTIPLE" name="DndMultiple" value="gtk-dnd-multiple"/>
<static-string cname="GTK_STOCK_EXECUTE" name="Execute" value="gtk-execute"/>
<static-string cname="GTK_STOCK_FIND" name="Find" value="gtk-find"/>
<static-string cname="GTK_STOCK_FIND_AND_REPLACE" name="FindAndReplace" value="gtk-find-and-replace"/>
<static-string cname="GTK_STOCK_FLOPPY" name="Floppy" value="gtk-floppy"/>
<static-string cname="GTK_STOCK_GOTO_BOTTOM" name="GotoBottom" value="gtk-goto-bottom"/>
<static-string cname="GTK_STOCK_GOTO_FIRST" name="GotoFirst" value="gtk-goto-first"/>
<static-string cname="GTK_STOCK_GOTO_LAST" name="GotoLast" value="gtk-goto-last"/>
<static-string cname="GTK_STOCK_GOTO_TOP" name="GotoTop" value="gtk-goto-top"/>
<static-string cname="GTK_STOCK_GO_BACK" name="GoBack" value="gtk-go-back"/>
<static-string cname="GTK_STOCK_GO_DOWN" name="GoDown" value="gtk-go-down"/>
<static-string cname="GTK_STOCK_GO_FORWARD" name="GoForward" value="gtk-go-forward"/>
<static-string cname="GTK_STOCK_GO_UP" name="GoUp" value="gtk-go-up"/>
<static-string cname="GTK_STOCK_HELP" name="Help" value="gtk-help"/>
<static-string cname="GTK_STOCK_HOME" name="Home" value="gtk-home"/>
<static-string cname="GTK_STOCK_INDEX" name="Index" value="gtk-index"/>
<static-string cname="GTK_STOCK_ITALIC" name="Italic" value="gtk-italic"/>
<static-string cname="GTK_STOCK_JUMP_TO" name="JumpTo" value="gtk-jump-to"/>
<static-string cname="GTK_STOCK_JUSTIFY_CENTER" name="JustifyCenter" value="gtk-justify-center"/>
<static-string cname="GTK_STOCK_JUSTIFY_FILL" name="JustifyFill" value="gtk-justify-fill"/>
<static-string cname="GTK_STOCK_JUSTIFY_LEFT" name="JustifyLeft" value="gtk-justify-left"/>
<static-string cname="GTK_STOCK_JUSTIFY_RIGHT" name="JustifyRight" value="gtk-justify-right"/>
<static-string cname="GTK_STOCK_MISSING_IMAGE" name="MissingImage" value="gtk-missing-image"/>
<static-string cname="GTK_STOCK_NEW" name="New" value="gtk-new"/>
<static-string cname="GTK_STOCK_NO" name="No" value="gtk-no"/>
<static-string cname="GTK_STOCK_OK" name="Ok" value="gtk-ok"/>
<static-string cname="GTK_STOCK_OPEN" name="Open" value="gtk-open"/>
<static-string cname="GTK_STOCK_PASTE" name="Paste" value="gtk-paste"/>
<static-string cname="GTK_STOCK_PREFERENCES" name="Preferences" value="gtk-preferences"/>
<static-string cname="GTK_STOCK_PRINT" name="Print" value="gtk-print"/>
<static-string cname="GTK_STOCK_PRINT_PREVIEW" name="PrintPreview" value="gtk-print-preview"/>
<static-string cname="GTK_STOCK_PROPERTIES" name="Properties" value="gtk-properties"/>
<static-string cname="GTK_STOCK_QUIT" name="Quit" value="gtk-quit"/>
<static-string cname="GTK_STOCK_REDO" name="Redo" value="gtk-redo"/>
<static-string cname="GTK_STOCK_REFRESH" name="Refresh" value="gtk-refresh"/>
<static-string cname="GTK_STOCK_REMOVE" name="Remove" value="gtk-remove"/>
<static-string cname="GTK_STOCK_REVERT_TO_SAVED" name="RevertToSaved" value="gtk-revert-to-saved"/>
<static-string cname="GTK_STOCK_SAVE" name="Save" value="gtk-save"/>
<static-string cname="GTK_STOCK_SAVE_AS" name="SaveAs" value="gtk-save-as"/>
<static-string cname="GTK_STOCK_SELECT_COLOR" name="SelectColor" value="gtk-select-color"/>
<static-string cname="GTK_STOCK_SELECT_FONT" name="SelectFont" value="gtk-select-font"/>
<static-string cname="GTK_STOCK_SORT_ASCENDING" name="SortAscending" value="gtk-sort-ascending"/>
<static-string cname="GTK_STOCK_SORT_DESCENDING" name="SortDescending" value="gtk-sort-descending"/>
<static-string cname="GTK_STOCK_SPELL_CHECK" name="SpellCheck" value="gtk-spell-check"/>
<static-string cname="GTK_STOCK_STOP" name="Stop" value="gtk-stop"/>
<static-string cname="GTK_STOCK_STRIKETHROUGH" name="Strikethrough" value="gtk-strikethrough"/>
<static-string cname="GTK_STOCK_UNDELETE" name="Undelete" value="gtk-undelete"/>
<static-string cname="GTK_STOCK_UNDERLINE" name="Underline" value="gtk-underline"/>
<static-string cname="GTK_STOCK_UNDO" name="Undo" value="gtk-undo"/>
<static-string cname="GTK_STOCK_YES" name="Yes" value="gtk-yes"/>
<static-string cname="GTK_STOCK_ZOOM_100" name="Zoom100" value="gtk-zoom-100"/>
<static-string cname="GTK_STOCK_ZOOM_FIT" name="ZoomFit" value="gtk-zoom-fit"/>
<static-string cname="GTK_STOCK_ZOOM_IN" name="ZoomIn" value="gtk-zoom-in"/>
<static-string cname="GTK_STOCK_ZOOM_OUT" name="ZoomOut" value="gtk-zoom-out"/>
</object>
</namespace>
<namespace name="Atk" library="atk-1.0">
<enum name="CoordType" cname="AtkCoordType" type="enum">

View file

@ -333,6 +333,23 @@ foreach $key (sort (keys (%types))) {
addFieldElems($struct_el, split(/;/, $1));
addFuncElems($struct_el, $key);
}
# This should probably be done in a more generic way
foreach $define (sort (keys (%defines))) {
next if $define !~ /[A-Z]_STOCK_/;
if ($stocks{$ns}) {
$stock_el = $stocks{$ns};
} else {
$stock_el = addNameElem($ns_elem, "object", $ns . "Stock", $ns);
$stocks{$ns} = $stock_el;
}
$string_el = addNameElem ($stock_el, "static-string", $define);
$string_name = lc($define);
$string_name =~ s/\w+_stock_//;
$string_el->setAttribute('name', StudlyCaps($string_name));
$string_el->setAttribute('value', $defines{$define});
}
##############################################################
# Add metadata
##############################################################