Advertisement
Guest User

Untitled

a guest
Jul 14th, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Class GadgetBase
  2.     _pb_object.i
  3.    
  4.     _tooltip.s
  5.     Map _x.i()
  6.     Map _y.i()
  7.     _width.i
  8.     _height.i
  9.     _flags.i
  10.     _text.s
  11.     _state.i
  12.     _fontID.i
  13.     Map _data.i()
  14.     Map _attributes.i()
  15.     Map _colors.i()
  16.    
  17.     _disabled.i
  18.     _hidden.i
  19.    
  20.     Public Method Constructor()
  21.             me\_fontID = #PB_Default ; -1 on Windows
  22.     EndMethod
  23.    
  24.     Public Method.i ID()
  25.         If me\_pb_object
  26.             ProcedureReturn GadgetID(me\_pb_object)
  27.         EndIf
  28.     EndMethod
  29.    
  30.     Public Method.i Gadget()
  31.         ProcedureReturn me\_pb_object
  32.     EndMethod
  33.    
  34.    
  35.     Public Method.i Type()
  36.         If me\_pb_object
  37.             ProcedureReturn GadgetType(me\_pb_object)
  38.         EndIf
  39.     EndMethod
  40.  
  41.     Public Method.i IsGadget()
  42.         If me\_pb_object
  43.             ProcedureReturn IsGadget(me\_pb_object)
  44.         EndIf
  45.     EndMethod
  46.    
  47.     Public Method Free()
  48.         If me\_pb_object
  49.             FreeGadget(me\_pb_object)
  50.             me\_pb_object = 0
  51.         EndIf
  52.     EndMethod
  53.    
  54.     Public Method Close()
  55.         me\Free()
  56.     EndMethod
  57.    
  58.     Public Method Disable(state=1)
  59.         me\_disabled = state
  60.         If me\_pb_object
  61.             DisableGadget(me\_pb_object, state)
  62.         EndIf
  63.     EndMethod
  64.    
  65.     Public Method Enable(state=1)
  66.         state!1
  67.         me\_disabled = state
  68.         If me\_pb_object
  69.             DisableGadget(me\_pb_object,state)
  70.         EndIf
  71.     EndMethod
  72.    
  73.     Public Method Hide(state=1)
  74.         me\_hidden = state
  75.         If me\_pb_object
  76.             HideGadget(me\_pb_object, state)
  77.         EndIf
  78.     EndMethod
  79.    
  80.     Public Method Show(state=1)
  81.         state!1
  82.         me\_hidden = state
  83.         If me\_pb_object
  84.             HideGadget(me\_pb_object, state)
  85.         EndIf
  86.     EndMethod
  87.    
  88.     Public Method Resize(x,y,width,height)
  89.         me\_x(Str(#PB_Gadget_ContainerCoordinate)) = x
  90.         me\_y(Str(#PB_Gadget_ContainerCoordinate)) = y
  91.         me\_width  = width
  92.         me\_height = height
  93.         If me\_pb_object
  94.             ResizeGadget(me\_pb_object,x,y,width,height)
  95.         EndIf
  96.     EndMethod
  97.    
  98.     Public Method Activate()
  99.         If me\_pb_object
  100.             SetActiveGadget(me\_pb_object)
  101.         EndIf
  102.     EndMethod
  103.    
  104.     Public Method.i IsActivated()
  105.         If me\_pb_object
  106.             If GetActiveGadget() = me\_pb_object
  107.                 ProcedureReturn #True
  108.             EndIf
  109.         EndIf
  110.         ProcedureReturn #False
  111.     EndMethod
  112.    
  113.     Public Method.i GetWidth()
  114.         If me\_pb_object
  115.             me\_width = GadgetWidth(me\_pb_object)
  116.         EndIf
  117.         ProcedureReturn me\_width
  118.     EndMethod
  119.    
  120.     Public Method SetWidth(width)
  121.         me\_width  = width
  122.         If me\_pb_object
  123.             ResizeGadget(me\_pb_object,#PB_Ignore,#PB_Ignore,width,#PB_Ignore)
  124.         EndIf
  125.     EndMethod
  126.  
  127.     Public Method.i GetHeight()
  128.         If me\_pb_object
  129.             me\_height = GadgetHeight(me\_pb_object)
  130.         EndIf
  131.         ProcedureReturn me\_height
  132.     EndMethod
  133.    
  134.     Public Method SetHeight(height)
  135.         me\_height = height
  136.         If me\_pb_object
  137.             ResizeGadget(me\_pb_object,#PB_Ignore,#PB_Ignore,#PB_Ignore,height)
  138.         EndIf
  139.     EndMethod
  140.    
  141.     Public Method GetX(flags=#PB_Gadget_ContainerCoordinate)
  142.         If me\_pb_object
  143.             me\_x(Str(flags)) = GadgetX(me\_pb_object,flags)
  144.         EndIf
  145.         ProcedureReturn me\_x(Str(flags))
  146.     EndMethod
  147.    
  148.     Public Method SetX(x)
  149.         me\_x(Str(#PB_Gadget_ContainerCoordinate)) = x
  150.         If me\_pb_object
  151.             ResizeGadget(me\_pb_object,x,#PB_Ignore,#PB_Ignore,#PB_Ignore)
  152.         EndIf
  153.     EndMethod
  154.    
  155.     Public Method GetY(flags=#PB_Gadget_ContainerCoordinate)
  156.         If me\_pb_object
  157.             me\_y(Str(flags)) = GadgetY(me\_pb_object,flags)
  158.         EndIf
  159.         ProcedureReturn me\_y(Str(flags))
  160.     EndMethod
  161.    
  162.     Public Method SetY(y)
  163.         me\_y(Str(#PB_Gadget_ContainerCoordinate)) = y
  164.         If me\_pb_object
  165.             ResizeGadget(me\_pb_object,#PB_Ignore,y,#PB_Ignore,#PB_Ignore)
  166.         EndIf
  167.     EndMethod
  168.    
  169.     Public Method SetSize(width,height)
  170.         me\_width  = width
  171.         me\_height = height
  172.         If me\_pb_object
  173.             ResizeGadget(me\_pb_object,#PB_Ignore,#PB_Ignore,width,height)
  174.         EndIf
  175.     EndMethod
  176.    
  177.     Public Method SetPosition(x,y)
  178.         me\_x(Str(#PB_Gadget_ContainerCoordinate)) = x
  179.         me\_y(Str(#PB_Gadget_ContainerCoordinate)) = y
  180.         If me\_pb_object
  181.             ResizeGadget(me\_pb_object,x,y,#PB_Ignore,#PB_Ignore)
  182.         EndIf
  183.     EndMethod
  184.    
  185.     Public Method.s GetText()
  186.         If me\_pb_object
  187.             me\_text = GetGadgetText(me\_pb_object)
  188.         EndIf
  189.         ProcedureReturn me\_text
  190.     EndMethod
  191.    
  192.     Public Method SetText(text.s)
  193.         me\_text = text
  194.         If me\_pb_object
  195.             SetGadgetText(me\_pb_object, text)
  196.         EndIf
  197.     EndMethod
  198.    
  199.     Public Method.i GetState()
  200.         If me\_pb_object
  201.             me\_state = GetGadgetState(me\_pb_object)
  202.         EndIf
  203.         ProcedureReturn me\_state
  204.     EndMethod
  205.    
  206.     Public Method SetState(state)
  207.         me\_state = state
  208.         If me\_pb_object
  209.             SetGadgetState(me\_pb_object, state)
  210.         EndIf
  211.     EndMethod
  212.    
  213.     Public Method.i GetFlags()
  214.         ProcedureReturn me\_flags
  215.     EndMethod
  216.    
  217.     Public Method SetFlags(flags)
  218.         me\_flags = flags ; re-create on flag change?
  219.         ;If me\_pb_object
  220.         ;    ; re-create the gadget
  221.         ;EndIf
  222.     EndMethod
  223.    
  224.    
  225.     Public Method.i GetData(index=0)
  226.         ;If me\_pb_object
  227.         ;    ProcedureReturn GetGadgetData(me\_pb_object)
  228.         ;EndIf
  229.         ProcedureReturn me\_data(Str(index))
  230.     EndMethod
  231.    
  232.     Public Method SetData(value, index=0)
  233.         ;If me\_pb_object
  234.         ;    SetGadgetData(me\_pb_object, value)
  235.         ;EndIf
  236.         me\_data(Str(index)) = value
  237.     EndMethod
  238.    
  239.     Public Method.i GetAttribute(attribute)
  240.         If me\_pb_object
  241.             me\_attributes(Str(attribute)) = GetGadgetAttribute(me\_pb_object, attribute)
  242.         EndIf
  243.         ProcedureReturn me\_attributes(Str(attribute))
  244.     EndMethod
  245.    
  246.     Public Method SetAttribute(attribute, value)
  247.         me\_attributes(Str(attribute)) = value
  248.         If me\_pb_object
  249.             SetGadgetAttribute(me\_pb_object, attribute, value)
  250.         EndIf
  251.     EndMethod
  252.    
  253.     Public Method.i GetFont()
  254.         If me\_pb_object
  255.             me\_fontID = GetGadgetFont(me\_pb_object)
  256.         EndIf
  257.         ProcedureReturn me\_fontID
  258.     EndMethod
  259.    
  260.     Public Method SetFont(fontID)
  261.         me\_fontID = fontID
  262.         If me\_pb_object
  263.             SetGadgetFont(me\_pb_object, fontID)
  264.         EndIf
  265.     EndMethod
  266.    
  267.     Public Method.s GetTooltip()
  268.         ProcedureReturn me\_tooltip
  269.     EndMethod
  270.    
  271.     Public Method SetTooltip(text.s)
  272.         me\_tooltip = text
  273.         If me\_pb_object
  274.             GadgetToolTip(me\_pb_object, text)
  275.         EndIf
  276.     EndMethod
  277.    
  278.     Public Method.i GetColor(colorType)
  279.         ;If me\_pb_object
  280.         ;    me\_colors(Str(colorType)) = GetGadgetColor(me\_pb_object, colorType)
  281.         ;EndIf
  282.         ProcedureReturn me\_colors(Str(colorType))
  283.     EndMethod
  284.    
  285.     Public Method SetColor(colorType, color)
  286.         me\_colors(Str(colorType)) = color
  287.         If me\_pb_object
  288.             SetGadgetColor(me\_pb_object, colorType, color)
  289.         EndIf
  290.     EndMethod    
  291.    
  292.     Private Method __create()
  293.     EndMethod
  294.    
  295.     Private Method __init()
  296.         If me\_pb_object
  297.             SetGadgetData(me\_pb_object,me)
  298.            
  299.             If me\_disabled
  300.                 DisableGadget(me\_pb_object, 1)
  301.             EndIf
  302.             If me\_hidden
  303.                 HideGadget(me\_pb_object, 1)
  304.             EndIf
  305.             If me\_tooltip <> ""
  306.                 GadgetToolTip(me\_pb_object, me\_tooltip)
  307.             EndIf
  308.             If me\_state
  309.                 SetGadgetState(me\_pb_object, me\_state)
  310.             EndIf
  311.             If me\_fontID <> 0 And me\_fontID <> #PB_Default
  312.                 SetGadgetFont(me\_pb_object, me\_fontID)
  313.             EndIf
  314.             ForEach me\_attributes()
  315.                 SetGadgetAttribute(me\_pb_object, Val(MapKey(me\_attributes())), me\_attributes())
  316.             Next
  317.             ForEach me\_colors()
  318.                 SetGadgetColor(me\_pb_object, Val(MapKey(me\_colors())), me\_colors())
  319.             Next
  320.             ; init Map _data.i() ? Not required as long we dont use SetGadgetData()!
  321.            
  322.         EndIf
  323.     EndMethod
  324.    
  325. EndClass
  326.  
  327. Class ItemStateGadget Extends GadgetBase
  328.     Public Method.i GetItemState(item)
  329.         If me\_pb_object
  330.             ProcedureReturn GetGadgetItemState(me\_pb_object, item)
  331.         EndIf
  332.     EndMethod
  333.     Public Method SetItemState(item, state)
  334.         If me\_pb_object
  335.             SetGadgetItemState(me\_pb_object, item, state)
  336.         EndIf
  337.     EndMethod
  338. EndClass
  339.  
  340. Class ItemGadget Extends GadgetBase
  341.     Public Method.i ItemID(item)
  342.         If me\_pb_object
  343.             ProcedureReturn GadgetItemID(me\_pb_object, item)
  344.         EndIf
  345.     EndMethod
  346.    
  347.     Public Method AddItem(position, text.s, imageID=0, flags=0)
  348.         If me\_pb_object
  349.             AddGadgetItem(me\_pb_object, position, text.s, imageID, flags)
  350.         EndIf
  351.     EndMethod
  352.    
  353.     Public Method RemoveItem(position)
  354.         If me\_pb_object
  355.             RemoveGadgetItem(me\_pb_object, position)
  356.         EndIf
  357.     EndMethod
  358.    
  359.     Public Method ClearItems()
  360.         If me\_pb_object
  361.             ClearGadgetItems(me\_pb_object)
  362.         EndIf
  363.     EndMethod
  364.    
  365.     Public Method.i CountItems()
  366.         If me\_pb_object
  367.             ProcedureReturn CountGadgetItems(me\_pb_object)
  368.         EndIf
  369.     EndMethod
  370.    
  371.     Public Method SetItemText(item, text.s, column=0)
  372.         If me\_pb_object
  373.             SetGadgetItemText(me\_pb_object, item, text, column)
  374.         EndIf
  375.     EndMethod
  376.    
  377.     Public Method.s GetItemText(item, column=0)
  378.         If me\_pb_object
  379.             ProcedureReturn GetGadgetItemText(me\_pb_object, item, column)
  380.         EndIf
  381.     EndMethod
  382.    
  383.     Public Method SetItemData(item, value)
  384.         If me\_pb_object
  385.             SetGadgetItemData(me\_pb_object, item, value)
  386.         EndIf
  387.     EndMethod
  388.    
  389.     Public Method.i GetItemData(item)
  390.         If me\_pb_object
  391.             ProcedureReturn GetGadgetItemData(me\_pb_object, item)
  392.         EndIf
  393.     EndMethod
  394.    
  395.     Public Method SetItemAttribute(item, attribute, value, column=0)
  396.         If me\_pb_object
  397.             SetGadgetItemAttribute(me\_pb_object, item, attribute, value, column)
  398.         EndIf
  399.     EndMethod
  400.    
  401.     Public Method.i GetItemAttribute(item, attribute, column=0)
  402.         If me\_pb_object
  403.             ProcedureReturn GetGadgetItemAttribute(me\_pb_object, item, attribute, column)
  404.         EndIf
  405.     EndMethod
  406.    
  407.     Public Method SetItemColor(item, colorType, color, column=0)
  408.         If me\_pb_object
  409.             SetGadgetItemColor(me\_pb_object, item, colorType, color, column)
  410.         EndIf
  411.     EndMethod
  412.    
  413.     Public Method.i GetItemColor(item, colorType, column=0)
  414.         If me\_pb_object
  415.             ProcedureReturn GetGadgetItemColor(me\_pb_object, item, colorType, column)
  416.         EndIf
  417.     EndMethod
  418.    
  419.     Public Method SetItemImage(item, imageID)
  420.         If me\_pb_object
  421.             SetGadgetItemImage(me\_pb_object, item, imageID)
  422.         EndIf
  423.     EndMethod
  424. EndClass
  425.  
  426. Class ItemStateItemGadget Extends ItemGadget
  427.     Public Method.i GetItemState(item)
  428.         If me\_pb_object
  429.             ProcedureReturn GetGadgetItemState(me\_pb_object, item)
  430.         EndIf
  431.     EndMethod
  432.     Public Method SetItemState(item, state)
  433.         If me\_pb_object
  434.             SetGadgetItemState(me\_pb_object, item, state)
  435.         EndIf
  436.     EndMethod
  437. EndClass
  438.  
  439. Class ImageButton Extends GadgetBase
  440.     Public Method Constructor(x, y, width, height, imageID, flags=0)
  441.     EndMethod
  442. EndClass
  443.  
  444. Class ImageGadget Extends GadgetBase
  445.     Public Method Constructor(x, y, width, height, imageID, flags=0)
  446.     EndMethod
  447. EndClass
  448.  
  449. Class StringGadget Extends GadgetBase
  450.     Public Method Constructor(x, y, width, height, text.s, flags=0)
  451.             me\SetPosition(x,y)
  452.             me\SetSize(width,height)
  453.             me\SetText(text)
  454.             me\SetFlags(flags)
  455.     EndMethod
  456. EndClass
  457.  
  458. Class TextGadget Extends GadgetBase
  459.     Public Method Constructor(x, y, width, height, text.s, flags=0)
  460.             me\SetPosition(x,y)
  461.             me\SetSize(width,height)
  462.             me\SetText(text)
  463.             me\SetFlags(flags)
  464.     EndMethod
  465. EndClass
  466.  
  467. Class CheckBox Extends GadgetBase
  468.     Public Method Constructor(x, y, width, height, text.s, flags=0)
  469.             me\SetPosition(x,y)
  470.             me\SetSize(width,height)
  471.             me\SetText(text)
  472.             me\SetFlags(flags)
  473.     EndMethod
  474. EndClass
  475.  
  476. Class Option Extends GadgetBase
  477.     Public Method Constructor(x, y, width, height, text.s)
  478.             me\SetPosition(x,y)
  479.             me\SetSize(width,height)
  480.             me\SetText(text)
  481.     EndMethod
  482. EndClass
  483.  
  484. Class Frame3D Extends GadgetBase
  485.     Public Method Constructor(x, y, width, height, text.s, flags=0)
  486.             me\SetPosition(x,y)
  487.             me\SetSize(width,height)
  488.             me\SetText(text)
  489.             me\SetFlags(flags)
  490.     EndMethod
  491. EndClass
  492.  
  493. Class ProgressBar Extends GadgetBase
  494.     Public Method Constructor(x, y, width, height, minimum, maximum, flags=0)
  495.     EndMethod
  496. EndClass
  497.  
  498. Class TrackBar Extends GadgetBase
  499.     Public Method Constructor(x, y, width, height, minimum, maximum, flags=0)
  500.     EndMethod
  501. EndClass
  502.  
  503. Class ScrollBar Extends GadgetBase
  504.     Public Method Constructor(x, y, width, height, minimum, maximum, pageLength, flags=0)
  505.     EndMethod
  506. EndClass
  507.  
  508. Class Spin Extends GadgetBase
  509.     Public Method Constructor(x, y, width, height, minimum, maximum, flags=0)
  510.     EndMethod
  511. EndClass
  512.  
  513. Class Splitter Extends GadgetBase
  514.     Public Method Constructor(x, y, width, height, gadget1, gadget2, flags=0)
  515.     EndMethod
  516. EndClass
  517.  
  518. Class Hyperlink Extends GadgetBase
  519.     Public Method Constructor(x, y, width, height, text.s, color, flags=0)
  520.     EndMethod
  521. EndClass
  522.  
  523. Class IPAddress Extends GadgetBase
  524.     Public Method Constructor(x, y, width, height)
  525.             me\SetPosition(x,y)
  526.             me\SetSize(width,height)
  527.     EndMethod
  528. EndClass
  529.  
  530. Class Shortcut Extends GadgetBase
  531.     Public Method Constructor(x, y, width, height, shortcut)
  532.     EndMethod
  533. EndClass
  534.  
  535. Class Container Extends GadgetBase
  536.     Public Method Constructor(x, y, width, height, flags=0)
  537.             me\SetPosition(x,y)
  538.             me\SetSize(width,height)
  539.             me\SetFlags(flags)
  540.            
  541.             ;CloseGadgetList()
  542.     EndMethod
  543. EndClass
  544.  
  545. Class ScrollArea Extends GadgetBase
  546.     Public Method Constructor(x, y, width, height, scrollAreaWidth, scrollAreaHeight, scrollStep=10, flags=0)
  547.         ;CloseGadgetList()
  548.     EndMethod
  549. EndClass
  550.  
  551. Class Date Extends GadgetBase
  552.     Public Method Constructor(x, y, width, height, mask.s="", date=0, flags=0)
  553.     EndMethod
  554. EndClass
  555.  
  556. Class ExplorerCombo Extends GadgetBase
  557.     Public Method Constructor(x, y, width, height, directory.s, flags=0)
  558.     EndMethod
  559. EndClass
  560.  
  561. Class ExplorerTree Extends GadgetBase
  562.     Public Method Constructor(x, y, width, height, directory.s, flags=0)
  563.     EndMethod
  564. EndClass
  565.  
  566. Class WebGadget Extends GadgetBase
  567.     Public Method Constructor(x, y, width, height, url.s, flags=0)
  568.     EndMethod
  569.     ;SetItemText(item, text.s, Column=0)
  570.     ;GetItemText(item, column=0)
  571. EndClass
  572.  
  573.  
  574.  
  575. ; Class ComboBox Extends ItemGadget
  576. ;     Public Method Constructor(x, y, width, height, flags=0)
  577. ;     EndMethod
  578. ; EndClass
  579. ;
  580. ; Class Panel Extends ItemGadget
  581. ;     Public Method Constructor(x, y, width, height)
  582. ;     EndMethod
  583. ; EndClass
  584. ;
  585. ; Class Editor Extends ItemGadget
  586. ;     Public Method Constructor(x, y, width, height, flags=0)
  587. ;     EndMethod
  588. ; EndClass
  589. ;
  590. ; Class MDI Extends ItemGadget
  591. ;     Public Method Constructor(x, y, width, height, subMenu, menuItem, flags=0)
  592. ;     EndMethod
  593. ; EndClass
  594. ;
  595. ;
  596. ;
  597. ; Class Calendar Extends ItemStateGadget
  598. ;     Public Method Constructor(x, y, width, height, date=0, flags=0)
  599. ;     EndMethod
  600. ; EndClass
  601. ;
  602. ;
  603. ;
  604. ; Class ExplorerList Extends ItemStateItemGadget
  605. ;     Public Method Constructor(x, y, width, height, directory.s, flags=0)
  606. ;     EndMethod
  607. ;    
  608. ;     ;AddColumn(position, title.s, titleWidth)
  609. ;     ;RemoveColumn(column)
  610. ; EndClass
  611. ;
  612. ; Class ListIcon Extends ItemStateItemGadget
  613. ;     Public Method Constructor(x, y, width, height, title.s, titleWidth, flags=0)
  614. ;     EndMethod
  615. ;    
  616. ;     ;AddColumn(position, title.s, titleWidth)
  617. ;     ;RemoveColumn(column)
  618. ; EndClass
  619. ;
  620. ; Class ListView Extends ItemStateItemGadget
  621. ;     Public Method Constructor(x, y, width, height, flags=0)
  622. ;     EndMethod
  623. ; EndClass
  624. ;
  625. ; Class TreeGadget Extends ItemStateItemGadget
  626. ;     Public Method Constructor(x, y, width, height, flags=0)
  627. ;     EndMethod
  628. ; EndClass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement