EnglishРусский  

   ..

   addustr.g

   app.g

   btn.g

   btnpic.g

   comp.g

   ctrl.g

   ctrlci.g

   dialogs.g

   dlgbtns.g

   edit.g

   events.g

   fonts.g

   form.g

   gray.g

   grey.g

   header.g

   images.g

   label.g

   labeled.g

   locustr.g

   menu.g

   panel.g

   picture.g

   styles.g

   tab.g

   tabitem.g

   tabpage.g

   timer.g

   toolbar.g

   tray.g

   url.g

   vis.g

   viswin.g

The project is closed! You can look at a new scripting language. It is available on GitHub.
Also, try our open source cross-platform automation software.

Ads

Installer and installation software
Commercial and Freeware installers.

source\lib\vis\styles.g
  1 type Style
  2 {
  3    //str pFontName
  4    //str pFontBold
  5    //str pFontSize
  6    
  7    uint hFont
  8    uint fNewFont
  9    uint hBrush
 10    uint fNewBrush
 11    
 12    uint fTextColor
 13    uint pTextColor
 14    
 15    str  pDescr
 16    //uint FontColor   
 17    //uint bkcolor 
 18 }
 19 
 20 
 21 
 22 type Styles <inherit=hash index=Style>
 23 {
 24 }
 25 
 26 method Styles.oftype( uint ctype )
 27 {
 28    return  
 29 }
 30 
 31 method Styles.init()
 32 {
 33    this->hash.oftype( Style )
 34 }
 35 /*
 36 property ustr Style.FontName<result>()
 37 {
 38 }
 39 
 40 property Style.FontName( ustr name )
 41 {
 42 }
 43 
 44 property uint Style.FontBold()
 45 {
 46 }
 47 
 48 property Style.FontBold( uint val )
 49 {
 50 }*/ 
 51 
 52 /*method Style.SetFont( str descr )
 53 {
 54    gt fgt
 55    fgt.load( descr )
 56    
 57 }*/
 58 
 59 
 60 
 61 
 62 method Style Styles.GetStyle( str name )
 63 {
 64    uint find = this.find(name)
 65    return find->Style
 66    //return this[name]//->Style   
 67 }
 68 
 69 
 70 method Style.Free()
 71 {
 72    if .fNewBrush : DeleteObject( .hBrush )
 73    if .fNewFont : DeleteObject( .hFont )
 74    .hBrush = 0
 75    .hFont = 0
 76    .fNewFont = 0   
 77    .fNewBrush = 0
 78    .pTextColor = 0
 79    .fTextColor = 0
 80 }
 81 
 82 method Style.delete()
 83 {
 84    .Free()  
 85 }
 86 
 87 method Style.Update( )
 88 {
 89    .Free() 
 90    gt dgt
 91    dgt.root().load( .pDescr )
 92    str  attrib
 93    uint istyle as dgt.root().findrel("/style")
 94    if &istyle && 
 95       uint( istyle.get( "ver", "" ) ) ==  1
 96    {
 97       uint ibrush as istyle.findrel( "/brush" )
 98       if &ibrush 
 99       {            
100          if *ibrush.get( "color", attrib )
101          {
102             if "".substr( attrib, 0, 9 ) == "syscolor_"
103             {
104                .hBrush = GetSysColorBrush( uint( "".substr( attrib, 9, *attrib - 9 ) ))// + 1                                
105             }
106             else
107             {
108                LOGBRUSH lb
109                lb.lbStyle = 0//$BS_SOLID
110                lb.lbColor = uint( attrib )
111                lb.lbHatch = 0               
112                .hBrush = CreateBrushIndirect( lb )
113                .fNewBrush = 1                              
114             }
115             /*switch attrib
116             {
117                case "SCROLLBAR"         = 0
118                case "BACKGROUND"        = 1
119                case "ACTIVECAPTION"     = 2
120                case "INACTIVECAPTION"   = 3
121                case "MENU"              = 4
122                case "WINDOW"            = 5
123                case "WINDOWFRAME"       = 6
124                case "MENUTEXT"          = 7
125                case "WINDOWTEXT"        = 8
126                case "CAPTIONTEXT"       = 9
127                case "ACTIVEBORDER"      = 10
128                case "INACTIVEBORDER"    = 11
129                case "APPWORKSPACE"      = 12
130                case "HIGHLIGHT"         = 13
131                case "HIGHLIGHTTEXT"     = 14
132                case "BTNFACE"           = 15
133                case "BTNSHADOW"         = 16
134                case "GRAYTEXT"          = 17
135                case "BTNTEXT"           = 18
136                case "INACTIVECAPTIONTEXT" = 19
137                case "BTNHIGHLIGHT"      = 20
138                default
139                {
140                   uint color = uint( attrib )
141                } 
142             }*/
143          }
144       }
145       
146       uint itext as istyle.findrel( "/text" )
147       if &itext
148       {      
149          if *itext.get( "color", attrib )
150          {
151             .fTextColor = 1
152             if "".substr( attrib, 0, 9 ) == "syscolor_"
153             {               
154                //.hTextColor = uint( "".substr( attrib, 9, *attrib - 9 ) )
155                .pTextColor = GetSysColor( uint( "".substr( attrib, 9, *attrib - 9 ) ) )                              
156             }
157             else
158             {               
159                //.hTextColor = 0x1000               
160                .pTextColor = uint( attrib )                              
161             }            
162          }         
163       }
164       uint ifont as istyle.findrel( "/font" )
165       if &ifont
166       {
167          LOGFONT lf         
168          GetObject( GetStockObject( $DEFAULT_GUI_FONT ), sizeof( LOGFONT ), &lf )
169          if *ifont.get( "name", attrib )
170          {                     
171             if *attrib > 63 : attrib.setlen( 63 )
172             mcopy( &lf.lfFaceName, attrib.ptr(), *attrib )             
173          }
174          if *ifont.get( "size", attrib )
175          {            
176             if attrib[0] ==  '+' || attrib[1] ==  '-'
177             {
178                lf.lfHeight -=  int( attrib )
179             }
180             else
181             {
182                lf.lfHeight =  int( attrib )
183             }             
184          }
185          if *ifont.get( "bold", attrib )
186          {         
187             lf.lfWeight =  ?( uint( attrib ), 800, 400 )
188          }   
189          if *ifont.get( "underline", attrib ) 
190          {
191             lf.lfUnderline =  uint( attrib ) 
192          }
193          if *ifont.get( "italic", attrib ) 
194          {
195             lf.lfItalic =  uint( attrib )
196          }
197          if *ifont.get( "strikeout", attrib ) 
198          {
199             lf.lfUnderline =  uint( attrib ) 
200          }
201          .hFont =  CreateFontIndirect( lf )
202          .fNewFont = 1  
203       }
204    }
205 }
206 
207 
208 method Style Styles.AddStyle( str name, str descr )
209 {
210    uint s as this[name]
211    s.pDescr = descr   
212    s.Update()
213    return s     
214 }
215 
216 method Styles.Update()
217 {
218    foreach s, this
219    {
220       s.Update()
221    }
222 }