events-howto.txt 6.6 KB
Newer Older
1
Before reading this document, you should first take a look at skins-howto.txt
2
to understand the general functioning of VLC skins.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

What is an event ?
==================

Events are the dynamic part of the skins. It means that beyond visual aspect,
the interface must react with the user actions. An event describes a simple
interaction, in fact one simple action such as playing a file, hiding a
window...
So when designing a skin you will have to specify what those interactions are.
For this you will use simple actions that are described in event tags and you
would be able to add them and associate them to controls.

How to create an event ?
========================

An event describes a simple action as seen above.
19
All attributes are explained in the 'skins-howto.txt' file except the 'event'
20 21 22 23 24 25 26 27
attribute wich is a bit special.
In the 'event' attribute you will enter a simple script with the following
syntax :
  "EVENT(parameter1,parameter2,...)"

The number of parameters depends on EVENT.
All this is case sensitive.
Don't add spaces.
28
EVENT is the action to execute, it can be one of the following:
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56

 - VLC_NOTHING:
   Action    : none, it executes nothing so don't use it !
   Parameters: none.

 - VLC_SHOW:
   Action    : Open all windows of the interface with a fading effect if
               selected.
   Parameters: none.

 - VLC_HIDE:
   Action    : Close all windows of the interface with a fading effect if
               selected.
   Parameters:
     - First 1 is an EVENT to execute when all windows have been closed.

 - VLC_QUIT:
   Action    : Quit the interface
   Parameters: none.

 - VLC_OPEN:
   Action    : Open an "open file dialog box" to open a file to play.
   Parameters: none.

 - VLC_LOAD_SKIN:
   Action    : Open an "open file dialog box" to change the current skin.
   Parameters: none.

57 58 59 60
 - VLC_ON_TOP:
   Action    : Toggle the "Always on top" status
   Parameters: none.

61 62 63 64 65 66 67 68 69 70 71
 - VLC_LOG_SHOW:
   Not supported yet

 - VLC_LOG_CLEAR:
   Not supported yet.

 - VLC_INTF_REFRESH:
   Action    : Force refreshing of the interface.
   Parameters: none.

 - VLC_CHANGE_TRAY:
72
   Action    : if VLC is not visible in system tray, show it, else hide it.
73 74 75
   Parameters: none.

 - VLC_CHANGE_TASKBAR:
76
   Action    : if VLC is not visible in taskbar, show it, else hide it.
77 78 79
   Parameters: none.

 - VLC_FULLSCREEN:
80
   Action    : switch current playlist item to fullscreen mode.
81 82 83
   Parameters: none.

 - VLC_PLAY:
84
   Action    : play the stream.
85 86 87
   Parameters: none.

 - VLC_STOP:
88
   Action    : stop the stream.
89 90 91 92 93 94 95
   Parameters: none.

 - VLC_PAUSE:
   Action    : pause the stream.
   Parameters: none.

 - VLC_NEXT:
96
   Action    : go to the next file in the playlist.
97 98 99
   Parameters: none.

 - VLC_PREV:
100
   Action    : go to the previous file in the playlist.
101 102
   Parameters: none.

103 104 105 106 107 108 109 110
 - VLC_SLOWER:
   Action    : play the stream slower.
   Parameters: none.

 - VLC_FASTER:
   Action    : play the stream faster.
   Parameters: none.

111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
 - VLC_STREAMPOS:
   Not supported yet.

 - VLC_VOLUME_CHANGE:
   Action    : change sound volume.
   Parameters:
     1: - VLC_VOLUME_MUTE: switch to mute mode.
        - VLC_VOLUME_UP: raise sounds volume.
        - VLC_VOLUME_DOWN:
        - VLC_VOLUME_SET: set sound volume to second parameter
     2: if first parameter is VLC_VOLUME_SET only, an integer between 0 and 100.

 - VLC_PLAYLIST_ADD_FILE:
   Action    : Open an "open file dialog box" to add files to playlist.
   Parameters: none.

 - VLC_WINDOW_MOVE:
   Action    : initiate manual window movement.
   Parameters: only one which must match the ID of a window. It should be
               used with image controls.

 - VLC_WINDOW_OPEN:
   Action    : open a window with a fading effect if selected.
Emmanuel Puig's avatar
Emmanuel Puig committed
134 135 136
   Parameters:
     1: ID of the window to open.
     2: Describe what to do. Nothing is opening. 'TRUE' is the same. 'FALSE' is
137
        closing window. 'CHANGE' is switching between these two states.
138 139 140

 - VLC_WINDOW_CLOSE:
   Action    : close a window with a fading effect if selected.
Emmanuel Puig's avatar
Emmanuel Puig committed
141 142 143
   Parameters:
     1: ID of the window to close.
     2: Describe what to do. Nothing is closing. 'TRUE' is the same. 'FALSE' is
144
        opening window. 'CHANGE' is switching between these two states.
145 146 147 148 149 150 151 152 153 154 155

 - CTRL_SET_SLIDER:
   Not supported yet.

 - CTRL_SET_TEXT:
   Not supported yet.

 - CTRL_ID_VISIBLE:
   Action    : hide/show a control.
   Parameters:
     1: ID of the control to hide/show.
156 157 158
     2: Describe what to do. Nothing is showing control. 'TRUE' is the same.
        'FALSE' is hiding control. 'CHANGE' is switching between these two
        states.
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175

 - CTRL_ID_ENABLED:
   Not supported yet.

 - CTRL_ID_MOVE:
   Action    : moves a control.
   Parameters:
     1: ID of the control to move.
     2: horizontal offset of movement.
     3: vertical offset of movement.

 - PLAYLIST_ID_DEL:
   Action    : remove items from playlist.
   Parameters:
     1: ID of the playlist.


176
What to do with events ?
177 178 179 180 181
=======================

When creating your event, you must assign an ID to each of them.
Now you have to associate events with controls.
Some attributes of some controls are supposed to be filled with those IDs. That
182
is to say that when the action corresponding to the attribute will be done,
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
the event associated will be executed. The best exemple is assigning an event
to the 'onclick' attribute of a button control. The event will be executed when
clicking on the button.
You can execute several events. To do this you just have to separate them with
semicolon.
Exemple:
  <ButtonControl [...] onclick="event1;event2;event3"/>


Do I have to create every event for each skin ?
===============================================

No, a set of predefined events are present. Here they are with their ID and
shortcut.

  ID           Shortcut     Description

200
  tray                      Hide or show in the system tray.
201 202 203 204 205 206
  taskbar      CTRL+B       Hide or show in the taskbar.
  play         X            Play.
  pause        C            Pause.
  stop         V            Stop.
  next         B            Next file.
  prev         Z            Previous file.
207 208
  slow                      Play slower.
  fast                      Play faster.
209 210 211 212 213 214 215 216
  fullscreen   F            Switch to fullscreen mode.
  mute                      Mute the sound.
  volume_up
  volume_down
  quit         CTRL+C       Quit VLC.
  open         CTRL+O       Open a file.
  add_file     CTRL+A       Add a file.
  load_skin    CTRL+S       Change skin.
217
  on_top       CTRL+T       Toggle the "Always on top" status
218 219 220 221
  show_prefs                Show the preferences dialog box.
  show_info                 Show the FileInfo dialog box.
  show_log                  Show the Messages dialog box.
  hide_log                  Hide the Messages dialog box.
222