Author: dmacvicar
Date: Tue Jul 29 19:01:37 2008
New Revision: 49495
URL: http://svn.opensuse.org/viewcvs/yast?rev=49495&view=rev
Log:
some more widgets, thinking continuing using xul, a more one to one description, or both
Added:
branches/tmp/dmacvicar/yast-xmlui/libyui/examples/xul/mab.xul
branches/tmp/dmacvicar/yast-xmlui/libyui/examples/xul/mozmail.xul
branches/tmp/dmacvicar/yast-xmlui/libyui/examples/xul/top.xul
Modified:
branches/tmp/dmacvicar/yast-xmlui/libyui/src/YUIXULReader.cc
Added: branches/tmp/dmacvicar/yast-xmlui/libyui/examples/xul/mab.xul
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/yast-xmlui/libyui/examples/xul/mab.xul?rev=49495&view=auto
==============================================================================
--- branches/tmp/dmacvicar/yast-xmlui/libyui/examples/xul/mab.xul (added)
+++ branches/tmp/dmacvicar/yast-xmlui/libyui/examples/xul/mab.xul Tue Jul 29 19:01:37 2008
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+================================================================================
+/**
+ * Main XUL file. It start MAB.
+ * It can be loaded directly from a URL, with the browser File -> Open or when
+ * installed from the Tools menu.
+ *
+ * @filename mab.xul
+ * @$LastChangedDate: 2004-05-07 16:58:00 +0200 (Fri, 07 May 2004) $
+ * @author Fabio Serra <faser@faser.net>
+ * @copyright Fabio Serra (The Initial Developer of the Original Code)
+ * @license Mozilla Public License Version 1.1
+*/
+================================================================================
+-->
+
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="../skin/mab.css" type="text/css"?>
+<?xul-overlay href="overlay/main_menubar.xul"?>
+<?xul-overlay href="overlay/icon_toolbar.xul"?>
+<?xul-overlay href="overlay/search_toolbar.xul"?>
+<?xul-overlay href="overlay/result_tree.xul"?>
+<?xul-overlay href="overlay/detail_box.xul"?>
+<?xul-overlay href="overlay/price_box.xul"?>
+<?xul-overlay href="overlay/status_statusbar.xul"?>
+<!DOCTYPE window [
+
+ <!ENTITY catalog.label "Catalog">
+ <!ENTITY next.label "Next">
+ <!ENTITY next.tooltip "Get Next Records">
+ <!ENTITY clear.label "Clear">
+
+ <!ENTITY imageLarge.tooltip "Click to see the larger image">
+ <!ENTITY review.label "Reviews">
+ <!ENTITY info.label "Product Info">
+]
+>
+
+http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ width="800"
+ height="600"
+ onload="main()"
+ type="mab:main"
+ persist="screenX screenY width height sizemode">
+
+<!-- Include Javascript -->
+<script src="js/ProductLine.js" type="application/x-javascript"/>
+<script src="js/ProductLineController.js" type="application/x-javascript"/>
+<script src="js/DisplayController.js" type="application/x-javascript"/>
+<script src="js/SearchController.js" type="application/x-javascript"/>
+<script src="js/SearchHistory.js" type="application/x-javascript"/>
+<script src="js/ProgressBar.js" type="application/x-javascript"/>
+<script src="js/QueryStringBuilder.js" type="application/x-javascript"/>
+<script src="js/Connection.js" type="application/x-javascript"/>
+<script src="js/FileManager.js" type="application/x-javascript"/>
+<script src="js/AmazonParser.js" type="application/x-javascript"/>
+<script src="js/XMDManager.js" type="application/x-javascript"/>
+<script src="js/DocOpenManager.js" type="application/x-javascript"/>
+<script src="js/config.js" type="application/x-javascript"/>
+<script src="js/utils.js" type="application/x-javascript"/>
+<script src="js/mab.js" type="application/x-javascript"/>
+
+<!-- Broadcaster -->
+<broadcaster id="isSearchRunning" disabled="true"/>
+<!-- Some buttons that have to be disabled in remote MAB -->
+<broadcaster id="isMabRemote" disabled="false"/>
+
+<commandset id="mabCommand">
+ <!-- Overlay main_menubar.xul -->
+ <commandset id="menubarCommand" />
+
+ <command id="newSearchCmd" oncommand="newSearch()"/>
+ <command id="nextCmd" oncommand="nextRecord()"/>
+ <command id="clearCmd" oncommand="clearAll()" />
+ <command id="commentCmd" oncommand="getComment()"/>
+ <command id="goAmazonCmd" oncommand="goAmazon()" />
+ <command id="addCartCmd" oncommand="addCart()" />
+ <command id="goGoogleCmd" oncommand="goGoogle()" />
+ <command id="deleteCmd" oncommand="deleteRow()"/>
+</commandset>
+
+<!-- All Keyset must stay in the same file -->
+<keyset>
+ <key id="search-key" keycode="VK_RETURN" command="newSearchCmd"/>
+ <key id="search-key" keycode="VK_ENTER" command="newSearchCmd"/>
+ <key id="delete-key" keycode="VK_DELETE" command="deleteCmd"/>
+ <!-- main_menubar.xul -->
+ <key id="new-key" modifiers="accel" key="n" command="newCmd"/>
+ <key id="close-key" modifiers="accel" key="w" command="closeCmd"/>
+ <key id="save-key" modifiers="accel" key="s" command="saveCmd"/>
+
+ <key id="review-key" modifiers="accel" key="r" command="commentCmd"/>
+</keyset>
+
+
+
+<!--
+This invisible spacer is used to store preferences
+In this way I can store preferences for remote and installed MAB version
+-->
+<spacer id="settings-spacer" hidden="true" search="lite" nrResult="20" persist="search nrResult"/>
+<!-- UI Start -->
+<toolbox>
+ <!-- Overlay MenuBar -->
+ <menubar id="main-menubar"/>
+ <!-- Overlay Toolbar icon -->
+ <toolbar id="icon-toolbar"/>
+ <!-- Overlay Search toolbar -->
+ <toolbar id="search-toolbar"/>
+</toolbox>
+
+<!-- Tree -->
+<hbox flex="1" id="main-box">
+ <vbox>
+ <!-- Tree Overlay -->
+ <tree id="result-tree"/>
+ <!-- Details Overlay -->
+ <hbox id="detail-box"/>
+ <separator class="groove"/>
+ <!-- Price Overlay -->
+ <hbox id="price-box" />
+ </vbox>
+ <splitter id="detail-comment" collapse="after" resizeafter="grow">
+ <grippy />
+ </splitter>
+ <!-- Extra Info right panel -->
+ <tabbox flex="1" id="extra-info-tab">
+ <tabs id="comment-tab">
+ <tab label="&info.label;"/>
+ <tab label="&review.label;"/>
+ </tabs>
+ <tabpanels style="background-color: White;" flex="3">
+ <tabpanel>
+ <iframe id="allInfo-selected" src="html/allinfo.html" flex="3" />
+ </tabpanel>
+ <tabpanel>
+ <iframe id="comment-selected" src="html/comment.html" flex="3"/>
+ </tabpanel>
+ </tabpanels>
+ </tabbox>
+</hbox>
+ <!-- Status Bar Overlay -->
+ <statusbar id="mab-status-bar" />
+</window>
Added: branches/tmp/dmacvicar/yast-xmlui/libyui/examples/xul/mozmail.xul
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/yast-xmlui/libyui/examples/xul/mozmail.xul?rev=49495&view=auto
==============================================================================
--- branches/tmp/dmacvicar/yast-xmlui/libyui/examples/xul/mozmail.xul (added)
+++ branches/tmp/dmacvicar/yast-xmlui/libyui/examples/xul/mozmail.xul Tue Jul 29 19:01:37 2008
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+
+ <window id="winOuter" title="Mozilla-compatible Webmail App" orient="vertical" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <menubar>
+ <menu id="mnuFile" label="File" accesskey="f">
+ <menupopup id="mnupFile">
+ <menuitem label="Get Text" accesskey="t"/>
+ <menuitem label="Add Attachment" accesskey="a"/>
+ <menuseparator/>
+ <menuitem label="Save Message/Draft" accesskey="s"/>
+ <menuseparator/>
+ <menuitem label="Exit" accesskey="x"/>
+ </menupopup>
+ </menu>
+ <menu id="mnuServer" label="Server" accesskey="s">
+ <menupopup id="mnupServer">
+ <menuitem label="Connect to Server" accesskey="c"/>
+ <menuitem label="Change Server" accesskey="s" disabled="true"/>
+ <menuseparator/>
+ <menuitem label="Check for New Mail" accesskey="n"/>
+ <menuitem label="Destroy Deleted Mail" accesskey="d"/>
+ </menupopup>
+ </menu>
+ <menu id="mnuMail" label="Mail" accesskey="m">
+ <menupopup id="mnupMail">
+ <menuitem label="New Message" accesskey="s" disabled="true"/>
+ <menuitem label="Forward Message" accesskey="o"/>
+ <menuitem label="Reply to Message" accesskey="r"/>
+ <menuseparator/>
+ <menuitem label="Find Message" accesskey="f"/>
+ <menuitem label="Mark Message As Important" accesskey="i"/>
+ <menuseparator/>
+ <menuitem label="Render Message as HTML" accesskey="h"/>
+ </menupopup>
+ </menu>
+ </menubar>
+
+ <vbox flex="1">
+ <hbox id="boxFilerNav" flex="5" style="background-color: #ffffff;">
+ <vbox id="boxMailFilers" flex="1">
+ <button id="butCheckEmailNow" label="Check Email Now"/>
+ <button id="butDelMessages" label="Flush Deleted Messages"/>
+ <button id="butChangeServers" label="Change Servers"/>
+ </vbox>
+ <tabbox id="windowList" flex="8">
+ <tabs>
+ <tab label="Control"/>
+ <tab label="Inbox"/>
+ <tab label="Deleted Items"/>
+ </tabs>
+ <tabpanels flex="1">
+ <tabpanel style="border: 2px solid #FFFF00">
+ <object src="http://www.google.com" type="text/html" />
+ </tabpanel>
+ <tabpanel>
+ <description>Inbox</description>
+ </tabpanel>
+ <tabpanel>
+ <description>Deleted Items</description>
+ </tabpanel>
+ </tabpanels>
+ </tabbox>
+ </hbox>
+ <splitter id="mainSplit" state="open" collapse="none"></splitter>
+ <vbox id="boxMailShow" flex="5" style="background-color: #000000; height: 100%;">
+ <iframe src="about:mozilla" flex="1" />
+ </vbox>
+ </vbox>
+ </window>
Added: branches/tmp/dmacvicar/yast-xmlui/libyui/examples/xul/top.xul
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/yast-xmlui/libyui/examples/xul/top.xul?rev=49495&view=auto
==============================================================================
--- branches/tmp/dmacvicar/yast-xmlui/libyui/examples/xul/top.xul (added)
+++ branches/tmp/dmacvicar/yast-xmlui/libyui/examples/xul/top.xul Tue Jul 29 19:01:37 2008
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+
+http://www.w3.org/1999/xhtml"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<script>
+<![CDATA[
+
+function setFrame()
+{
+ var listBox = document.getElementById("working-list");
+ var selectedItem = listBox.getSelectedItem(0);
+ var newPage = selectedItem.getAttribute("value");
+ document.getElementById("working-frame").setAttribute("src", newPage);
+ var newSrc = newPage + ".txt";
+ document.getElementById("source-frame").setAttribute("src", newSrc);
+}
+
+]]>
+</script>
+
+ <hbox flex="1">
+
+ <listitem value="layout.xul" label="Box Layout" selected="true" />
+ <listitem value="button.xul" label="Buttons" />
+ <listitem value="checkbox.xul" label="Checkboxes" />
+ <listitem value="colorpicker.xul" label="Colorpickers" />
+ <listitem value="cropping.xul" label="Cropping" />
+ <listitem value="grid.xul" label="Grids" />
+ <listitem value="image.xul" label="Images" />
+ <listitem value="label.xul" label="Labels" />
+ <listitem value="list.xul" label="Lists" />
+ <listitem value="menubar.xul" label="Menubars, etc." />
+ <listitem value="popup.xul" label="Popups" />
+ <listitem value="progressmeter.xul" label="Progressmeters" />
+ <listitem value="radio.xul" label="Radiobuttons" />
+ <listitem value="scrolling.xul" label="Scrolling" />
+ <listitem value="splitter.xul" label="Splitters" />
+ <listitem value="stack.xul" label="Stacks and Decks" />
+ <listitem value="tab.xul" label="Tabs" />
+ <listitem value="textbox.xul" label="TextBoxes" />
+ <listitem value="tree-simple.xul" label="Trees, Simple" />
+ <listitem value="tree-nested.xul" label="Trees, Nested" />
+ </listbox>
+
+ <splitter collapse="before" resizebefore="closest" resizeafter="grow">
+ <grippy />
+ </splitter>
+
+ <tabbox flex="1" >
+ <tabs>
+ <tab label="Examples" />
+ <tab label="Source" />
+ <tab label="Change log" />
+ </tabs>
+ <tabpanels flex="1" >
+ <iframe id="working-frame" type="content-primary" src="layout.xul" />
+
+ <iframe type="content-primary" src="ChangeLog.txt" />
+ </tabpanels>
+ </tabbox>
+
+ </hbox>
+
+</window>
Modified: branches/tmp/dmacvicar/yast-xmlui/libyui/src/YUIXULReader.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/yast-xmlui/libyui/src/YUIXULReader.cc?rev=49495&r1=49494&r2=49495&view=diff
==============================================================================
--- branches/tmp/dmacvicar/yast-xmlui/libyui/src/YUIXULReader.cc (original)
+++ branches/tmp/dmacvicar/yast-xmlui/libyui/src/YUIXULReader.cc Tue Jul 29 19:01:37 2008
@@ -26,7 +26,8 @@
#include "YSelectionBox.h"
#include "YMultiSelectionBox.h"
#include "YLabel.h"
-
+#include "YProgressBar.h"
+#include "YComboBox.h"
#include "YUIXULReader.h"
using namespace std;
@@ -119,6 +120,8 @@
}
// forward declarations
+static YWidget * parseMenulist( YWidget *parent, DOMElement *root );
+static YWidget * parseProgressMeter( YWidget *parent, DOMElement *root );
static YWidget * parseLabel( YWidget *parent, DOMElement *root );
static YWidget * parseListbox( YWidget *parent, DOMElement *root );
static YWidget * parseRadioGroup( YWidget *parent, DOMElement *root );
@@ -134,13 +137,38 @@
static YWidget * parseWindow( YWidget *parent, DOMElement *root );
static YWidget * parseNode( YWidget *parent, DOMElement *root );
static void parseChildren( YWidget *parent, DOMElement *root );
-static YItemCollection parseItemList( YWidget *parent, DOMElement *root );
-static YItem parseItem( YWidget *parent, DOMElement *root );
+static YItemCollection parseItemList( const string &tagname, YWidget *parent, DOMElement *root );
+static YItem parseItem( const string &tagname, YWidget *parent, DOMElement *root );
+
+static YWidget *
+parseProgressMeter( YWidget *parent, DOMElement *root )
+{
+ int value = 0;
+ int maxValue = 100;
+ string mode = "determined";
+ string label;
+
+ DOMStringList list = root->getAttributeList();
+ DOMStringList::iterator i;
+ for (i = list.begin(); i != list.end(); i++)
+ {
+ if ( *i == "mode" )
+ mode = root->getAttribute(*i);
+ else if ( *i == "value" )
+ value = convertToInt(root->getAttribute(*i));
+ }
+
+ YProgressBar * progressBar = YUI::widgetFactory()->createProgressBar( parent, label, maxValue );
+ if ( value > 0 )
+ progressBar->setValue( value );
+ return progressBar;
+}
+
static YItem
-parseItem( YWidget *parent, DOMElement *root )
+parseItem( const string &tagname, YWidget *parent, DOMElement *root )
{
- if ( root->getElementName() != "listitem" )
+ if ( root->getElementName() != tagname )
{
YUI_THROW(YUIException("Invalid item '" + root->getElementName() + "'"));
}
@@ -161,7 +189,7 @@
static YItemCollection
-parseItemList( YWidget *parent, DOMElement *root )
+parseItemList( const string &tagname, YWidget *parent, DOMElement *root )
{
YItemCollection itemCollection;
itemCollection.reserve( root->childCount() );
@@ -176,7 +204,11 @@
els = root->getChilds();
for(i = els.begin(); i != els.end(); i++)
{
- YItem item = parseItem( parent, *i );
+ // FIXME, lbyui does not support this
+ if ( (*i)->getElementName() == "menuseparator" )
+ continue;
+
+ YItem item = parseItem( tagname, parent, *i );
}
}
}
@@ -215,6 +247,52 @@
}
static YWidget *
+parseMenulist( YWidget *parent, DOMElement *root )
+{
+ // FIXME XUL has no label here
+ string label;
+ bool editable = false;
+
+ // get the attributes
+ {
+
+ DOMStringList list = root->getAttributeList();
+ DOMStringList::iterator i;
+ for (i = list.begin(); i != list.end(); i++)
+ {
+ if ( *i == "label" )
+ label = root->getAttribute(*i);
+ else if ( *i == "editable" )
+ editable = ( root->getAttribute(*i) == "true" );
+ }
+ }
+
+ YComboBox * comboBox = YUI::widgetFactory()->createComboBox( parent, label, editable );
+
+ // sadly the menulist element has a menupopup element
+ // which contains the menutem elements
+ {
+
+ DOMElements els;
+ DOMElements::iterator i;
+
+ if (root->hasChilds())
+ {
+ els = root->getChilds();
+ for(i = els.begin(); i != els.end(); i++)
+ {
+ if ( (*i)->getElementName() == "menupopup" )
+ {
+ comboBox->addItems( parseItemList( "menuitem", comboBox, *i ) );
+ }
+ }
+ }
+ }
+ return comboBox;
+}
+
+
+static YWidget *
parseListbox( YWidget *parent, DOMElement *root )
{
string seltype = "single";
@@ -233,13 +311,13 @@
if ( seltype == "multiple" )
{
YMultiSelectionBox * mselBox = YUI::widgetFactory()->createMultiSelectionBox( parent, label );
- mselBox->addItems( parseItemList( mselBox, root ) );
+ mselBox->addItems( parseItemList( "listitem", mselBox, root ) );
return mselBox;
}
else
{
YSelectionBox *selBox = YUI::widgetFactory()->createSelectionBox( parent, label );
- selBox->addItems( parseItemList( selBox, root ) );
+ selBox->addItems( parseItemList( "listitem", selBox, root ) );
return selBox;
}
}
@@ -510,7 +588,7 @@
static YWidget *
parseWindow( YWidget *parent, DOMElement *root )
{
- string orient = "horizontal";
+ string orient = "vertical";
YDialog *dialog = YUI::widgetFactory()->createPopupDialog();
@@ -529,10 +607,10 @@
{
YLayoutBox *box;
- if ( orient == "vertical" )
- box = YUI::widgetFactory()->createVBox(dialog);
- else
+ if ( orient == "horizontal" )
box = YUI::widgetFactory()->createHBox(dialog);
+ else
+ box = YUI::widgetFactory()->createVBox(dialog);
parseChildren( box, root );
}
@@ -576,6 +654,10 @@
if ( name == "window" )
w = parseWindow( parent, root );
+ else if ( name == "menulist" )
+ w = parseMenulist( parent, root );
+ else if ( name == "progressmeter" )
+ w = parseProgressMeter( parent, root );
else if ( name == "label" )
w = parseLabel( parent, root );
else if ( name == "listbox" )
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org