Advertisement
RaZgRiZ

guipagelist 1.1

Feb 6th, 2012
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.45 KB | None | 0 0
  1. // Specialised function that serves as a simple yet complex list selector that uses pages to utilise its full length.
  2. // Usage: /guipagelist <height> <width> $<*1 paged list> <*2 looplist button action> <*3 sidepane extras> <page var> <selection var>
  3. //  *1) Requires a list formatted like this: list = ["text more what" "something else huh" "i'm the best"]
  4. //  *2) Use like you normally would, but it's preferable you avoid using the (format) function. Use the following for substitutes:
  5. //      %1: looplist var, %2: pagedlist var, %3: page var, %4: selection var.
  6. //  *3) Extra stuff to be placed on the right side of the pagelist. Format freely however you want.
  7.  
  8. guipagelist = [
  9.     guilist [
  10.         guistrut $arg1 1
  11.         guilist [
  12.             guistrut $arg2 1
  13.             guilist [
  14.                 guibutton "" [
  15.                     @arg6 = (max 0 (- $@arg6 1))
  16.                 ] left
  17.                 guispring
  18.                 guitext (format "^f2%1 / %2" (+ $$arg6 1) (listlen $arg3)) 0
  19.                 guispring
  20.                 guibutton "" [
  21.                     @arg6 = (min (- (listlen [@@arg3]) 1) (+ $@arg6 1))
  22.                 ] right
  23.             ]
  24.             guibar
  25.             looplist a (at $arg3 $$arg6) [
  26.                 if (=s (concatword "^f7" $a) $guirollovername) [
  27.                     $arg7 = $a
  28.                 ]
  29.                 guibutton (format "^f7%1%2" (? (=s $$arg7 $a) "^f6") $a) (
  30.                     format $arg4 $a $arg3 $$arg6 $$arg7
  31.                 ) cube
  32.             ]
  33.         ]
  34.         guibar
  35.         arg5
  36.     ]
  37. ]
  38.  
  39. // ---- GRAPHICAL EXAMPLE ----
  40.  
  41. newgui test [
  42.     guipagelist 10 32 $pagedlist [
  43.         say "%1"
  44.     ] [
  45.         guiimage "smileyface" [] 4 0 "data/cube.png"
  46.     ] "pagevar" "selvar"
  47. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement