5.10 Graphic Instructions - naver/lispe GitHub Wiki

GUI

back

LispE provides its own Graphical Library, which exposes the following instructions:

(deflib fltk_alert (widget msg) Pop up window to display an alert)
(deflib fltk_align (widget align) define the label alignment)
(deflib fltk_arc (widget x y w h a1 (a2)) Draw an arc / Add a series of points to the current path on the arc of a circle;)
(deflib fltk_ask (widget msg msg1 msg2 (msg3) (msg4)) Pop up window to pose a question)
(deflib fltk_backgroundcolor (widget (color)) set the background color)
(deflib fltk_bitmap (widget bitmap color (x) (y)) display a bitmap at position x,y in a window, or use the bitmap to fill in a button with type: FL_IMAGE_BUTTON_TYPE)
(deflib fltk_boundaries (widget low high) Define the boundaries of a slider)
(deflib fltk_button (widget x y w h label function (button_type) (button_shape) (object)) Create a button)
(deflib fltk_create_bitmap (bitmap length height) load a bitmap from a list of integers (bitmap) with dimensions)
(deflib fltk_create_gif (filename) load a GIF file)
(deflib fltk_circle (widget x y r (color)) Draw a circle. 'color' is optional.)
(deflib fltk_close (widget) close window)
(deflib fltk_coordinates (widget (x) (y) (w) (h)) return the coordinates of the window or set new coordinates)
(deflib fltk_create (x y w h label (function) (object)) Create a window)
(deflib fltk_create_resizable (x y label (function) (object)) Create a window)
(deflib fltk_drawcolor (widget (color)) set the color for the next drawings)
(deflib fltk_drawtext (widget txt x y) Put a text at position xy)
(deflib fltk_end (widget (timer)) Finalize the creation of a window a set an optional timer)
(deflib fltk_focus (widget) Get the focus)
(deflib fltk_gif (widget gif (x) (y) (wx) (wy)) display a GIF image in box at position x,y,wx,wy in a window, or use the image to fill in a button with type: FL_IMAGE_BUTTON_TYPE)
(deflib fltk_hide (widget) Hide the window)
(deflib fltk_input (widget x y w h label multiline (function) (object)) Creating an input object)
(deflib fltk_insert (widget val) Insert text in a widget value)
(deflib fltk_label (widget (label)) return the window label or set a new label to the window)
(deflib fltk_labelcolor (widget (color)) set or return the label color)
(deflib fltk_labelfont (widget (font)) set or return the label font)
(deflib fltk_labelsize (widget (sz)) set or return the label font size)
(deflib fltk_labeltype (widget (thetype)) set or return the label type)
(deflib fltk_line (widget x y x1 y1 (x2) (y2)) Draw a line between points x2 and y2 are optional)
(deflib fltk_lineshape (widget type_shape w) Select the line shape and its thikness)
(deflib fltk_loop (widget x y x1 y1 x2 y2 (x3) (y3)) Draw a series of lines x3 and y3 are optional)
(deflib fltk_multmatrix (widget a b c d x y) combine transformations)
(deflib fltk_on_close (widget function) This method sets a callback function to catch when the window is closing)
(deflib fltk_output (widget x y w h label multiline) Create an output widget)
(deflib fltk_pie (widget x y w h a1 a2) Draw a pie)
(deflib fltk_plot (widget points thickness (landmark)) Plot a graph from a table of successive xy points according to window size. If thickness===0 then points are continuously plotted else defines the diameter of the point. Return a which is used with plotcoords. The landmark is optional it is has the following structure: [XmaxWindow,YmaxWindow,XminValue,YminValue,XmaxValue,YmaxValue,incX,incY]. incX,incY are also optional.)
(deflib fltk_plotcoords (widget x y landmark) Compute the coordinates of a point(xy) according to the previous scale computed with plot. Returns a of two elements [xsys] corresponding to the screen coordinates in the current window.)
(deflib fltk_point (widget x y) Draw a pixel)
(deflib fltk_polygon (widget x y x1 y1 x2 y2 (x3) (y3)) Draw a polygon x3 and y3 are optional)
(deflib fltk_popclip (widget) Release a clip region)
(deflib fltk_pushclip (widget x y wx wy) Insert a clip region with the following coordinates)
(deflib fltk_rectangle (widget x y wx hy (color)) Draw a rectangle with optional color c)
(deflib fltk_rectanglefill (widget x y wx hy (color)) Fill a rectangle with optional color c)
(deflib fltk_redraw (widget) Redraw the window)
(deflib fltk_resize (widget minw minh maxw maxh) resize a window)
(deflib fltk_rgbcolor (widget r g b) return the value of rgb values combined)
(deflib fltk_rotate (widget d) rotate of d degrees the current transformation)
(deflib fltk_rotation (widget x y distance angle (draw)) Compute the coordinate of a rotated point from point x,y using a distance and an angle in radian. Return a vector of floats with the new coordinates.)
(deflib fltk_run (widget) Launch the GUI)
(deflib fltk_scale (widget x (y)) Scale the current transformation)
(deflib fltk_selection (widget pos nb) Selection in a widget value)
(deflib fltk_selection_color (widget (color)) Color for the selected elements)
(deflib fltk_show (widget) Show the window)
(deflib fltk_slider (widget x y w h label slider_orientation slider_value_type function (object)) Create a slider)
(deflib fltk_step (widget stp) Define the step in a slider)
(deflib fltk_textfont (widget f sz) Set a font with a size)
(deflib fltk_textsize (widget text) Return a map with w and h as key to denote width and height of the string in pixels)
(deflib fltk_transform_dx (widget x y) Transform a distance DX using the current transformation matrix.)
(deflib fltk_transform_dy (widget x y) Transform a distance DY using the current transformation matrix.)
(deflib fltk_transform_vertex (widget x y) Add transformations to vertices list.)
(deflib fltk_transform_x (widget x y) Transform a coordinate X using the current transformation matrix)
(deflib fltk_transform_y (widget x y) Transform a coordinate Y using the current transformation matrix)
(deflib fltk_translate (widget x y) translate the current transformation)
(deflib fltk_value (widget (val)) Set or return the widget value)
(deflib fltk_wrap (widget mode) Set wrap mode for a widget)

Pre-defined Values


; Couleurs
FL_FOREGROUND_COLOR
FL_BACKGROUND2_COLOR
FL_BACKGROUND_COLOR
FL_INACTIVE_COLOR
FL_SELECTION_COLOR
FL_GRAY0
FL_DARK3
FL_DARK2
FL_DARK1
FL_LIGHT1
FL_LIGHT2
FL_LIGHT3
FL_BLACK
FL_RED
FL_GREEN
FL_YELLOW
FL_BLUE
FL_MAGENTA
FL_CYAN
FL_DARK_RED
FL_DARK_GREEN
FL_DARK_YELLOW
FL_DARK_BLUE
FL_DARK_MAGENTA
FL_DARK_CYAN
FL_WHITE

; Forme des lignes
FL_SOLID
FL_DASH
FL_DOT
FL_DASHDOT
FL_DASHDOTDOT
FL_CAP_FLAT
FL_CAP_ROUND
FL_CAP_SQUARE
FL_JOIN_MITER
FL_JOIN_ROUND
FL_JOIN_BEVEL

; Position Slider
FL_VERT_SLIDER
FL_HOR_SLIDER
FL_VERT_FILL_SLIDER
FL_HOR_FILL_SLIDER
FL_VERT_NICE_SLIDER
FL_HOR_NICE_SLIDER

; Police de caractères
FL_HELVETICA
FL_HELVETICA_BOLD
FL_HELVETICA_ITALIC
FL_HELVETICA_BOLD_ITALIC
FL_COURIER
FL_COURIER_BOLD
FL_COURIER_ITALIC
FL_COURIER_BOLD_ITALIC
FL_TIMES
FL_TIMES_BOLD
FL_TIMES_ITALIC
FL_TIMES_BOLD_ITALIC
FL_SYMBOL
FL_SCREEN
FL_SCREEN_BOLD
FL_ZAPF_DINGBATS
FL_FREE_FONT
FL_BOLD
FL_ITALIC
FL_BOLD_ITALIC

; Type de bouton
FL_REGULAR_BUTTON_TYPE
FL_CHECK_BUTTON_TYPE
FL_LIGHT_BUTTON_TYPE
FL_REPEAT_BUTTON_TYPE
FL_RETURN_BUTTON_TYPE
FL_ROUND_BUTTON_TYPE
FL_IMAGE_BUTTON_TYPE

; Forme de bouton
FL_NORMAL_BUTTON_SHAPE
FL_TOGGLE_BUTTON_SHAPE
FL_RADIO_BUTTON_SHAPE
FL_HIDDEN_BUTTON_SHAPE


; Alignement
FL_ALIGN_CENTER
FL_ALIGN_TOP
FL_ALIGN_BOTTOM
FL_ALIGN_LEFT
FL_ALIGN_RIGHT
FL_ALIGN_INSIDE
FL_ALIGN_TEXT_OVER_IMAGE
FL_ALIGN_IMAGE_OVER_TEXT
FL_ALIGN_CLIP
FL_ALIGN_WRAP
FL_ALIGN_IMAGE_NEXT_TO_TEXT
FL_ALIGN_TEXT_NEXT_TO_IMAGE
FL_ALIGN_IMAGE_BACKDROP
FL_ALIGN_TOP_LEFT
FL_ALIGN_TOP_RIGHT
FL_ALIGN_BOTTOM_LEFT
FL_ALIGN_BOTTOM_RIGHT
FL_ALIGN_LEFT_TOP
FL_ALIGN_RIGHT_TOP
FL_ALIGN_LEFT_BOTTOM
FL_ALIGN_RIGHT_BOTTOM
FL_ALIGN_NOWRAP
FL_ALIGN_POSITION_MASK
FL_ALIGN_IMAGE_MASK

Example

(use 'gui)

; callback function
(defun pushed(b o)
   (printerrln "Pressed" (fltk_label b))
)

; We create a Window
(setq wnd (fltk_create 100 100 1000 1000 "Test"))

; We create a button, which is linked to the function: 'pushed'
(setq button (fltk_button wnd 50 50 100 100 "ok" 'pushed))

; We finalize
(fltk_end wnd)

; We run the event loop
(fltk_run wnd)