Class: VRMediaView

Inherits:
VRControl show all
Defined in:
lib/vr/vrmmedia.rb,
lib/vr/compat/vrmmedia.rb

Constant Summary collapse

MCI_CLOSE =
0x0804
MCI_PLAY =
0x0806
MCI_SEEK =
0x0807
MCI_STOP =
0x0808
MCI_PAUSE =
0x0809
MCI_STEP =
0x080E
MCIWNDM_GETPOSITION =

A message

(WMsg::WM_USER + 102)
MCIWNDM_GETLENGTH =
(WMsg::WM_USER + 104)
MCIWNDM_GETMODE =

A message

(WMsg::WM_USER + 106)
MCIWNDM_EJECT =
(WMsg::WM_USER + 107)
MCIWNDM_SETZOOM =
(WMsg::WM_USER + 108)
MCIWNDM_GETZOOM =
(WMsg::WM_USER + 109)
MCIWNDM_SETVOLUME =
(WMsg::WM_USER + 110)
MCIWNDM_GETVOLUME =
(WMsg::WM_USER + 111)
MCIWNDM_SETSPEED =
(WMsg::WM_USER + 112)
MCIWNDM_GETSPEED =
(WMsg::WM_USER + 113)
MCIWNDM_GETERROR =

A message

(WMsg::WM_USER + 128)
MCIWNDM_CAN_PLAY =
(WMsg::WM_USER + 144)
MCIWNDM_CAN_WINDOW =
(WMsg::WM_USER + 145)
MCIWNDM_CAN_EJECT =
(WMsg::WM_USER + 148)
MCIWNDM_CAN_CONFIG =
(WMsg::WM_USER + 149)
MCIWNDM_SETOWNER =
(WMsg::WM_USER + 152)
MCIWNDM_OPEN =

A message

(WMsg::WM_USER + 153)
MCIWNDM_NOTIFYMODE =

wparam = hwnd, lparam = mode

(WMsg::WM_USER + 200)
MCIWNDM_NOTIFYSIZE =

wparam = hwnd

(WMsg::WM_USER + 202)
MCIWNDM_NOTIFYMEDIA =

wparam = hwnd, lparam = fn

(WMsg::WM_USER + 203)
MCIWNDM_NOTIFYERROR =

wparam = hwnd, lparam = error

(WMsg::WM_USER + 205)
MCIWNDF_NOPLAYBAR =
0x0002
MCIWNDF_NOAUTOSIZEMOVIE =
0x0004
MCIWNDF_NOMENU =
0x0008
MCIWNDF_SIMPLE =
0xe
WINCLASSINFO =
["MCIWndClass",0x5500 | 0x400 | 0x880 ]

Instance Attribute Summary collapse

Attributes inherited from VRControl

#handlers, #name, #parent

Attributes inherited from VRWinComponent

#parent, #screen

Instance Method Summary collapse

Methods inherited from VRControl

Controltype, #add_parentcall, #call_parenthandler, #create, #setFont

Methods inherited from VRWinComponent

#_init, #create, #exwinstyle, #hide, #maximizebox, #maximizebox=, #minimizebox, #minimizebox=, #setscreen, #sizebox, #sizebox=, #tabstop, #tabstop=, #winstyle

Instance Attribute Details

#_vr_mmhandlersObject (readonly)

Returns the value of attribute _vr_mmhandlers.



167
168
169
# File 'lib/vr/vrmmedia.rb', line 167

def _vr_mmhandlers
  @_vr_mmhandlers
end

Instance Method Details

#addMMHandler(msg, handlername, handlertype, argparsestr) ⇒ Object

notify:mode,error,size,media



210
211
212
213
214
# File 'lib/vr/vrmmedia.rb', line 210

def addMMHandler(msg,handlername,handlertype,argparsestr)
  @_vr_mmhandlers={} unless defined? @_vr_mmhandlers
  @_vr_mmhandlers[msg]=[] unless @_vr_mmhandlers[msg]
  @_vr_mmhandlers[msg].push [handlername,handlertype,argparsestr]
end

#deleteMMHandler(msg, handlername) ⇒ Object



216
217
218
219
220
221
# File 'lib/vr/vrmmedia.rb', line 216

def deleteMMHandler(msg,handlername)
  return false unless defined?(@_vr_mmhandlers) and @_vr_mmhandlers[msg]
  @_vr_mmhandlers.delete_if do |shandler|
    shandler[0] != (PREHANDLERSTR+handlername).intern
  end
end

#ejectObject



240
# File 'lib/vr/vrmmedia.rb', line 240

def eject()        sendMessage MCI_EJECT,0,0 end

#ejectable?Boolean

Returns:

  • (Boolean)


247
# File 'lib/vr/vrmmedia.rb', line 247

def ejectable?()   sendMessage(MCIWNDM_CAN_EJECT,0,0)!=0 end

#errorstringObject



279
280
281
282
283
# File 'lib/vr/vrmmedia.rb', line 279

def errorstring
  p="\0                               "*8  #256bytes
  sendMessage MCIWNDM_GETERROR,255,p
  p
end

#lengthObject



250
# File 'lib/vr/vrmmedia.rb', line 250

def length()       sendMessage MCIWNDM_GETLENGTH,0,0 end

#mediacloseObject



239
# File 'lib/vr/vrmmedia.rb', line 239

def mediaclose()   sendMessage MCI_CLOSE,0,0 end

#mediaopen(filename, flag = 0) ⇒ Object



231
232
233
234
# File 'lib/vr/vrmmedia.rb', line 231

def mediaopen(filename,flag=0)
  sendMessage  MCIWNDM_OPEN,flag,filename
  sendMessage  MCIWNDM_SETOWNER,@parent.hWnd,0
end

#modeObject



260
261
262
263
264
# File 'lib/vr/vrmmedia.rb', line 260

def mode
  p="\0                               "  #32bytes
  sendMessage MCIWNDM_GETMODE,31,p
  p
end

#modestring(n) ⇒ Object



266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/vr/vrmmedia.rb', line 266

def modestring(n)
  case n
    when 524; "not_ready"
    when 525; "stopped"
    when 526; "playing"
    when 527; "recording"
    when 528; "seeking"
    when 529; "paused"
    when 530; "open"
    else;     "unknown_mode"
  end
end

#pauseObject



237
# File 'lib/vr/vrmmedia.rb', line 237

def pause()        sendMessage MCI_PAUSE,0,0 end

#playObject



236
# File 'lib/vr/vrmmedia.rb', line 236

def play()         sendMessage MCI_PLAY,0,0 end

#playable?Boolean

Returns:

  • (Boolean)


246
# File 'lib/vr/vrmmedia.rb', line 246

def playable?()    sendMessage(MCIWNDM_CAN_PLAY,0,0)!=0 end

#positionObject



251
# File 'lib/vr/vrmmedia.rb', line 251

def position()     sendMessage MCI_SEEK,0,0 end

#seek(pos) ⇒ Object



242
# File 'lib/vr/vrmmedia.rb', line 242

def seek(pos)      sendMessage MCI_SEEK,0,pos.to_i end

#seekEndObject



244
# File 'lib/vr/vrmmedia.rb', line 244

def seekEnd()      sendMessage MCI_SEEK,0,-2 end

#seekHomeObject



243
# File 'lib/vr/vrmmedia.rb', line 243

def seekHome()     sendMessage MCI_SEEK,0,-1 end

#speedObject



256
# File 'lib/vr/vrmmedia.rb', line 256

def speed()        sendMessage MCIWNDM_GETSPEED,0,0 end

#speed=(sp) ⇒ Object



255
# File 'lib/vr/vrmmedia.rb', line 255

def speed=(sp)     sendMessage MCIWNDM_SETSPEED,0,sp.to_i end

#step(n = 1) ⇒ Object



241
# File 'lib/vr/vrmmedia.rb', line 241

def step(n=1)      sendMessage MCI_STEP,0,n.to_i end

#stopObject



238
# File 'lib/vr/vrmmedia.rb', line 238

def stop()         sendMessage MCI_STOP,0,0 end

#volumeObject



254
# File 'lib/vr/vrmmedia.rb', line 254

def volume()       sendMessage MCIWNDM_GETVOLUME,0,0 end

#volume=(vl) ⇒ Object



253
# File 'lib/vr/vrmmedia.rb', line 253

def volume=(vl)    sendMessage MCIWNDM_SETVOLUME,0,vl.to_i end

#vr_e_compatibilityObject



7
8
9
10
11
# File 'lib/vr/compat/vrmmedia.rb', line 7

def vr_e_compatibility
  addMMHandler(VRMediaView::MCIWNDM_NOTIFYMODE,"modechange",MSGTYPE::ARGINT,nil)
  addMMHandler(VRMediaView::MCIWNDM_NOTIFYSIZE, "sizechange",MSGTYPE::ARGNONE,nil)
  addMMHandler(VRMediaView::MCIWNDM_NOTIFYMEDIA,"mediachange",MSGTYPE::ARGSTRING,nil)
end

#vrinitObject



223
224
225
226
227
228
229
# File 'lib/vr/vrmmedia.rb', line 223

def vrinit
  super
  addMMHandler(VRMediaView::MCIWNDM_NOTIFYERROR,"onerror",MSGTYPE::ARGINT,nil)
  addMMHandler(VRMediaView::MCIWNDM_NOTIFYMODE,"modechanged",MSGTYPE::ARGINT,nil)
  addMMHandler(VRMediaView::MCIWNDM_NOTIFYSIZE, "sizechanged",MSGTYPE::ARGNONE,nil)
  addMMHandler(VRMediaView::MCIWNDM_NOTIFYMEDIA,"mediachanged",MSGTYPE::ARGSTRING,nil)
end

#vrinitnewObject



13
14
15
16
17
18
19
# File 'lib/vr/compat/vrmmedia.rb', line 13

def vrinit
  super
  addMMHandler(VRMediaView::MCIWNDM_NOTIFYERROR,"onerror",MSGTYPE::ARGINT,nil)
  addMMHandler(VRMediaView::MCIWNDM_NOTIFYMODE,"modechanged",MSGTYPE::ARGINT,nil)
  addMMHandler(VRMediaView::MCIWNDM_NOTIFYSIZE, "sizechanged",MSGTYPE::ARGNONE,nil)
  addMMHandler(VRMediaView::MCIWNDM_NOTIFYMEDIA,"mediachanged",MSGTYPE::ARGSTRING,nil)
end

#window?Boolean

Returns:

  • (Boolean)


248
# File 'lib/vr/vrmmedia.rb', line 248

def window?()      sendMessage(MCIWNDM_CAN_WINDOW,0,0)!=0 end

#zoomObject



258
# File 'lib/vr/vrmmedia.rb', line 258

def zoom()         sendMessage MCIWNDM_GETZOOM,0,0 end

#zoom=(zm) ⇒ Object



257
# File 'lib/vr/vrmmedia.rb', line 257

def zoom=(zm)      sendMessage MCIWNDM_SETZOOM,0,zm.to_i end