[Wnd-commit] wnd/wnd_doc/doc/controls/dialog classes/choosecolor .CVSIGNORE,NONE,1.1 choosecolor.dtp
Status: Alpha
Brought to you by:
jurner
|
From: jürgen u. <cer...@us...> - 2005-07-23 20:04:26
|
Update of /cvsroot/wnd/wnd/wnd_doc/doc/controls/dialog classes/choosecolor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5628 Added Files: .CVSIGNORE choosecolor.dtpl Log Message: bit of this and a bit of that --- NEW FILE: .CVSIGNORE --- *.html *.gif --- NEW FILE: choosecolor.dtpl --- ::site:: ChooseColor reference <IMG SRC="choosecolor.gif"></IMG> ::site:: class ChooseColor <code class=import>defined in: wnd.dlgs.choosecolor</code><br><br> <code>inst=ChooseColor(*flags)</code><br> <P> <br><br> Creates a ChooseColor dialog <br><br> Each ChooseColor instance holds a fixed size array of 16 ||type-COLORREF|| values the user may adjust to its needs. You may access the arry at any time calling <a HREF="ChooseColor methods/__getitem__.html">__getitem__</a> or <a HREF="ChooseColor methods/__setitem__.html">__setitem__</a> or by adjusting the array when calling the <a HREF="ChooseColor methods/Run.html">Run</a> method. By default all colors in the array are initialized to zero (black that is). <br><br> flags can be a combination of the following flags: <DL> <DT>'debug' <DD>if the dialog is hooked this will allow for debugging its messages. The message handler will be called with a message 'debug' <br> lp= the message ID<br> wp= formated message as string <br><br> <DT>'debugall' <DD>same as 'debug' but prints out more messages <br><br> </DL> </P> ::site:: class ChooseColorFromTemplate <code class=import>defined in: wnd.dlgs.choosecolor</code><br><br> <code>ChooseColorFromTemplate(template, *flags)</code><br> Inits a ChooseColor dialog class from a custom template. <br><br> Template should be a string containing the raw bytes of the template to create the dialog from. <br> flags can be a combination of the following flags: <DL> <DT>'debug' <DD>if the dialog is hooked this will allow for debugging its messages. The message handler will be called with a message 'debug' <br> lp= the message ID<br> wp= formated message as string <br><br> <DT>'debugall' <DD>same as 'debug' but prints out more messages <br><br> </DL> <P> ::site:: class ChooseColorFromInstance <code class=import>defined in: wnd.dlgs.choosecolor</code><br><br> <code>ChooseColorFromInstance(instance, templatename, *flags)</code><br> <P> Inits a ChooseColor dialog class from a custom template in a dll. <br><br> instance should be the handle to a dll containing the template or a sll loaded with ctypes. templatename its resource identifyer. <br><br> <b>Note</b><br> <b>(!!) This class is currently not tested, so please report any missbehaviour.</b> <br><br> <DL> <DT>'debug' <DD>if the dialog is hooked this will allow for debugging its messages. The message handler will be called with a message 'debug' <br> lp= the message ID<br> wp= formated message as string <br><br> <DT>'debugall' <DD>same as 'debug' but prints out more messages <br><br> </DL> <P> ::folder:: ChooseColor methods ChooseColor dialogs support the following methods:<br><br> ::item:: Run <code>Run(hwnd, *flags, **kwargs)</code><br> Displays the choose color dialog.<br> <P> <DL> <DT>hwnd <DD>The hwnd of the parent window or None <DT>*flags <DD>One or more of the following flags: <br> <TABLE class="table1" BORDER="1"> <TR> <TD>'anycolor'</TD> <TD>displays all available colors in the set of basic colors</TD> </TR> <TR> <TD>'fullopen'</TD> <TD>displays the dialog with the additional control for creating custom colors opend</TD> </TR> <TR> <TD>'preventfullopen'</TD> <TD>disables the 'define custom colors' button</TD> </TR> <TR> <TD>'hook'</TD> <TD>hooks the dialog so you can use it like any other framework dialog</TD> </TR> <TR> <TD>'showhelp'</TD> <TD>shoes the 'Help' button</TD> </TR> <TR> <TD>'solidcolor'</TD> <TD>displays only soloid colors in the set of basic colors</TD> </TR> </TABLE> <DT>kwargs <DD>The following keyword arguments are recognised: <TABLE class="table1" BORDER="1"> <TR> <TD>'customcolors'</TD> <TD>a list of up to 16 ||type-COLORREF|| values to be used as custom colors</TD> </TR> <TR> <TD>'initcolor'</TD> <TD>the ||type-COLORREF|| value to be used as initial color</TD> </TR> </DL> </DL> </P> <br><br> <b>Return value</b><br> the chosen ||type-COLORREF|| value or None if the user canceled the dialog. ::item:: __getitem__ <code>__getitem__(i)</code><br> <P>Retrieves a ||type-COLORREF|| value from the array of custom colors the instance holds. Simple slice notation is supported (step parameter is ignored), indices may not be any higher than 15 </P> ::item:: __setitem__ <code>__setitem__(i, value)</code><br> <P>Sets a ||type-COLORREF|| to the array of custom colors the instance holds. Simple slice notation is supported (step parameter is ignored), indices may not be any higher than 15 </P> ::site:: customizing ChooseColor There are two ways to customize the ChooseColor dialog: <P> <OL> <LI>by hooking it <LI>by passing a custom dialog template to it (with or without hooking) </OL> </P> <H3>hooking</H3> This will subclass the dialog. You can process all messages like for any other dialog. Create controls in response to the onINIT handler play around with the default controls or whatever. <br><br> The rules are like this. If you return 0 from a message handler the systems dialog proc will process the message as usual, if you return 1 it will not. <H3>custom template</H3> You can pass a custom template to the dialog, to be used as template for the dialog. The following table shows the controls the standard dialog hosts. <br><br> In 'wnd/dlgs/templates/openfile.py' you will find the default template for the OpenSaveFile dialog. You can use this template to base your customized template upon. <br><br> <b>Notes</b><br> <OL> <LI>The ids for the controls you will find in <code class=import>wnd.consts.dlgs</code> <LI>the classname for the main-form should not be specifyed in the template <LI>before you start massive typing work, see <i>'wnd/dlgs/templates/choosecolor.py'</I> for a default template of the dialogbox <LI><i>'wnd/dlgs/templates/choosecolor.py'</I> also contains the missing control ids like COLOR_BOX1 and friends <LI> </OL> The ChooseColor dialog contains the following controls: <TABLE class="table1" BORDER="1"> <TH colspan=4>default font used is: 8 (size)</TH> <TR> <TD><b>classname</b></TD> <TD><b>id</b></TD> <TD><b>title</b></TD> <TD><b>size</b></TD> <TD><b>style</b></TD> </TR> <TR> <TD>'MS Shell Dlg' (mainform)</TD> <TD>-</TD> <TD>'Color'</TD> <TD>2, 0, 298, 184</TD> <TD><WS_BORDER | DS_MODALFRAME | WS_CAPTION | WS_POPUP | WS_SYSMENU | DS_3DLOOK | DS_CONTEXTHELP/TD> </TR> <TR> <TD>'static'</TD> <TD>0xFFFFFFFF</TD> <TD>'&Basic colors:'</TD> <TD>4, 4, 140, 9</TD> <TD>SS_SIMPLE | WS_CHILD | WS_TABSTOP | WS_GROUP | SS_LEFT | WS_VISIBLE</TD> </TR> <TR> <TD>'static'</TD> <TD>COLOR_BOX1</TD> <TD>''</TD> <TD>4, 14, 140, 86</TD> <TD>SS_SIMPLE | WS_CHILD | WS_TABSTOP | WS_GROUP | WS_VISIBLE</TD> </TR> <TR> <TD>'static'</TD> <TD>0xFFFFFFFF</TD> <TD>'&Custom colors:'</TD> <TD>4, 106, 140, 9</TD> <TD>SS_LEFT | WS_VISIBLE</TD> </TR> <TR> <TD>'static'</TD> <TD>COLOR_CUSTOM1</TD> <TD>''</TD> <TD>4, 116, 140, 28</TD> <TD>SS_SIMPLE | WS_CHILD | WS_TABSTOP | WS_GROUP | WS_VISIBLE</TD> </TR> <TR> <TD>'button'</TD> <TD>COLOR_MIX</TD> <TD>'&Define Custom Colors >>'</TD> <TD>4, 150, 140, 14</TD> <TD>WS_TABSTOP | WS_GROUP | WS_VISIBLE</TD> </TR> <TR> <TD>'button'</TD> <TD>IDOK</TD> <TD>'OK'</TD> <TD>4, 166, 44, 14</TD> <TD>WS_GROUP | WS_TABSTOP | WS_VISIBLE</TD> </TR> <TR> <TD>'button'</TD> <TD>IDCANCEL</TD> <TD>'Cancel'</TD> <TD>52, 166, 44, 14</TD> <TD>WS_GROUP | WS_TABSTOP | WS_VISIBLE</TD> </TR> <TR> <TD>'button'</TD> <TD>pshHelp</TD> <TD>'&Help'</TD> <TD>100, 166, 44, 14</TD> <TD>WS_GROUP | WS_TABSTOP | WS_VISIBLE</TD> </TR> <TR> <TD>'static'</TD> <TD>COLOR_RAINBOW</TD> <TD>''</TD> <TD>152, 4, 118, 116</TD> <TD>SS_SUNKEN | SS_SIMPLE | WS_VISIBLE</TD> </TR> <TR> <TD>'static'</TD> <TD>COLOR_LUMSCROLL</TD> <TD>''</TD> <TD>280, 4, 8, 116</TD> <TD>SS_SUNKEN | SS_SIMPLE | WS_VISIBLE</TD> </TR> <TR> <TD>'static'</TD> <TD>COLOR_CURRENT</TD> <TD>''</TD> <TD>152, 124, 40, 26</TD> <TD>SS_SUNKEN | SS_SIMPLE | WS_VISIBLE</TD> </TR> <TR> <TD>'button'</TD> <TD>COLOR_SOLID</TD> <TD>'&o'</TD> <TD>100, 166, 44, 14</TD> <TD>WS_GROUP</TD> </TR> <TR> <TD>'static'</TD> <TD>COLOR_SOLID_LEFT</TD> <TD>'Color'</TD> <TD>152, 151, 20, 9</TD> <TD>SS_RIGHT</TD> </TR> <TR> <TD>'static'</TD> <TD>COLOR_SOLID_RIGH</TD> <TD>'|S&olid'</TD> <TD>172, 151, 20, 9</TD> <TD>SS_SUNKEN | SS_SIMPLE | SS_LEFT</TD> </TR> <TR> <TD>'static'</TD> <TD>COLOR_HUEACCEL</TD> <TD>'Hu&e:'</TD> <TD>194, 126, 20, 9</TD> <TD>SS_RIGHT | WS_VISIBLE</TD> </TR> <TR> <TD>'edit'</TD> <TD>COLOR_HUE</TD> <TD>''</TD> <TD>216, 124, 18, 12</TD> <TD>WS_GROUP | WS_TABSTOP | WS_VISIBLE | WS_EX_CLIENTEDGE</TD> </TR> <TR> <TD>'static'</TD> <TD>COLOR_HUEACCEL</TD> <TD>'&Sat:'</TD> <TD>194, 140, 20, 9</TD> <TD>SS_RIGHT | WS_VISIBLE</TD> </TR> <TR> <TD>'edit'</TD> <TD>COLOR_SAT</TD> <TD>''</TD> <TD>216, 124, 18, 12</TD> <TD>WS_GROUP | WS_TABSTOP | WS_VISIBLE | WS_EX_CLIENTEDGE</TD> </TR> <TR> <TD>'static'</TD> <TD>COLOR_LUMACCEL</TD> <TD>'&Lum:'</TD> <TD>194, 154, 20, 9</TD> <TD>SS_RIGHT | WS_VISIBLE</TD> </TR> <TR> <TD>'edit'</TD> <TD>COLOR_LUM</TD> <TD>''</TD> <TD>216, 152, 18, 12</TD> <TD>WS_GROUP | WS_TABSTOP | WS_VISIBLE | WS_EX_CLIENTEDGE</TD> </TR> <TR> <TD>'static'</TD> <TD>COLOR_REDACCEL</TD> <TD>'&Red:'</TD> <TD>243, 126, 24, 9</TD> <TD>SS_RIGHT | WS_VISIBLE</TD> </TR> <TR> <TD>'edit'</TD> <TD>COLOR_RED</TD> <TD>''</TD> <TD>269, 124, 18, 12</TD> <TD>WS_GROUP | WS_TABSTOP | WS_VISIBLE | WS_EX_CLIENTEDGE</TD> </TR> <TR> <TD>'static'</TD> <TD>COLOR_GREENACCEL</TD> <TD>'&Green:'</TD> <TD>243, 140, 24, 9</TD> <TD>SS_RIGHT | WS_VISIBLE</TD> </TR> <TR> <TD>'edit'</TD> <TD>COLOR_GREEN</TD> <TD>''</TD> <TD>269, 138, 18, 12</TD> <TD>WS_GROUP | WS_TABSTOP | WS_EX_CLIENTEDGE</TD> </TR> <TR> <TD>'static'</TD> <TD>COLOR_BLUEACCEL</TD> <TD>'Bl&ue:'</TD> <TD>243, 140, 24, 9</TD> <TD>SS_RIGHT | WS_VISIBLE</TD> </TR> <TR> <TD>'edit'</TD> <TD>COLOR_BLUE</TD> <TD>''</TD> <TD>269, 152, 18, 12</TD> <TD>WS_GROUP | WS_TABSTOP | WS_VISIBLE | WS_EX_CLIENTEDGE</TD> </TR> <TR> <TD>'button'</TD> <TD>COLOR_ADD</TD> <TD>'&Add to Custom Colors'</TD> <TD>152, 166, 142, 14</TD> <TD>WS_GROUP | WS_TABSTOP | WS_VISIBLE</TD> </TR> </TABLE> |