Author: visnov
Date: Fri Sep 16 11:48:16 2011
New Revision: 65740
URL: http://svn.opensuse.org/viewcvs/yast?rev=65740&view=rev
Log:
Moved useful functions from Wizard_hw to UIHelper module library.
The next step is to drop Wizard_hw completely.
Added:
trunk/yast2/library/modules/UIHelper.ycp
Modified:
trunk/yast2/package/yast2.changes
Added: trunk/yast2/library/modules/UIHelper.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/modules/UIHelper.ycp?rev=65740&view=auto
==============================================================================
--- trunk/yast2/library/modules/UIHelper.ycp (added)
+++ trunk/yast2/library/modules/UIHelper.ycp Fri Sep 16 11:48:16 2011
@@ -0,0 +1,148 @@
+/**
+ * File: modules/UIHelper.ycp
+ * Package: yast2
+ * Summary: Set of helper modules for UI formatting
+ * Authors: Stanislav Visnovsky
+ *
+ * $Id: Version.ycp.in 10158 2003-06-23 12:48:40Z visnov $
+ */
+
+{
+
+module "UIHelper";
+
+textdomain "base";
+
+
+ /**
+ * Create an edit table with basic buttons.
+ *
+ * It contains table and buttons Add, Edit, Delete. User may specify table header
+ * and content, content that will be placed above table, between table
+ * and buttons, below buttons and rights from buttons (usually another
+ * button).
+ *
+ * @param table_header Table header as defined in UI.
+ * @param table_contents Table items.
+ * @param above_table Content to place above table. There is no need to
+ * place caption here, because the dialog has its caption.
+ * Set it to nil if you do not want to place anything here.
+ * @param below_table Contents to place between table and buttons.
+ * Set it to nil if you do not want to place anything here.
+ * @param below_buttons Content to place below bottons.
+ * Set it to nil if you do not want to place anything here.
+ * @param buttons Content to place rights from buttons. Usually
+ * an additional button, e.g. Set as default.
+ * Set it to nil if you do not want to place anything here.
+ * @return Content for the SetWizardContent[Buttons]()
+ * <B>UI elements ids:</B><table>
+ * <tr><td>Table</td><td>`table</td></tr>
+ * <tr><td>Button add</td><td>`add_button</td></tr>
+ * <tr><td>Button edit</td><td>`edit_button</td></tr>
+ * <tr><td>Button delete</td><td>`delete_button</td></tr>
+ * </table>
+ */
+ global term EditTable ( term table_header,
+ list table_contents,
+ term above_table,
+ term below_table,
+ term below_buttons,
+ term buttons)
+ {
+ term contents = `VBox ();
+ if (nil != above_table)
+ {
+ contents = add (contents, above_table);
+ }
+
+ contents = add (contents,
+ `Table (
+ `id (`table),
+ `opt (`notify),
+ table_header,
+ table_contents));
+ if (nil != below_table)
+ {
+ contents = add (contents, below_table);
+ }
+
+ term but_box = `HBox (
+ `opt (`hstretch),
+ `PushButton (`id (`add_button), `opt (`key_F3), _("A&dd")),
+ `PushButton (`id (`edit_button), `opt (`key_F4), _("&Edit")),
+ `PushButton (`id (`delete_button), `opt (`key_F5), _("De&lete"))
+ );
+
+
+ if (nil != buttons)
+ {
+ but_box = add ( add ( but_box,
+ `HStretch ()),
+ buttons);
+ }
+ contents = add (contents, but_box);
+ if (nil != below_buttons)
+ {
+ contents = add (contents, below_buttons);
+ }
+ return contents;
+ }
+
+ /**
+ * Encloses the content into VBoxes and HBoxes with the appropriate
+ * spacings around it.
+ * @param content The term we are adding spacing to.
+ * @param left Spacing on the left.
+ * @param right Spacing on the right.
+ * @param top Spacing on the top.
+ * @param bottom Spacing on the bottom.
+ * @return Content with spacings around it.
+ */
+ global term SpacingAround( term content,
+ float left, float right,
+ float top, float bottom )
+ {
+ return
+ `HBox
+ (
+ `HSpacing ( left ),
+ `VBox
+ (
+ `VSpacing ( top ),
+ content,
+ `VSpacing ( bottom )
+ ),
+ `HSpacing ( right )
+ );
+ }
+
+ /**
+ * Encloses the content into VBoxes and HBoxes
+ *
+ * Enclose so that its
+ * size is at least
+ * <emphasis>xsize</emphasis> x <emphasis>ysize</emphasis>.
+ * @param xsize Minimal size of content in the X direction
+ * @param ysize Minimal size of content in the Y direction
+ * @param content Content of the dialog
+ * @return Contents sized at least <B>xsize</B> x <B>ysize</B>.
+ */
+ global term SizeAtLeast(term content, float xsize, float ysize)
+ {
+ return
+ `VBox (
+ `VSpacing (0.4),
+ `HSpacing (xsize),
+ `HBox (
+ `HSpacing (1.6),
+ `VSpacing (ysize),
+ content,
+ `HSpacing (1.6)
+ ),
+ `VSpacing (0.4)
+ );
+ }
+
+
+/* EOF */
+}
Modified: trunk/yast2/package/yast2.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/package/yast2.changes?rev=65740&r1=65739&r2=65740&view=diff
==============================================================================
--- trunk/yast2/package/yast2.changes (original)
+++ trunk/yast2/package/yast2.changes Fri Sep 16 11:48:16 2011
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Fri Sep 16 11:46:38 CEST 2011 - visnov@suse.de
+
+- Added UIHelper library module - contains useful
+ UI helpers from now obsolete Wizard_hw
+
+-------------------------------------------------------------------
Thu Sep 15 15:23:50 CEST 2011 - mvidner@suse.cz
- Added the interface name patterns emN, pN and pNpM.
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org