--------------------------------------------------------------------------------------
-- this file is generated by pvdevelop. DO NOT EDIT !!!
--------------------------------------------------------------------------------------

function showMask1(p)
  --- begin variables that are private to this mask ----------------------------------
  iarray = pv.IntegerArray()                  -- see pv.getIntegers(text,iarray) below
  farray = pv.FloatArray()                    -- see pv.getFloats(text,farray) below
  --- begin construction of our mask -------------------------------------------------
  ID_MAIN_WIDGET = 0                          -- begin of our widget names
  PushButtonBack = 1
  ID_END_OF_WIDGETS = 2                       -- end of our widget names
  pv.pvStartDefinition(p,ID_END_OF_WIDGETS)

  pv.pvQPushButton(p,PushButtonBack,0)
  pv.pvSetGeometry(p,PushButtonBack,10,10,111,40)
  pv.pvSetText(p,PushButtonBack,"Lua test")

  pv.pvEndDefinition(p)
  --- end construction of our mask ---------------------------------------------------
  --- end variables that are private to this mask ------------------------------------
  dofile("mask1_slots.lua")                   -- include our slot functions

  if trace == 1 then print("show mask1") end
  pv.pvClearMessageQueue(p)                   -- clear all pending events
  ret = slotInit(p)                           -- intitialize our variables
  if ret ~= 0 then return ret end             -- return number of next mask to call
  while(1)                                    -- event loop
  do
    event  = pv.pvGetEvent(p)                 -- get the next event
    result = pv.pvParseEventStruct(p,event)   -- parse the event
    id     = result.event
    i      = result.i
    text   = result.text
                                              -- now call the according slot function
    if     id == pv.NULL_EVENT then
        ret = slotNullEvent(p)
    elseif id == pv.BUTTON_EVENT then    
        if trace==1 then print("BUTTON_EVENT id=", i) end
        ret = slotButtonEvent(p,i)
    elseif id == pv.BUTTON_PRESSED_EVENT then
        if trace == 1 then print("BUTTON_PRESSED_EVENT id=",i) end
        ret=slotButtonPressedEvent(p,i)
    elseif id == pv.BUTTON_RELEASED_EVENT then
        if trace == 1 then print("BUTTON_RELEASED_EVENT id=",i) end
        ret=slotButtonReleasedEvent(p,i)
    elseif id == pv.TEXT_EVENT then
        if trace == 1 then print("TEXT_EVENT id=",i," text=",text) end
        ret=slotTextEvent(p,i,text)
    elseif id == pv.SLIDER_EVENT then
        pv.getIntegers(text,iarray)
        if trace == 1 then print("SLIDER_EVENT val=",iarray.i0) end
        ret=slotSliderEvent(p,i,iarray.i0)
    elseif id == pv.CHECKBOX_EVENT then
        if trace == 1 then print("CHECKBOX_EVENT id=",i," text=",text) end
        ret=slotCheckboxEvent(p,i,text)
    elseif id == pv.RADIOBUTTON_EVENT then
        if trace == 1 then print("RADIOBUTTON_EVENT id=",i," text=",text) end
        ret=slotRadioButtonEvent(p,i,text)
    elseif id == pv.GL_INITIALIZE_EVENT then
        if trace == 1 then print("you have to call initializeGL()") end
        ret=slotGlInitializeEvent(p,i)
    elseif id == pv.GL_PAINT_EVENT then
        if trace == 1 then print("you have to call paintGL()") end
        ret=slotGlPaintEvent(p,i)
    elseif id == pv.GL_RESIZE_EVENT then
        pv.getIntegers(text,iarray)
        if trace == 1 then print("you have to call resizeGL(w,h)") end
        ret=slotGlResizeEvent(p,i,iarray.i0,iarray.i1)
    elseif id == pv.GL_IDLE_EVENT then
        ret=slotGlIdleEvent(p,i)
    elseif id == pv.TAB_EVENT then
        pv.getIntegers(text,iarray)
        if trace == 1 then print("TAB_EVENT id=",i,"page=",iarray.i0) end
        ret=slotTabEvent(p,i,iarray.i0)
    elseif id == pv.TABLE_TEXT_EVENT then
        pv.getIntegers(text,iarray)
        pv.pvlock(p)
        str1 = pv.getTextFromText(text)
        pv.pvunlock(p)
        if trace == 1 then print("TABLE_TEXT_EVENT id=",i," x=",iarray.i0," y=",iarray.i1," text=",str1) end
        ret=slotTableTextEvent(p,i,iarray.i0,iarray.i1,str1)
    elseif id == pv.TABLE_CLICKED_EVENT then
        pv.getIntegers(text,iarray)
        if trace == 1 then print("TABLE_CLICKED_EVENT id=",i," x=",iarray.i0," y=",iarray.i1," button=",iarray.i2) end
        ret=slotTableClickedEvent(p,i,iarray.i0,iarray.i1,iarray.i2)
    elseif id == pv.SELECTION_EVENT then
        pv.getIntegers(text,iarray)
        pv.pvlock(p)
        str1 = pv.getTextFromText(text)
        pv.pvunlock(p)
        if trace == 1 then print("SELECTION_EVENT id=",i," column=",iarray.i0," text=",str1) end
        ret=slotSelectionEvent(p,i,iarray.i0,str1)
    elseif id == pv.CLIPBOARD_EVENT then
        pv.getIntegers(text,iarray)
        if trace == 1 then print("CLIPBOARD_EVENT id=",iarray.i0) end
        if trace == 1 then print("clipboard = ",p.clipboard) end
        ret=slotClipboardEvent(p,i,iarray.i0)
    elseif id == pv.RIGHT_MOUSE_EVENT then
        if trace == 1 then print("RIGHT_MOUSE_EVENT id=",i," text=",text) end
        ret=slotRightMouseEvent(p,i,text)
    elseif id == pv.KEYBOARD_EVENT then
        pv.getIntegers(text,iarray)
        if trace == 1 then print("KEYBOARD_EVENT modifier=",i," key=",iarray.i0) end
        ret=slotKeyboardEvent(p,i,iarray.i0,i)
    elseif id == pv.PLOT_MOUSE_MOVED_EVENT then
        pv.getFloats(text,farray)
        if trace == 1 then print("PLOT_MOUSE_MOVE ",farray.f0,farray.f1) end
        ret=slotMouseMovedEvent(p,i,farray.f0,farray.f1)
    elseif id == pv.PLOT_MOUSE_PRESSED_EVENT then
        pv.getFloats(text,farray)
        if trace == 1 then print("PLOT_MOUSE_PRESSED ",farray.f0,farray.f1) end
        ret=slotMousePressedEvent(p,i,farray.f0,farray.f1)
    elseif id == pv.PLOT_MOUSE_RELEASED_EVENT then
        pv.getFloats(text,farray)
        if trace == 1 then print("PLOT_MOUSE_RELEASED ",farray.f0,farray.f1) end
        ret=slotMouseReleasedEvent(p,i,farray.f0,farray.f1)
    elseif id == pv.MOUSE_OVER_EVENT then
        pv.getIntegers(text,iarray)
        if trace == 1 then print("MOUSE_OVER_EVENT ",iarray.i0) end
        ret=slotMouseOverEvent(p,i,iarray.i0)
    elseif id == pv.USER_EVENT then
        if trace == 1 then print("USER_EVENT id=",i," text=",text) end
        ret=slotUserEvent(p,i,text)
    else
        if trace == 1 then print("UNKNOWN_EVENT id=",i," text=",text) end
        ret = 0
    end    
    if ret ~= 0 then return ret end                -- return number of next mask to call
  end                                              -- end of event loop
  return 0                                         -- never come here
end
