Module: _pushbtn      Library: Clipper 5.3


This module contains the following functions and procedures:



Note: Because this is raw decompiler output, the code is closer
to that seen in a .PPO file, rather than a .PRG file. In other
words, you must allow for the preprocessor conversions normally 
performed based on the contents of STD.CH and other .CH files
 
#include "common.ch"
#include "inkey.ch"

//-----------------------------------------------------------------
//  file-wide static variables
//
static Static1

//---------------------------------------------------[top]-
//  DEFINE
//
static function DEFINE

   local Local1 := __classnew("PUSHBUTTON", 19)
   __classadd(Local1, "Display", "__pbDisplay")
   __classadd(Local1, "HitTest", "__pbHitTest")
   __classadd(Local1, "KillFocus", "__pbKillFocus")
   __classadd(Local1, "Select", "__pbSelect")
   __classadd(Local1, "SetFocus", "__pbSetFocus")
   __classadd(Local1, "Buffer", "__pbBuffer")
   __classadd(Local1, "_Buffer", "__pbBuffer")
   __classadd(Local1, "Caption", "__pbCaption")
   __classadd(Local1, "_Caption", "__pbCaption")
   __classadd(Local1, "Cargo", "__pbCargo")
   __classadd(Local1, "_Cargo", "__pbCargo")
   __classadd(Local1, "Col", "__pbCol")
   __classadd(Local1, "_Col", "__pbCol")
   __classadd(Local1, "ColorSpec", "__pbColorSpec")
   __classadd(Local1, "_ColorSpec", "__pbColorSpec")
   __classadd(Local1, "fBlock", "__pbfBlock")
   __classadd(Local1, "_fBlock", "__pbfBlock")
   __classadd(Local1, "HasFocus", "__pbHasFocus")
   __classadd(Local1, "_HasFocus", "__pbHasFocus")
   __classadd(Local1, "Message", "__pbMessage")
   __classadd(Local1, "_Message", "__pbMessage")
   __classadd(Local1, "Row", "__pbRow")
   __classadd(Local1, "_Row", "__pbRow")
   __classadd(Local1, "sBlock", "__pbsBlock")
   __classadd(Local1, "_sBlock", "__pbsBlock")
   __classadd(Local1, "Style", "__pbStyle")
   __classadd(Local1, "_Style", "__pbStyle")
   __classadd(Local1, "TypeOut", "__pbTypeOut")
   __classadd(Local1, "_TypeOut", "__pbTypeOut")
   __classadd(Local1, "SizeX", "__pbSizeX")
   __classadd(Local1, "_SizeX", "__pbSizeX")
   __classadd(Local1, "SizeY", "__pbSizeY")
   __classadd(Local1, "_SizeY", "__pbSizeY")
   __classadd(Local1, "CapXOff", "__pbCapXOff")
   __classadd(Local1, "_CapXOff", "__pbCapXOff")
   __classadd(Local1, "CapYOff", "__pbCapYOff")
   __classadd(Local1, "_CapYOff", "__pbCapYOff")
   __classadd(Local1, "Bitmap", "__pbBitmap")
   __classadd(Local1, "_Bitmap", "__pbBitmap")
   __classadd(Local1, "BmpXOff", "__pbBmpXOff")
   __classadd(Local1, "_BmpXOff", "__pbBmpXOff")
   __classadd(Local1, "BmpYOff", "__pbBmpYOff")
   __classadd(Local1, "_BmpYOff", "__pbBmpYOff")
   return Local1

//---------------------------------------------------[top]-
//  PUSHBUTTON( Arg1, Arg2, Arg3 )
//
function PUSHBUTTON( Arg1, Arg2, Arg3 )

   local Local1, Local2
   if ( !( ISNUMBER( Arg1 ) ) )
      Local1 := Nil
   elseif ( !( ISNUMBER( Arg2 ) ) )
      Local1 := Nil
   else
      if ( ValType(Static1) != "N" )
         Static1 := define()
      endif
      if ( !( ISCHARACTER( Arg3 ) ) )
         Arg3 := ""
      endif
      Local1 := __classins(Static1)
      Local1[ 1 ] := .F.
      Local1[ 2 ] := Arg3
      Local1[ 3 ] := Nil
      Local1[ 4 ] := Arg2
      Local1[ 6 ] := Nil
      Local1[ 10 ] := Nil
      Local1[ 7 ] := .F.
      Local1[ 8 ] := ""
      Local1[ 9 ] := Arg1
      Local1[ 11 ] := Nil
      Local1[ 12 ] := "<>"
      if ( isdefcolor() )
         if ( !_isgraphic() )
            Local1[ 5 ] := "W/N,N/W,W+/N,W+/N"
         else
            Local1[ 5 ] := "W,W,W,W+,N"
         endif
      else
         Local2 := SetColor()
         Local1[ 5 ] := __guicolor(Local2, 5) + "," + ;
            __guicolor(Local2, 2) + "," + __guicolor(Local2, 1) + ;
            "," + __guicolor(Local2, 4)
      endif
      Local1[ 13 ] := 0
      Local1[ 14 ] := 0
      Local1[ 15 ] := -1
      Local1[ 16 ] := -1
      Local1[ 17 ] := ""
      Local1[ 18 ] := -1
      Local1[ 19 ] := -1
   endif
   return Local1

//---------------------------------------------------[top]-
//  __PBBITMAP( Arg1 )
//
function __PBBITMAP( Arg1 )

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 17 ] := _einstvar(qself(), "BITMAP", Arg1, "C", 1001)
   endif
   return qself()[ 17 ]

//---------------------------------------------------[top]-
//  __PBBMPXOF( Arg1 )
//
function __PBBMPXOF( Arg1 )

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 18 ] := _einstvar(qself(), "BMPXOFF", Arg1, "N", 1001)
   endif
   return qself()[ 18 ]

//---------------------------------------------------[top]-
//  __PBBMPYOF( Arg1 )
//
function __PBBMPYOF( Arg1 )

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 19 ] := _einstvar(qself(), "BMPYOFF", Arg1, "N", 1001)
   endif
   return qself()[ 19 ]

//---------------------------------------------------[top]-
//  __PBBUFFER
//
function __PBBUFFER

   return qself()[ 1 ]

//---------------------------------------------------[top]-
//  __PBCAPTIO( Arg1 )
//
function __PBCAPTIO( Arg1 )

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 2 ] := _einstvar(qself(), "CAPTION", Arg1, "C", 1001)
   endif
   return qself()[ 2 ]

//---------------------------------------------------[top]-
//  __PBCAPXOF( Arg1 )
//
function __PBCAPXOF( Arg1 )

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 15 ] := _einstvar(qself(), "CAPXOFF", Arg1, "N", 1001)
   endif
   return qself()[ 15 ]

//---------------------------------------------------[top]-
//  __PBCAPYOF( Arg1 )
//
function __PBCAPYOF( Arg1 )

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 16 ] := _einstvar(qself(), "CAPYOFF", Arg1, "N", 1001)
   endif
   return qself()[ 16 ]

//---------------------------------------------------[top]-
//  __PBCARGO( Arg1 )
//
function __PBCARGO( Arg1 )

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 3 ] := Arg1
   endif
   return qself()[ 3 ]

//---------------------------------------------------[top]-
//  __PBCOL( Arg1 )
//
function __PBCOL( Arg1 )

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 4 ] := _einstvar(qself(), "COL", Arg1, "N", 1001)
   endif
   return qself()[ 4 ]

//---------------------------------------------------[top]-
//  __PBCOLORS( Arg1 )
//
function __PBCOLORS( Arg1 )

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 5 ] := _einstvar(qself(), "COLORSPEC", Arg1, "C", ;
         1001, { |_1, _2| !Empty(__guicolor(Arg1, 4)) .AND. ;
         Empty(__guicolor(Arg1, 6)) })
   endif
   return qself()[ 5 ]

//---------------------------------------------------[top]-
//  __PBDISPLA
//
function __PBDISPLA

   local Local1 := SetColor(), Local2, Local3, Local4, Local5, ;
      Local6, Local7 := Row(), Local8:= Col(), Local9, Local10, ;
      Local11, Local12, Local13, Local14, Local15, Local16, Local17, ;
      Local18, Local19, Local20, Local21, Local22, Local23, Local24, ;
      Local25, Local26, Local27
   Local4 := qself()[ 12 ]
   Local26 := msetcursor(.F.)
   dispbegin()
   if ( qself()[ 1 ] )
      set color to (__guicolor(qself()[ 5 ], 3))
      Local11 := __guicolor(qself()[ 5 ], 4)
      if ( Len(Local11) == 0 )
         Local13 := 0
      else
         Local13 := _getnumcol(Local11)
      endif
   elseif ( qself()[ 7 ] )
      set color to (__guicolor(qself()[ 5 ], 2))
      Local11 := __guicolor(qself()[ 5 ], 4)
      if ( Len(Local11) == 0 )
         Local13 := 0
      else
         Local13 := _getnumcol(Local11)
      endif
   else
      set color to (__guicolor(qself()[ 5 ], 1))
      Local11 := __guicolor(qself()[ 5 ], 4)
      if ( Len(Local11) == 0 )
         Local13 := 0
      else
         Local13 := _getnumcol(Local11)
      endif
   endif
   Local9 := qself()[ 9 ]
   Local5 := qself()[ 4 ]
   Local6 := qself()[ 2 ]
   if ( ( Local10 := At("&", Local6) ) == 0 )
   elseif ( Local10 == Len(Local6) )
      Local10 := 0
   else
      Local6 := stuff(Local6, Local10, 1, "")
   endif
   if ( !Empty(Local4) )
      Local5++
      if ( !_isgraphic() )
         if ( Len(Local4) == 2 )
            SetPos(qself()[ 9 ], qself()[ 4 ])
            ?? SubStr(Local4, 1, 1)
            SetPos(qself()[ 9 ], qself()[ 4 ] + Len(Local6) + 1)
            ?? SubStr(Local4, 2, 1)
         else
            Local9++
            @ qself()[ 9 ], qself()[ 4 ], qself()[ 9 ] + 2, ;
               qself()[ 4 ] + Len(Local6) + 1 box Local4
         endif
      else
         if ( qself()[ 7 ] )
            Local12 := 2
            Local14 := _getnumcol(__guicolor(qself()[ 5 ], 2))
         else
            Local12 := 1
            Local14 := _getnumcol(__guicolor(qself()[ 5 ], 1))
         endif
         if ( qself()[ 1 ] )
            Local19 := 15
            Local20 := 8
         else
            Local19 := 8
            Local20 := 15
         endif
         Local27 := gmode()[ 5 ]
         Local15 := qself()[ 4 ] * 8
         Local16 := qself()[ 9 ] * Local27
         if ( qself()[ 13 ] > 0 .AND. qself()[ 14 ] > 0 )
            Local17 := Local15 + qself()[ 13 ]
            Local18 := Local16 + qself()[ 14 ]
         else
            Local17 := ( qself()[ 4 ] + Len(Local6) + 1 ) * 8 + 4
            Local18 := ( qself()[ 9 ] + 1 ) * Local27
         endif
         gframe(Local15, Local16, Local17, Local18, Local14, ;
            Local19, Local20, 1, 1, Local12, Local12, -1, .T.)
      endif
   endif
   if ( qself()[ 1 ] )
      Local21 := 1
   else
      Local21 := 0
   endif
   if ( _isgraphic() .AND. Len(qself()[ 17 ]) > 0 )
      Local22 := gbmpload(qself()[ 17 ])
      if ( ISNIL( Local22 ) )
      elseif ( !( ISNIL( Local22[ 1 ] ) ) .AND. !( ISNIL( ;
            Local22[ 2 ] ) ) )
         Local27 := gmode()[ 5 ]
         if ( qself()[ 18 ] >= 0 .AND. qself()[ 19 ] >= 0 )
            Local23 := qself()[ 4 ] * 8 + qself()[ 18 ] + Local21
            Local24 := qself()[ 9 ] * Local27 + qself()[ 19 ] + Local21
         else
            Local23 := qself()[ 4 ] * 8 + 1 + Local21
            Local24 := qself()[ 9 ] * Local27 + 1 + Local21
         endif
         gbmpdisp(Local22, Local23, Local24)
      endif
   endif
   if ( !Empty(Local6) )
      if ( !_isgraphic() )
         SetPos(Local9, Local5)
         ?? Local6
         if ( Local10 != 0 )
            set color to (Local11)
            SetPos(Local9, Local5 + Local10 - 1)
            ?? SubStr(Local6, Local10, 1)
         endif
      else
         Local27 := gmode()[ 5 ]
         if ( qself()[ 15 ] >= 0 .AND. qself()[ 16 ] >= 0 )
            Local15 := qself()[ 4 ] * 8 + qself()[ 15 ] + Local21
            Local16 := qself()[ 9 ] * Local27 + qself()[ 16 ] + Local21
         elseif ( qself()[ 13 ] > 0 .AND. qself()[ 14 ] > 0 )
            Local15 := qself()[ 4 ] * 8 + Int(qself()[ 13 ] / 2) - ;
               Int(Len(Local6) / 2) * 8 + Local21
            Local16 := qself()[ 9 ] * Local27 + Int(qself()[ 14 ] / ;
               2) - 7 + Local21
         else
            Local15 := Local5 * 8 + Local21
            Local16 := Local9 * Local27 + Local21
         endif
         Local25 := _getnumcol(__guicolor(qself()[ 5 ], 5))
         gwriteat(Local15, Local16, Local6, Local25, -1)
         if ( Local10 != 0 )
            gwriteat(Local15 + ( Local10 - 1 ) * 8, Local16, ;
               SubStr(Local6, Local10, 1), Local13, -1)
         endif
      endif
   endif
   dispend()
   msetcursor(Local26)
   set color to (Local1)
   SetPos(Local7, Local8)
   return qself()

//---------------------------------------------------[top]-
//  __PBFBLOCK( Arg1 )
//
function __PBFBLOCK( Arg1 )

   if ( PCount() == 0 )
   elseif ( ISNIL( Arg1 ) )
      qself()[ 6 ] := Arg1
   else
      qself()[ 6 ] := _einstvar(qself(), "FBLOCK", Arg1, "B", 1001)
   endif
   return qself()[ 6 ]

//---------------------------------------------------[top]-
//  __PBHASFOC
//
function __PBHASFOC

   return qself()[ 7 ]

//---------------------------------------------------[top]-
//  __PBHITTES( Arg1, Arg2 )
//
function __PBHITTES( Arg1, Arg2 )

   local Local1 := 1, Local2:= Len(qself()[ 2 ]), Local3, Local4, ;
      Local5, Local6
   if ( ( Local4 := At("&", qself()[ 2 ]) ) == 0 )
   elseif ( Local4 < Local2 )
      Local2--
   endif
   if ( ( Local3 := Len(qself()[ 12 ]) ) == 2 )
      Local2 := Local2 + 2
   elseif ( Local3 == 8 )
      Local1 := 3
      Local2 := Local2 + 2
   endif
   Local5 := _isgraphic()
   if ( Local5 .AND. qself()[ 13 ] != 0 )
      Local2 := Round(qself()[ 13 ] / 8, 0)
   endif
   if ( Local5 .AND. qself()[ 14 ] != 0 )
      Local1 := Round(qself()[ 14 ] / gmode()[ 5 ], 0)
   elseif ( Local5 )
      Local1 := 1
   endif
   do case
   case Arg1 < qself()[ 9 ]
   case Arg2 < qself()[ 4 ]
   case Arg1 >= qself()[ 9 ] + Local1
   case Arg2 < qself()[ 4 ] + Local2
      return -2049
   endcase
   return 0

//---------------------------------------------------[top]-
//  __PBKILLFO
//
function __PBKILLFO

   if ( qself()[ 7 ] )
      qself()[ 7 ] := .F.
      if ( ISBLOCK( qself()[ 6 ] ) )
         eval(qself()[ 6 ])
      endif
      qself():display()
      setcursor(qself()[ 11 ])
   endif
   return qself()

//---------------------------------------------------[top]-
//  __PBMESSAG( Arg1 )
//
function __PBMESSAG( Arg1 )

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 8 ] := _einstvar(qself(), "MESSAGE", Arg1, "C", 1001)
   endif
   return qself()[ 8 ]

//---------------------------------------------------[top]-
//  __PBROW( Arg1 )
//
function __PBROW( Arg1 )

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 9 ] := _einstvar(qself(), "ROW", Arg1, "N", 1001)
   endif
   return qself()[ 9 ]

//---------------------------------------------------[top]-
//  __PBSBLOCK( Arg1 )
//
function __PBSBLOCK( Arg1 )

   if ( PCount() == 0 )
   elseif ( ISNIL( Arg1 ) )
      qself()[ 10 ] := Arg1
   else
      qself()[ 10 ] := _einstvar(qself(), "SBLOCK", Arg1, "B", 1001)
   endif
   return qself()[ 10 ]

//---------------------------------------------------[top]-
//  __PBSELECT( Arg1 )
//
function __PBSELECT( Arg1 )

   local Local1, Local2 := Arg1
   if ( qself()[ 7 ] )
      qself()[ 1 ] := .T.
      qself():display()
      if ( ISNUMBER( Arg1 ) )
         if ( Arg1 == 32 )
            InKey(0.4)
            do while ( Local2 == 32 )
               Local2 := InKey(0.1)
            enddo
         else
            do while ( Arg1 == InKey(0) )
            enddo
         endif
      endif
      if ( ISBLOCK( qself()[ 10 ] ) )
         eval(qself()[ 10 ])
      endif
      qself()[ 1 ] := .F.
      qself():display()
   endif
   return qself()

//---------------------------------------------------[top]-
//  __PBSETFOC
//
function __PBSETFOC

   if ( !qself()[ 7 ] .AND. ISBLOCK( ( qself()[ 11 ] := setcursor(0), ;
         qself()[ 7 ] := .T., qself():display(), qself()[ 6 ] ) ) )
      eval(qself()[ 6 ])
   endif
   return qself()

//---------------------------------------------------[top]-
//  __PBSIZEX( Arg1 )
//
function __PBSIZEX( Arg1 )

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 13 ] := _einstvar(qself(), "SIZEX", Arg1, "N", 1001)
   endif
   return qself()[ 13 ]

//---------------------------------------------------[top]-
//  __PBSIZEY( Arg1 )
//
function __PBSIZEY( Arg1 )

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 14 ] := _einstvar(qself(), "SIZEY", Arg1, "N", 1001)
   endif
   return qself()[ 14 ]

//---------------------------------------------------[top]-
//  __PBSTYLE( Arg1 )
//
function __PBSTYLE( Arg1 )

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 12 ] := _einstvar(qself(), "STYLE", Arg1, "C", 1001, { ;
         |_1, _2| LTrim(Str(Len(_2))) $ "028" })
   endif
   return qself()[ 12 ]

//---------------------------------------------------[top]-
//  __PBTYPEOU
//
function __PBTYPEOU

   return .F.

//---EOF


Use your Browser's BACK button to return to Function Listings