mirror of
https://github.com/AR2000AR/openComputers_codes.git
synced 2025-09-08 06:31:14 +02:00
[libGUI-doc] documentation
This commit is contained in:
52
libGUIDoc/widget/Image.md
Normal file
52
libGUIDoc/widget/Image.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# Image([Widget](Widget.md))
|
||||
Display a image. Supported format are `.ppm` and `.pam` both in ASCII or RAW (binary) format.
|
||||
|
||||
## Constructor
|
||||
- x : int
|
||||
- y : int
|
||||
- img : string|[ImageFile](ImageFile.md). The image file path
|
||||
- drawMethod : int
|
||||
|
||||
## Inherited public methods
|
||||
- [setX](Widget.md#setx)
|
||||
- [setY](Widget.md#sety)
|
||||
- [setPos](Widget.md#setpos)
|
||||
- [getX](Widget.md#getx)
|
||||
- [getY](Widget.md#gety)
|
||||
- [getPos](Widget.md#getpos)
|
||||
- [setCallback](Widget.md#setcallback)
|
||||
- [draw](Widget.md#draw)
|
||||
- [collide](Widget.md#collide)
|
||||
|
||||
## Public methods
|
||||
### getWidth
|
||||
#### Return
|
||||
- width : int
|
||||
---
|
||||
### getHeight
|
||||
#### Return
|
||||
- height: int
|
||||
|
||||
---
|
||||
### getSize
|
||||
#### Return
|
||||
- width : int
|
||||
- height : int
|
||||
|
||||
---
|
||||
### setDrawMethod
|
||||
Define how a individual pixel is drawn :
|
||||
- true : 2 pixels per character (square pixel)
|
||||
- false : 1 pixel per character (rectangle pixel)
|
||||
#### Argument
|
||||
- drawMethod : boolean
|
||||
|
||||
---
|
||||
### getDrawMethod
|
||||
How a individual pixel is drawn :
|
||||
- true : 2 pixels per character (square pixel)
|
||||
- false : 1 pixel per character (rectangle pixel)
|
||||
#### Return
|
||||
- drawMethod : boolean
|
||||
|
||||
---
|
57
libGUIDoc/widget/Input.md
Normal file
57
libGUIDoc/widget/Input.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# Input([Text](Text.md))
|
||||
Get text input from the user.
|
||||
The widget must be able to
|
||||
|
||||
## Inherited public methods
|
||||
- [setX](Widget.md#setx)
|
||||
- [setY](Widget.md#sety)
|
||||
- [setPos](Widget.md#setpos)
|
||||
- [getX](Widget.md#getx)
|
||||
- [getY](Widget.md#gety)
|
||||
- [getPos](Widget.md#getpos)
|
||||
- [draw](Widget.md#draw)
|
||||
- [collide](Widget.md#collide)
|
||||
- [setWidth](Rectangle.md#setwidth)
|
||||
- [setHeight](Rectangle.mdsetHeight)
|
||||
- [setSize](Rectangle.mdd#setsize)
|
||||
- [setColor](Rectangle.md#setcolor)
|
||||
- [getWidth](Rectangle.md#getwidth)
|
||||
- [getHeight](Rectangle.md#getheight)
|
||||
- [getSize](Rectangle.mdd#getsize)
|
||||
- [getColor](Rectangle.md#getcolor)
|
||||
- [getForeground](Text.md#getforeground)
|
||||
- [getBackground](Text.md#getbackground)
|
||||
- [setForeground](Text.md#setforeground)
|
||||
- [setBackground](Text.md#setbackground)
|
||||
|
||||
Do not use :
|
||||
- [setCallback](Widget.md#setcallback)
|
||||
|
||||
This methods are replaced by [getValue](#getvalue) and [setValue](#setvalue)
|
||||
- [getText](Text.md#gettext)
|
||||
- [setText](Text.md#settext)
|
||||
|
||||
## Public methods
|
||||
### setPlaceholder
|
||||
If set, the widget will show the placeholder character instead of the normal text. Useful for password prompts
|
||||
#### Arguments
|
||||
- char : string|nil
|
||||
|
||||
---
|
||||
### getPlaceholder
|
||||
Get the placeholder character.
|
||||
#### Return
|
||||
- char : string
|
||||
|
||||
---
|
||||
### getValue
|
||||
Get the inputted value. Return a different value than `getText`. Prefer this method.
|
||||
#### Return
|
||||
- value : string
|
||||
---
|
||||
### setValue
|
||||
Get the inputted value. Should be used instead of `setText`
|
||||
#### Arguments
|
||||
#### Return
|
||||
|
||||
---
|
61
libGUIDoc/widget/Rectangle.md
Normal file
61
libGUIDoc/widget/Rectangle.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# Rectangle([Widget](Widget.md))
|
||||
Basic rectangle shape.
|
||||
|
||||
## Constructor
|
||||
- x : int
|
||||
- y : int
|
||||
- width : int
|
||||
- height : int
|
||||
- color : int
|
||||
|
||||
## Inherited public methods
|
||||
- [setX](Widget.md#setx)
|
||||
- [setY](Widget.md#sety)
|
||||
- [setPos](Widget.md#setpos)
|
||||
- [getX](Widget.md#getx)
|
||||
- [getY](Widget.md#gety)
|
||||
- [getPos](Widget.md#getpos)
|
||||
- [setCallback](Widget.md#setcallback)
|
||||
- [draw](Widget.md#draw)
|
||||
- [collide](Widget.md#collide)
|
||||
|
||||
## Public methods
|
||||
### setWidth
|
||||
#### Arguments
|
||||
- width : int
|
||||
|
||||
---
|
||||
### setHeight
|
||||
#### Arguments
|
||||
- height : int
|
||||
|
||||
---
|
||||
### setSize
|
||||
#### Arguments
|
||||
- width : int
|
||||
- height : int
|
||||
|
||||
---
|
||||
### setColor
|
||||
#### Arguments
|
||||
- color : int. RGB color
|
||||
|
||||
---
|
||||
### getWidth
|
||||
#### Return
|
||||
- width : int
|
||||
---
|
||||
### getHeight
|
||||
#### Return
|
||||
- height: int
|
||||
|
||||
---
|
||||
### getSize
|
||||
#### Return
|
||||
- width : int
|
||||
- height : int
|
||||
|
||||
---
|
||||
### getColor
|
||||
#### Return
|
||||
- color : int. RGB color
|
59
libGUIDoc/widget/Text.md
Normal file
59
libGUIDoc/widget/Text.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# Text([Rectangle](Rectangle.md))
|
||||
Display text.
|
||||
## Constructor
|
||||
- x : int
|
||||
- y : int
|
||||
- width : int
|
||||
- height : int
|
||||
- backgroundColor : int
|
||||
- text : string
|
||||
|
||||
## Inherited public methods
|
||||
- [setX](Widget.md#setx)
|
||||
- [setY](Widget.md#sety)
|
||||
- [setPos](Widget.md#setpos)
|
||||
- [getX](Widget.md#getx)
|
||||
- [getY](Widget.md#gety)
|
||||
- [getPos](Widget.md#getpos)
|
||||
- [setCallback](Widget.md#setcallback)
|
||||
- [draw](Widget.md#draw)
|
||||
- [collide](Widget.md#collide)
|
||||
- [setWidth](Rectangle.md#setwidth)
|
||||
- [setHeight](Rectangle.md#setheight)
|
||||
- [setSize](Rectangle.mdd#setsize)
|
||||
- [setColor](Rectangle.md#setcolor)
|
||||
- [getWidth](Rectangle.md#getwidth)
|
||||
- [getHeight](Rectangle.md#getheight)
|
||||
- [getSize](Rectangle.mdd#getsize)
|
||||
- [getColor](Rectangle.md#getcolor)
|
||||
|
||||
## Public methods
|
||||
### getText
|
||||
#### Return
|
||||
- text : string
|
||||
|
||||
---
|
||||
### setText
|
||||
#### Arguments
|
||||
- text : string
|
||||
|
||||
---
|
||||
### getForeground
|
||||
#### Return
|
||||
- color : int. RGB color
|
||||
|
||||
---
|
||||
### getBackground
|
||||
#### Return
|
||||
- color : int. RGB color
|
||||
|
||||
---
|
||||
### setForeground
|
||||
#### Arguments
|
||||
- color : int. RGB color
|
||||
|
||||
---
|
||||
### setBackground
|
||||
#### Arguments
|
||||
- color : int. RGB color
|
||||
|
64
libGUIDoc/widget/Widget.md
Normal file
64
libGUIDoc/widget/Widget.md
Normal file
@@ -0,0 +1,64 @@
|
||||
# *Widget*
|
||||
Abstract class. Define the basic information any widget need.
|
||||
## Constructor
|
||||
### Arguments
|
||||
- x : int
|
||||
- y : int
|
||||
|
||||
## Abstract public methods
|
||||
|
||||
### setPos
|
||||
#### Arguments
|
||||
- x : int
|
||||
- y : int
|
||||
|
||||
---
|
||||
### setX
|
||||
#### Arguments
|
||||
- x : int
|
||||
|
||||
---
|
||||
### setY
|
||||
#### Arguments
|
||||
- y : int
|
||||
|
||||
---
|
||||
### setCallback
|
||||
Set the function called when `trigger` is called. This usually happen when the widget is clicked.
|
||||
#### Arguments
|
||||
- callback : function
|
||||
|
||||
---
|
||||
### getX
|
||||
#### Return
|
||||
- x : int
|
||||
|
||||
---
|
||||
### getY
|
||||
#### Return
|
||||
- y : int
|
||||
|
||||
---
|
||||
### getPos
|
||||
#### Return
|
||||
- x : int
|
||||
- y : int
|
||||
|
||||
---
|
||||
### *collide*
|
||||
Check if the position passed as arguments is on the widget
|
||||
#### Arguments
|
||||
- x : int
|
||||
- y : int
|
||||
|
||||
---
|
||||
### *draw*
|
||||
Draw the widget.
|
||||
|
||||
---
|
||||
## Public methods
|
||||
|
||||
### trigger
|
||||
Call the callback method if the widget is enabled. Pass the widget and all arguments passed to it to the callback method.
|
||||
### Arguments
|
||||
- ... : any
|
Reference in New Issue
Block a user