⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch33.htm

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTM
📖 第 1 页 / 共 5 页
字号:


files. By default, <TT>ibuild</TT> doesn't overwrite these files.







<DL>



	<DT></DT>



</DL>











<DL>



	<DD>



<HR>



<A NAME="Heading28<FONT COLOR="#000077"><B>NOTE:</B> </FONT>These two files



	are under the user's control; the core files (<TT>DialogBox-core.[ch]</TT>) are under



	<TT>ibuild</TT>'s control. 



<HR>







</DL>







<P>The Composition menu contains commands to modify the structure of the interface.



See Table 33.2 for a list of these commands. </P>



<CENTER>



<P><FONT SIZE="4"><B>Table 33.2.</B> Composition commands. </FONT>



<TABLE BORDER="0">



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="83" ALIGN="LEFT"><I>Command</I></TD>



		<TD ALIGN="LEFT"><I>Action</I></TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">Dissolve</TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Dissolves the selected components by deleting the top-level parents and exposing



			the children of the selected components. Leaf-level components cannot be dissolved.



			Compose the selected components with the corresponding composition object. The order



			of selection decides the order in which they are composed.</TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">Hbox</TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Tiles the selected components left to right in abutting fashion.</TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">Vbox</TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Tiles the selected components top to bottom in abutting fashion.</TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">Deck</TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Stacks the selected components on top of each other, with the last selected component



			on the top.</TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">Frame</TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Puts a frame around each of the selected components.</TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">ShadowFrame</TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Puts a shadow frame around each of the selected components.</TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">ViewPort</TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Puts a viewport around each of the selected components.</TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">MenuBar</TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Tiles the selected components row by row as in an HBox (horizontal box). It also



			implements the sweeping effect when MenuItems, pull-down menus, or pull-right menus



			are the selected components.</TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="83" ALIGN="LEFT" VALIGN="TOP">Shaper</TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Redefines the resizing behavior of the selected components. Shaper is an <TT>ibuild</TT>-generated



			class, which is useful for overriding the default resizing behavior of library components.</TD>



	</TR>



</TABLE>



</P>



</CENTER>



<P>The Reorder command reorders the components inside a composition according to



the current selection order. For instance, narrowing into an HBox, reselecting its



components, and executing Narrow defines ordering of the components in the HBox corresponding



to the new selection order.</P>



<P>Similarly, the Raise command brings the selected components to the front of the



interface so that they are drawn on top of (after) the other components in the interface.



For example, if a selected component is raised in a Deck, it appears on top of all



the components.</P>



<P>The Lower command sends the selected components to the back of the interface so



that they are drawn behind (before) the other components in the interface.</P>



<P>The Font menu contains a set of fonts with which to print text-based components.



The default value is the current font from the menu. You also set all the selected



components' fonts to that font. A font indicator in the upper-right corner displays



the current font.</P>



<P>The Border menu contains a set of brushes that are used to set border widths of



Border and Frame components. A border indicator in the upper-left corner displays



the current border.</P>



<P>The FgColor and BgColor menus contain a set of colors with which to draw components



and text. When you set the current foreground or background color from the FgColor



or BgColor menu, you also set all the selected components' foreground or background



colors.</P>



<P>The Align menu contains commands to set the alignment of the message on Message-based



components. Examples of these components include pull-down and pull-right menus,



MenuItem components, and Message components. The effects of alignment are more apparent



when the selected components are resized.



<CENTER>



<H4><A NAME="Heading29<FONT COLOR="#000077">Subclasses</FONT></H4>



</CENTER>



<P>Subclasses enable you to introduce user-defined objects for customizing your interfaces.



These are abstraction mechanisms that break down complicated user interfaces into



more manageable and reusable subcomponents, which are more amenable to user customization.



Without subclass objects, the generated code consists of static functions that assemble



the library user interface elements into complete interfaces.</P>



<P>The subclasses that you can work with are as listed here :







<UL>



	<LI>MonoScene Subclass



	<P>



	<LI>Dialog Subclass



	<P>



	<LI>Editor Subclass



</UL>







<P>Member names associated with the components are therefore useless.</P>



<P>With subclass objects, children of a subclass instance become the instance's interior



definition. If the interior components are exported, they become member variables



of the subclass instance.</P>



<P>Selecting MonoScene Subclass causes each selected component to be enclosed in



a MonoScene subclass object.</P>



<P>Selecting Dialog Subclass is similar to selecting MonoScene Subclass, except that



it provides features of the Dialog class in the library as well.</P>



<P>Editor Subclass is useful when the end application is a domain-specific editor.



Objects kept by an editor, such as the KeyMap, Selection, Component, and ControlState,



can all be subclassed to define domain-specific behavior.



<CENTER>



<H3><A NAME="Heading30<FONT COLOR="#000077">Code Generation</FONT></H3>



</CENTER>



<P>Conceptually, components created in the workspace are instances of the actual



Interviews and Unidraw counterparts. All separate components (uncomposed and composed



components without common parents) generate separate windows after code generation.



For example, if the user-specified filename associated with an <TT>ibuild</TT> session



is <TT>hello</TT>, the files <TT>hello-imake</TT>, <TT>hello-make</TT>,<TT> hello-props</TT>,



and <TT>hello-main.c</TT> are generated.







<UL>



	<LI><TT>hello-imake</TT> and <TT>hello-make</TT> are an <TT>imakefile</TT> and a



	<TT>makefile</TT> generated by <TT>ibuild</TT> using <TT>ibmkmf</TT>, respectively.



	<P>



	<LI><TT>hello-props</TT> contains attribute:value pairs required by Interviews to



	associate properties to user-interface objects on a per instance basis.



	<P>



	<LI><TT>hello-main.c</TT> contains a generated <TT>main()</TT> routine to instantiate



	the interfaces. If no MonoScene objects exist in <TT>ibuild</TT>, static functions



	are generated in <TT>hello-main.c</TT> to assemble the interface components. MonoScene



	(or MonoScene subclass) objects are user-defined abstractions to decompose complex



	user interfaces into simpler, higher-level elements, which are described later.



</UL>







<P>All user interface components can be subclassed by simply renaming their Class



Name attribute to be different from the Base Class Name, using the Examine tool and



selecting the Info entry.</P>



<P>A set of four files is generated for each subclassed component in <TT>ibuild</TT>.



If the Class Name of a subclassed component is <TT>Displayer</TT>, and the Base Class



Name is <TT>stringEditor</TT>, the following files are created: <TT>Displayer.h</TT>,



<TT>Displayer.c</TT>, <TT>Displayer-core.h</TT>, and <TT>Displayer-core.c</TT> as



the output of the Generate command.</P>



<P>For the previous set of files, <TT>Displayercore</TT> is a subclass of <TT>stringEditor</TT>,



and <TT>Displayer</TT> is a subclass of <TT>Displayercore</TT>. The <TT>-core.*</TT>



postfixed files are core files that are under <TT>ibuild</TT>'s control, and you



should not modify them. These core files contain enhanced widget definitions to accommodate



library deficiencies and provide a more convenient user model.</P>



<P><TT>Displayer.h</TT> and <TT>Displayer.c</TT> are subclass files that are provided



for customization, which typically involves redefinition of some virtual functions



defined by the base class.</P>



<P>The <TT>ibuild</TT> application also allows the creation of new user interface



abstractions by providing MonoScene subclass, Dialog subclass, and Editor subclass



composition mechanisms. Typically, the topmost composition of a completed user interface



component is a MonoScene subclass object. All enclosed components of a subclass object



can be thought of as its members. For instance, if a Dialog subclass instance called



<TT>Informer</TT> is used to wrap (abstract) the previous interface, <TT>Informer.h</TT>,



<TT>Informer.c</TT>, <TT>Informer-core.h</TT>, and <TT>Informer-core.c</TT> are generated.



In this case, <TT>Informercore</TT> is a subclass of <TT>Dialog</TT>, and <TT>Informer</TT>



is a subclass of <TT>Informercore</TT>. Like <TT>Displayer</TT>, <TT>Informer-core.h</TT>



and <TT>Informer-core.c</TT> are under <TT>ibuild</TT>'s control; <TT>Informer.h</TT>



and <TT>Informer.c</TT> are for user customization. In addition to providing enhanced



widget definitions, <TT>Informer-core.c</TT> also contains definitions of its appearance



by instantiating its member components. <TT>Informer-core.h</TT> provides an interface



to <TT>Informer.h</TT> where the exported members can be selected by using the Examine



tool, as explained later.



<CENTER>



<H4><A NAME="Heading31<FONT COLOR="#000077">Additional Resources in Xdefaults</FONT></H4>



</CENTER>



<P>You must set resources only for the entries that you want to override, not for



all of them. If you want to add entries to the menus, simply set resources for them.



However, don't skip any numbers after the end of the menu, because the menu ends



at the first undefined resource. To shorten a menu instead of extending it, specify



a blank string as the resource for the entry following the last item in the menu.</P>



<P>The <TT>ibuild</TT> application understands the resources listed in Table 33.3,



in addition to those specified in <TT>idraw</TT>. </P>



<CENTER>



<P><FONT SIZE="4"><B>Table 33.3.</B> Additional resources for ibuild. </FONT>



<TABLE BORDER="0">



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="68" ALIGN="LEFT"><I>Resource</I></TD>



		<TD ALIGN="LEFT"><I>Action</I></TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="68" ALIGN="LEFT" VALIGN="TOP">initialborder</TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Specifies the border that is active on startup. Give a number that identifies the



			border by its position in the Border menu starting from 1 for the first entry. Border



			specification is similar to brush specification in <TT>idraw</TT>, except only solid



			brushes should be used because they are used to set border widths of Border and Frame



			components.</TD>



	</TR>



	<TR ALIGN="LEFT" rowspan="1">



		<TD WIDTH="68" ALIGN="LEFT" VALIGN="TOP">border i</TD>



		<TD ALIGN="LEFT" VALIGN="TOP">Defines a custom border to use for the ith entry in the Border menu. Unlike normal



			brush specification, the first 16-bit hexadecimal number should always be 0xffff



			to indicate solid brush. The second hexadecimal number should give the desired border



			width in pixels. Border specification affects only certain interface objects, as



			described earlier</TD>



	</TR>



</TABLE>



.



</CENTER>



<CENTER>



<H3><A NAME="Heading32<FONT COLOR="#000077">Building an Application with ibuild</FONT></H3>



</CENTER>



<P>Let's start with a simple application, shown in Figure 33.5. You will build an



interface with three check buttons, two push buttons, and a label. The label was



created with the Message tool.<BR>



<BR>



<A NAME="Heading33<A HREF="../art/33/28lnx08.jpg"><FONT COLOR="#000077"><B>FIGURE



33.5.</B></FONT></A><FONT COLOR="#000077"> </FONT><I>The <TT>ibuild</TT> sample application.



</I><BR>



<BR>



Collect the check buttons by selecting them and grouping them with the Composition/VBox



selection. For the push buttons, use the HBox selection to group them horizontally.</P>



<P>All components of the application were glued together, using the VBOX item, to



create one big application. Because this is one screen, attach the Monoscreen composition



property to all objects in this application in order to allow all portions of the



application screen to be filled with blanks, which are not explicitly covered by



an object.</P>



<P>Now, save the application with the File/Save As button. See Figure 33.6 for this



dialog box. After saving this application, use the File/Generate option to generate



all the source, makefiles, and property files for this application. Now you can build



the application as shown in Figure 33.7.<BR>



<BR>



<A NAME="Heading34<A HREF="../art/33/28lnx05.jpg"><FONT COLOR="#000077"><B>FIGURE



33.6.</B></FONT></A><FONT COLOR="#000077"> </FONT><I>Saving the sample application.</I><BR>



<BR>



<A NAME="Heading35<A HREF="../art/33/28lnx06.jpg"><FONT COLOR="#000077"><B>FIGURE



33.7.</B></FONT></A><FONT COLOR="#

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -