http://wiki.kolibrios.org/index.php?title=SysFn00&feed=atom&action=historySysFn00 - Revision history2024-03-29T01:05:53ZRevision history for this page on the wikiMediaWiki 1.35.7http://wiki.kolibrios.org/index.php?title=SysFn00&diff=3152&oldid=prevMike.dld: Created page with '__NOTOC__ {{DISPLAYTITLE: Function 0 — define and draw window}} == Parameters == {| border="1" id="table1" class="wikitable sysfunc" |- ! class="header" | bits ! class="...'2011-01-01T21:34:50Z<p>Created page with '__NOTOC__ {{DISPLAYTITLE: Function 0 — define and draw window}} == Parameters == {| border="1" id="table1" class="wikitable sysfunc" |- ! class="header" | bits ! class="...'</p>
<p><b>New page</b></p><div>__NOTOC__ {{DISPLAYTITLE: Function 0 &mdash; define and draw window}}<br />
== Parameters ==<br />
<br />
{| border="1" id="table1" class="wikitable sysfunc"<br />
|-<br />
! class="header" | bits<br />
! class="header" | type<br />
! class="header" | value<br />
! class="header" | description<br />
|- <br />
! colspan="4" class="register" | eax<br />
|- <br />
| class="bits" | 0&ndash;31<br />
| class="type" | [[DataTypes#UInt32|uint32]]<br />
| 0<br />
| Function number.<br />
|- <br />
! colspan="4" class="register" | ebx<br />
|- <br />
| class="bits" | 0&ndash;15<br />
| class="type" | [[DataTypes#UInt16|uint16]]<br />
| window width<br />
| rowspan="2" | Window placement by X axis.<br />
|- <br />
| class="bits" | 16&ndash;31<br />
| class="type" | [[DataTypes#Int16|int16]]<br />
| window offset by X<br />
|- <br />
! colspan="4" class="register" | ecx<br />
|- <br />
| class="bits" | 0&ndash;15<br />
| class="type" | [[DataTypes#UInt16|uint16]]<br />
| window height<br />
| rowspan="2" | Window placement by Y axis.<br />
|- <br />
| class="bits" | 16&ndash;31<br />
| class="type" | [[DataTypes#Int16|int16]]<br />
| window offset by Y<br />
|- <br />
! colspan="4" class="register" | edx<br />
|- <br />
| class="bits" | 0&ndash;23<br />
| class="type" | [[DataTypes#RGB888|rgb888]]<br />
| client area color<br />
| <br />
|- <br />
| class="bits" | 24&ndash;27<br />
| class="type" | [[DataTypes#UInt4|uint4]]<br />
| window type<br />
|<br />
* 0 &mdash; window type I &mdash; fixed size window;<br />
* 1 &mdash; just define window area, don't draw anything;<br />
* 2 &mdash; window type II &mdash; user-resizable window;<br />
* 3 &mdash; window type III &mdash; skinned window;<br />
* 4 &mdash; window type IV &mdash; fixed size skinned window.<br />
Other possible values (from 5 to 15) are reserved, function call will be ignored.<br />
|- <br />
| class="bits" | 28<br />
| class="type" | [[DataTypes#Bit|bit]]<br />
| flag: caption text<br />
| Window type I&ndash;II: ignored.<br />
<br />
Window type III&ndash;IV:<br />
* 0 &mdash; no caption;<br />
* 1 &mdash; caption text address is in edi.<br />
|- <br />
| class="bits" | 29<br />
| class="type" | [[DataTypes#Bit|bit]]<br />
| flag: paint origin<br />
| Paint origin corresponds to:<br />
* 0 &mdash; top left window corner: 0 by X, 0 by Y;<br />
* 1 &mdash; top left client area corner: &lt;border width&gt; by X, &lt;title bar height&gt; by Y.<br />
|- <br />
| class="bits" | 30<br />
| class="type" | [[DataTypes#Bit|bit]]<br />
| flag: window background<br />
| On window redraw, client area is:<br />
* 0 &mdash; filled;<br />
* 1 &mdash; not filled.<br />
|- <br />
| class="bits" | 31<br />
| class="type" | [[DataTypes#Bit|bit]]<br />
| flag: gradient background<br />
| On window redraw, client area is filled with:<br />
* 0 &mdash; solid color;<br />
* 1 &mdash; gradient from specified color (top) to black (bottom).<br />
|- <br />
! colspan="4" class="register" | esi<br />
|- <br />
| class="bits" | 0&ndash;23<br />
| class="type" | [[DataTypes#RGB888|rgb888]]<br />
| title bar color<br />
| Only for window type I&ndash;II.<br />
|- <br />
| class="bits" | 24<br />
| class="type" | [[DataTypes#Bit|bit]]<br />
| flag: fixed position window<br />
|<br />
* 0 &mdash; window could be moved by user;<br />
* 1 &mdash; window couldn't be moved by user.<br />
|- <br />
| class="bits" | 25&ndash;27<br />
| <br />
| 0<br />
| Reserved.<br />
|- <br />
| class="bits" | 28&ndash;31<br />
| class="type" | [[DataTypes#UInt4|uint4]]<br />
| title bar style<br />
| Window type I&ndash;II:<br />
* 0 &mdash; no gradient;<br />
* 4 &mdash; reverse gradient;<br />
* 8 &mdash; normal gradient.<br />
Other values are reserved.<br />
<br />
Window type III&ndash;IV: ignored.<br />
|- <br />
! colspan="4" class="register" | edi<br />
|- <br />
| class="bits" rowspan="2" | 0&ndash;31<br />
| class="type" | [[DataTypes#RGB888|rgb888]]<br />
| window border color<br />
| Only for window type I&ndash;II.<br />
|- <br />
| class="type" | [[DataTypes#C_String|char*]]<br />
| caption text address<br />
| Only for window type III&ndash;IV with '''edx'''<sub>28</sub> = 1.<br />
|}<br />
<br />
== Return value ==<br />
<br />
Function doesn't return value.<br />
<br />
== Examples ==<br />
<br />
<source><br />
;; without macros<br />
<br />
; function number: 0<br />
xor eax, eax<br />
; window position: <offset> * 65536 + <size><br />
; alternatives: 100 shl 16 + 300, 0x0064012C<br />
mov ebx, 100 * 65536 + 300<br />
mov eсx, 200 * 65536 + 150<br />
; background color: 0x0080ff (red 0, green 128, blue 255)<br />
; window type: III (skinned, user-resizable)<br />
; flags: has caption text, paint origin at (0, 0), solid background with no gradient<br />
mov edx, 0x130080ff<br />
; caption text address<br />
mov edi, window_title<br />
; function call<br />
int 0x40<br />
<br />
;; same with use of mcall<br />
<br />
mcall 0, <100, 300>, <200, 150>, 0x130080ff, , window_title<br />
<br />
; ...<br />
window_title db 'Foobar', 0<br />
; ...<br />
</source><br />
<br />
== Notes ==<br />
<br />
Window position and size are set on first function call and ignored on further calls; to change position and/or size of already defined window use [[SysFn67|function 67]].<br />
<br />
For windows of type III&ndash;IV with caption ('''edx'''<sub>28</sub> = 1), caption text address is set on first function call and ignored on further calls (precisely, it's ignored after call to [[SysFn12|function 12.2]] &mdash; end of drawing); to change caption text address of already defined window use [[SysFn71|function 71.1]].<br />
<br />
By using specific window styles, window position and/or size could be changed by user. Current position and size could be obtained by calling [[SysFn09|function 9]].<br />
<br />
Window should fit into screen. If specified position and size don't fit this requirement, corresponding offset (or even both or them) is set to 0, and if this doesn't help either then corresponding extent (or even both of them) is set to match screen size.<br />
<br />
{{note | Later we'll use '''xpos''', '''ypos''', '''xsize''', '''ysize''' &mdash; values passed in '''ebx''' and '''ecx'''. Provided coordinates are relative to top left window corner which is (0, 0), bottom right corner coordinates are ('''xsize''', '''ysize''').}}<br />
<br />
Window size is treated as coordinates of bottom right corner.<br />
<br />
{{note | Same applies to all other functions. This means that real window extents are 1 pixel greater.}}<br />
<br />
=== Window type I look ===<br />
<br />
* drawing outer frame 1 pixel wide of '''edi''' color;<br />
* drawing title bar &mdash; rectangle with top left corner at (1, 1) and bottom right corner at ('''xsize''' &minus; 1, min(25, '''ysize''')) &mdash; using color in '''esi''' (taking gradient settings into account)<br />
* if '''ysize''' &ge; 26 then filling client area &mdash; rectangle with left top corner at (1, 21) and bottom right corner at ('''xsize''' &minus; 1, '''ysize''' &minus; 1) (or size ('''xsize''' &minus; 1) &times; ('''ysize''' &minus; 21)) &mdash; using color in '''edx''' (taking gradient settings into account)<br />
* if '''edx'''<sub>28</sub> = 1 and caption text address is set by calling [[SysFn71|function 71.1]], it's drawn on title bar in corresponding place.<br />
<br />
=== Window type II look ===<br />
<br />
* drawing outer frame 1 pixel wide of "shaded" '''edi''' color (all color components divided by 2);<br />
* drawing middle frame 3 pixels wide of '''edi''' color;<br />
* drawing inner frame 1 pixel wide of "shaded" '''edi''' color;<br />
* drawing title bar &mdash; rectangle with top left corner at (4, 4) and bottom right corner at ('''xsize''' &minus; 4, min(20, '''ysize''')) &mdash; using color in '''esi''' (taking gradient settings into account);<br />
* if '''ysize''' &ge; 26 then filling client area &mdash; rectangle with top left corner at (5, 20) and bottom right corner at ('''xsize''' &minus; 5, '''ysize''' &minus; 5) &mdash; using color in '''edx''' (taking gradient settings into account);<br />
* if '''edx'''<sub>28</sub> = 1 and caption text address is set by calling [[SysFn71|function 71.1]], it's drawn on title bar in corresponding place.<br />
<br />
=== Skinned window look (types III and IV) ===<br />
<br />
* drawing outer frame 1 pixel wide of 'outer' skin color;<br />
* drawing middle frame 3 pixels wide of 'frame' skin color;<br />
* drawing inner frame 1 pixel wide or 'inner' skin color;<br />
* drawing title bar (using skin images) in rectangle (0, 0) &ndash; ('''xsize''', _skinh &minus; 1);<br />
* if '''ysize''' &ge; 26 then filling client area &mdash; rectangle with top left corner at (5, _skinh) and bottom right corner at ('''xsize''' &minus; 5, '''ysize''' &minus; 5) &mdash; using color in '''edx''' (taking gradient settings into account);<br />
* defining two standard buttons: window close and minimize (see [[SysFn08|function 8]]);<br />
* if '''edx'''<sub>28</sub> = 1 and '''edi''' contains (non-null) caption text address, it's drawn on title bar using rectangle defined by skin.<br />
<br />
Value of _skinh variable corresponds to result of calling [[SysFn48|function 48.4]].<br />
<br />
{{System functions}}<br />
[[Category: SysCalls]]</div>Mike.dld