Click here to Skip to main content
15,893,588 members
Articles / Containers / Virtual Machine

TOOL

Rate me:
Please Sign up or sign in to vote.
4.98/5 (52 votes)
23 Oct 200676 min read 231K   5.4K   147  
TOOL (Tiny Object Oriented Language) is an easily-embedded, object-oriented, C++-like-language interpreter. The purpose of this article is to introduce the TOOL interpreter and language from the perspective of a person who has a desire to include a scripting solution as part of his project.
#ifndef XML_STYLE_DECODER_H_INCLUDED
#define XML_STYLE_DECODER_H_INCLUDED
/*****************************************************************************/
/*                              HEADER FILE                                  */
/*****************************************************************************/
/*
          $Archive:   $

         $Revision:   $

      Last Checkin:
             $Date:   $
                By:
           $Author:   $

 Last Modification:
          $ModTime:   $

       Description:   A set of static methods that decode a window style string
                      into window style value

                      TOOL And XML FORMS License
                      ==========================

                      Except where otherwise noted, all of the documentation 
                      and software included in the TOOL package is 
                      copyrighted by Michael Swartzendruber.

                      Copyright (C) 2005 Michael John Swartzendruber. 
                      All rights reserved.

                      Access to this code, whether intentional or accidental,
                      does NOT IMPLY any transfer of rights.

                      This software is provided "as-is," without any express 
                      or implied warranty. In no event shall the author be held
                      liable for any damages arising from the use of this software.

                      Permission is granted to anyone to use this software for 
                      any purpose, including commercial applications, and to 
                      alter and redistribute it, provided that the following 
                      conditions are met:

                      1. All redistributions of source code files must retain 
                         all copyright notices that are currently in place, 
                         and this list of conditions without modification.

                      2. The origin of this software must not be misrepresented;
                         you must not claim that you wrote the original software.

                      3. If you use this software in another product, an acknowledgment
                         in the product documentation would be appreciated but is
                         not required.

                      4. Modified versions in source or binary form must be plainly 
                         marked as such, and must not be misrepresented as being 
                         the original software.
*/
/*****************************************************************************/
/*
///////////////////////////////////////////////////////////////////////////////
//
// NOTE: The following styles are not supported in the XML Forms system
===============================================================================
  WS_BORDER
  WS_THICKFRAME
  reason: not really needed in this application
===============================================================================
  WS_DISABLED
  WS_POPUP
  WS_POPUPWINDOW
  WS_OVERLAPPED
  WS_OVERLAPPEDWINDOW
  reason: dont want to support these styles
===============================================================================
  WS_TABSTOP
  reason: dont need this cuz we do our own tab management
===============================================================================
  WS_EX_LEFT
  WS_EX_RIGHTSCROLLBAR
  WS_EX_LTRREADING
  reason: not required to handle cuz these are default
===============================================================================
  WS_EX_ACCEPTFILES
  WS_EX_CONTEXTHELP
  WS_EX_LEFTSCROLLBAR
  WS_EX_TRANSPARENT
  WS_EX_MDICHILD
  WS_EX_RIGHT
  WS_EX_RTLREADING
  WS_EX_OVERLAPPEDWINDOW
  WS_EX_PALETTEWINDOW
  WS_EX_NOPARENTNOTIFY
  reason: dont want to support these extended styles
===============================================================================
  LBS_EXTENDEDSEL
  LBS_MULTICOLUMN
  LBS_OWNERDRAWFIXED
  LBS_OWNERDRAWVARIABLE
  LBS_USETABSTOPS
  LBS_WANTKEYBOARDINPUT
  LBS_NOREDRAW
  LBS_NOTIFY
  reason: not really needed in this application
===============================================================================
//
///////////////////////////////////////////////////////////////////////////////
*/

#include <string>
#include "XMLFormCoreStructures.h"

//using namespace std;
#pragma warning( disable : 4786 )


class CXMLStyleDecoder
{
public:
  static DWORD DecodeFrameStyle( std::string oStyle );
  static DWORD DecodeCtrlStyle( std::string oStyle, P_FORM_CONTROL pxCtrl = NULL );

  static DWORD DecodeFrameExStyle( std::string oStyle );
  static DWORD DecodeCtrlExStyle( std::string oStyle );
};

///////////////////////////////////////////////////////////////////////////////
//
//
// set up values for the window styles supported in the XML forms system
//
const char ccWS_GROUP[]         = "WS_GROUP";            // the first control of a group of controls in which the user 
                                                         //   can move from one control to the next with the arrow keys. 
                                                         //   All controls defined with the WS_GROUP style FALSE after the 
                                                         //   first control belong to the same group. The next control with 
                                                         //   the WS_GROUP style starts the next group (that is, one group 
                                                         //   ends where the next begins).
const char ccWS_HSCROLL[]       = "WS_HSCROLL";          // has a horizontal scroll bar.
const char ccWS_VSCROLL[]       = "WS_VSCROLL";          // has a vertical scroll bar. 
const char ccWS_DLGFRAME[]      = "WS_DLGFRAME";         // double border but no title.
const char ccWS_MAXIMIZEBOX[]   = "WS_MAXIMIZEBOX";      // has a Maximize button.
const char ccWS_MINIMIZEBOX[]   = "WS_MINIMIZEBOX";      // has a Minimize button.
const char ccWS_SYSMENU[]       = "WS_SYSMENU";          // has a Control-menu box in its title bar. Used only for windows with title bars.
const char ccWS_EX_STATICEDGE[] = "WS_EX_STATICEDGE";    // has a three-dimensional border style 
                                                         //   intended to be used for items that do not accept user input.
const char ccWS_EX_CLIENTEDGE[] = "WS_EX_CLIENTEDGE";    // has a 3D look -- that is, a border with a sunken edge.
const char ccWS_EX_WINDOWEDGE[] = "WS_EX_WINDOWEDGE";    // has a border with a raised edge. 


const char ccWS_CAPTION[]       = "WS_CAPTION";
const char ccWS_MAXIMIZE[]      = "WS_MAXIMIZE";
const char ccWS_MINIMIZE[]      = "WS_MINIMIZE";


///////////////////////////////////////////////////////////////////////////////
//
// button styles
//
const char ccBS_AUTOCHECKBOX[]    = "BS_AUTOCHECKBOX";
const char ccBS_CHECKBOX[]        = "BS_CHECKBOX";
const char ccBS_AUTORADIOBUTTON[] = "BS_AUTORADIOBUTTON";
const char ccBS_RADIOBUTTON[]     = "BS_RADIOBUTTON";
const char ccBS_GROUPBOX[]        = "BS_GROUPBOX";
const char ccBS_PUSHBUTTON[]      = "BS_PUSHBUTTON";
const char ccBS_DEFPUSHBUTTON[]   = "BS_DEFPUSHBUTTON";

/*
  button styles not supported by the xml forms system
  BS_LEFTTEXT
  BS_OWNERDRAW
  BS_3STATE
  BS_AUTO3STATE
*/

///////////////////////////////////////////////////////////////////////////////
//
// edit styles
//
const char ccES_AUTOHSCROLL[] = "ES_AUTOHSCROLL";
const char ccES_AUTOVSCROLL[] = "ES_AUTOVSCROLL";
const char ccES_CENTER[]      = "ES_CENTER";
const char ccES_LEFT[]        = "ES_LEFT";
const char ccES_LOWERCASE[]   = "ES_LOWERCASE";
const char ccES_MULTILINE[]   = "ES_MULTILINE";
const char ccES_NOHIDESEL[]   = "ES_NOHIDESEL";
const char ccES_OEMCONVERT[]  = "ES_OEMCONVERT";
const char ccES_PASSWORD[]    = "ES_PASSWORD";
const char ccES_RIGHT[]       = "ES_RIGHT";
const char ccES_UPPERCASE[]   = "ES_UPPERCASE";
const char ccES_READONLY[]    = "ES_READONLY";
const char ccES_WANTRETURN[]  = "ES_WANTRETURN";

///////////////////////////////////////////////////////////////////////////////
//
// static styles
//
const char ccSS_BLACKFRAME[]     = "SS_BLACKFRAME";
const char ccSS_WHITEFRAME[]     = "SS_WHITEFRAME";
const char ccSS_GRAYFRAME[]      = "SS_GRAYFRAME";
const char ccSS_BLACKRECT[]      = "SS_BLACKRECT";
const char ccSS_GRAYRECT[]       = "SS_GRAYRECT";
const char ccSS_WHITERECT[]      = "SS_WHITERECT";
const char ccSS_CENTER[]         = "SS_CENTER";
const char ccSS_LEFT[]           = "SS_LEFT";
const char ccSS_RIGHT[]          = "SS_RIGHT";
const char ccSS_LEFTNOWORDWRAP[] = "SS_LEFTNOWORDWRAP";
const char ccSS_NOPREFIX[]       = "SS_LEFTNOWORDWRAP";
const char ccSS_SIMPLE[]         = "SS_SIMPLE";

/*
  static styles not supported by the xml forms system
  SS_USERITEM
  SS_ICON
*/

///////////////////////////////////////////////////////////////////////////////
//
// listbox control styles
//
const char ccLBS_HASSTRINGS[]       = "LBS_HASSTRINGS"; 
const char ccLBS_MULTIPLESEL[]      = "LBS_MULTIPLESEL";
const char ccLBS_NOINTEGRALHEIGHT[] = "LBS_NOINTEGRALHEIGHT";
const char ccLBS_SORT[]             = "LBS_SORT";
const char ccLBS_STANDARD[]         = "LBS_STANDARD";
const char ccLBS_DISABLENOSCROLL[]  = "LBS_DISABLENOSCROLL";

      


///////////////////////////////////////////////////////////////////////////////
//
// tree control styles
//
const char ccTVS_HASLINES[]      = "TVS_HASLINES";
const char ccTVS_LINESATROOT[]   = "TVS_LINESATROOT";
const char ccTVS_HASBUTTONS[]    = "TVS_HASBUTTONS";
const char ccTVS_SHOWSELALWAYS[] = "TVS_SHOWSELALWAYS";
const char ccTVS_SINGLEEXPAND[]  = "TVS_SINGLEEXPAND";

/*
  xml form does not support editable trees
  TVS_EDITLABELS

 the following styles will be stamped on all trees by default

  TVS_NOTOOLTIPS
  TVS_DISABLEDRAGDROP
*/

///////////////////////////////////////////////////////////////////////////////
//
// list control styles
//
const char ccLVS_LIST[]            = "LVS_LIST";
const char ccLVS_REPORT[]          = "LVS_REPORT";
const char ccLVS_NOCOLUMNHEADER[]  = "LVS_NOCOLUMNHEADER";
const char ccLVS_NOSORTHEADER[]    = "LVS_NOSORTHEADER";
const char ccLVS_SHOWSELALWAYS[]   = "LVS_SHOWSELALWAYS";
const char ccLVS_SINGLESEL[]       = "LVS_SINGLESEL";
const char ccLVS_SORTASCENDING[]   = "LVS_SORTASCENDING";
const char ccLVS_SORTDESCENDING[]  = "LVS_SORTDESCENDING";

/*
  xml form does not support editable or ownerdrawn lists
  LVS_EDITLABELS
  LVS_OWNERDRAWFIXED

  xml forms do not support images lists. Because: how would they specified?
  LVS_SHAREIMAGELISTS

  xml forms do not support icon or small icon lists. Because: how would the icons be specified?
  LVS_ICON
  LVS_SMALLICON

  since xml forms do not support icon lists, the following styles are not needed
  LVS_ALIGNLEFT
  LVS_ALIGNTOP
  LVS_AUTOARRANGE
  LVS_NOLABELWRAP

  no scrolling does not seem like a reasonable constraint
  LVS_NOSCROLL
*/

///////////////////////////////////////////////////////////////////////////////
//
// slider control
//
const char ccTBS_HORZ[]           = "TBS_HORZ";
const char ccTBS_VERT[]           = "TBS_VERT";
const char ccTBS_AUTOTICKS[]      = "TBS_AUTOTICKS";
const char ccTBS_NOTICKS[]        = "TBS_NOTICKS";
const char ccTBS_BOTTOM[]         = "TBS_BOTTOM";
const char ccTBS_TOP[]            = "TBS_TOP";
const char ccTBS_RIGHT[]          = "TBS_RIGHT";
const char ccTBS_LEFT[]           = "TBS_LEFT";
const char ccTBS_BOTH[]           = "TBS_BOTH";
const char ccTBS_ENABLESELRANGE[] = "TBS_ENABLESELRANGE";


///////////////////////////////////////////////////////////////////////////////
//
// date time picker styles
//
/*
const char ccDTS_APPCANPARSE[] = ""; // Allows the owner to parse user input and take necessary action. It enables users to edit within the client area of the control when they press the F2 key. The control sends DTN_USERSTRING notification messages when users are finished. 
const char ccDTS_LONGDATEFORMAT[] = ""; // Displays the date in long format. The default format string for this style is defined by LOCALE_SLONGDATEFORMAT, which produces output like "Friday, April 19, 1996". 
const char ccDTS_RIGHTALIGN[] = ""; // The drop-down month calendar will be right-aligned with the control instead of left-aligned, which is the default.  
const char ccDTS_SHOWNONE[] = ""; // It is possible to have no date currently selected in the control. With this style, the control displays a check box that users can check once they have entered or selected a date. Until this check box is checked, the application will not be able to retrieve the date from the control because, in essence, the control has no date. This state can be set with the DTM_SETSYSTEMTIME message or queried with the DTM_GETSYSTEMTIME message. 
const char ccDTS_SHORTDATEFORMAT[] = ""; // Displays the date in short format. The default format string for this style is defined by LOCALE_SSHORTDATE, which produces output like "4/19/96". 
const char ccDTS_SHORTDATECENTURYFORMAT[] = ""; // Version 5.80. Similar to the DTS_SHORTDATEFORMAT style, except the year is a four-digit field. The default format string for this style is based on LOCALE_SSHORTDATE. The output looks like: "4/19/1996". 
const char ccDTS_TIMEFORMAT[] = ""; // Displays the time. The default format string for this style is defined by LOCALE_STIMEFORMAT, which produces output like "5:31:42 PM". 
const char ccDTS_UPDOWN[] = ""; // Places an up-down control to the right of the DTP control to modify date-time values. This style can be used in place of the drop-down month calendar, which is the default style. 
*/

///////////////////////////////////////////////////////////////////////////////
//
// month calendar styles
//
/*
const char ccMCS_DAYSTATE[] = ""; // 
Version 4.70. The month calendar will send MCN_GETDAYSTATE notifications to request information about which days should be displayed in bold. For more information about supporting this style, see Processing the MCN_GETDAYSTATE Notification Message. 
const char ccMCS_MULTISELECT[] = ""; // 
Version 4.70. The month calendar will allow the user to select a range of dates within the control. By default, the maximum range is one week. You can change the maximum range that can be selected by using the MCM_SETMAXSELCOUNT message. 
const char ccMCS_NOTODAY[] = ""; // 
Version 4.70. The month calendar control will not display the "today" date at the bottom of the control. 
const char ccMCS_NOTODAYCIRCLE[] = ""; // 
Version 4.70. The month calendar control will not circle the "today" date. 
const char ccMCS_WEEKNUMBERS[] = ""; // 
Version 4.70. The month calendar control will display week numbers (1-52) to the left of each row of days. Week 1 is defined as the first week that contains at least four days. 
*/

///////////////////////////////////////////////////////////////////////////////
//
// spin button styles
//
const char ccUDS_HORZ[]        = "UDS_HORZ";
const char ccUDS_ALIGNLEFT[]   = "UDS_ALIGNLEFT";
const char ccUDS_ALIGNRIGHT[]  = "UDS_ALIGNRIGHT";
const char ccUDS_SETBUDDYINT[] = "UDS_SETBUDDYINT";
const char ccUDS_NOTHOUSANDS[] = "UDS_NOTHOUSANDS";
const char ccUDS_WRAP[]        = "UDS_WRAP";
const char ccUDS_ARROWKEYS[]   = "UDS_ARROWKEYS";

/*
  not supported because the buddy is explicit in xml forms
  UDS_AUTOBUDDY
*/

///////////////////////////////////////////////////////////////////////////////
//
// image styles
//
const char ccIMAGE_IS_ICON[]       = "IMAGE_IS_ICON";
const char ccIMAGE_IS_BMP[]        = "IMAGE_IS_BMP";




#endif


/*****************************************************************************/
/* Check-in history 
   $WorkFile:   $
    $Archive:   $

 *$Log:   $
*/
/*****************************************************************************/


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions