Gtk2
[ class tree: Gtk2 ] [ index: Gtk2 ] [ all elements ]

Class: Gtk2_FileDrop

Source Location: /Gtk2_FileDrop-1.0.0/FileDrop.php

Class Overview


A class which makes it easy to make a GtkWidget accept the dropping of files or folders


Author(s):

Methods


Inherited Variables

Inherited Methods


Class Details

[line 47]
A class which makes it easy to make a GtkWidget accept the dropping of files or folders
  • Author: Christian Weiske <cweiske@php.net>
  • Todo:
    • reject files when moving the dragging mouse over the widget, just like opera does how does this work? I don't know, but I suppose I should
  • Example: example not found
  • License: PHP


[ Top ]


Method Detail

attach   [line 68]

boolean attach( GtkWidget $widget, array $arTypes, [mixed $objCallback = null], [boolean $bSetText = true])

Prepares a widget to accept file drops.
  • Return: If all was ok

Parameters:

GtkWidget   $widget   —  The widget which shall accept files
array   $arTypes   —  List of MIME-Types to accept OR extensions, beginning with a dot "."
mixed   $objCallback   —  Callback to call when a drop with valid files happened
boolean   $bSetText   —  If the widget's text/label/content shall be changed automatically

[ Top ]

attachDirectory   [line 103]

boolean attachDirectory( GtkWidget $widget)

Prepares a widget to accept directories only.

Just a shortcut for the exhausted programmer.

  • Return: If all was ok

Parameters:

GtkWidget   $widget   —  The widget which shall accept directories

[ Top ]

dragDataReceived   [line 120]

void dragDataReceived( GtkWidget $widget, GdkDragContext $context, int $x, int $y, int $data, int $info, $time)

Data have been dropped over the widget.

Parameters:

GtkWidget   $widget   —  The widget on which the data have been dropped
GdkDragContext   $context   —  The context of the drop
int   $x   —  X position
int   $y   —  Y position
int   $data   —  Info parameter (0 in our case)
int   $info   —  The time on which the event happened
   $time   — 

[ Top ]

getFileExtension   [line 285]

string getFileExtension( string $strFile)

Returns the extension if a filename including the leading dot.
  • Return: The extension with a leading dot

Parameters:

string   $strFile   —  The filename

[ Top ]

getMimeType   [line 307]

string getMimeType( string $strFile)

Determines the mime-type for the given file.
  • Return: The MIME type or FALSE in the case of an error

Parameters:

string   $strFile   —  The file name

[ Top ]

getPathFromUrilistEntry   [line 225]

string getPathFromUrilistEntry( string $strUriFile)

Converts a file path gotten from a text/uri-list drop to a usable local filepath.

Php functions like parse_url can't be used as it is likely that the dropped URI is no real URI but a strange thing which tries to look like one See the explanation at: http://gtk.php.net/manual/en/tutorials.filednd.urilist.php

  • Return: The usable local filepath

Parameters:

string   $strUriFile   —  The line from the uri-list

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:48:47 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.