X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1f05e33b7dd37d68f9c3b24f8f75161e4e2fd48d..3cebfef17b54f9dacc386f090827b8badb2773d2:/wxPython/src/msw/misc.py diff --git a/wxPython/src/msw/misc.py b/wxPython/src/msw/misc.py index 6e38e457f8..65fb21a8a1 100644 --- a/wxPython/src/msw/misc.py +++ b/wxPython/src/msw/misc.py @@ -948,7 +948,7 @@ class Timer(core.EvtHandler): self.this = newobj.this self.thisown = 1 del newobj.thisown - self._setCallbackInfo(self, Timer) + self._setCallbackInfo(self, Timer, 0) def __del__(self, destroy=_misc.delete_Timer): """__del__()""" @@ -957,7 +957,7 @@ class Timer(core.EvtHandler): except: pass def _setCallbackInfo(*args, **kwargs): - """_setCallbackInfo(PyObject self, PyObject _class)""" + """_setCallbackInfo(PyObject self, PyObject _class, int incref=1)""" return _misc.Timer__setCallbackInfo(*args, **kwargs) def SetOwner(*args, **kwargs): @@ -1008,7 +1008,7 @@ class PyTimer(Timer): EVT_TIMER = wx.PyEventBinder( wxEVT_TIMER, 1 ) - + class TimerEvent(core.Event): def __repr__(self): @@ -2478,6 +2478,27 @@ CONFIG_USE_GLOBAL_FILE = _misc.CONFIG_USE_GLOBAL_FILE CONFIG_USE_RELATIVE_PATH = _misc.CONFIG_USE_RELATIVE_PATH CONFIG_USE_NO_ESCAPE_CHARACTERS = _misc.CONFIG_USE_NO_ESCAPE_CHARACTERS class ConfigBase(object): + """ + wx.ConfigBase class defines the basic interface of all config + classes. It can not be used by itself (it is an abstract base + class) and you will always use one of its derivations: wx.Config + or wx.FileConfig. + + wx.ConfigBase organizes the items in a tree-like structure, + modeled after the Unix/Dos filesystem. There are groups that act + like directories and entries, key/value pairs that act like + files. There is always one current group given by the current + path. As in the file system case, to specify a key in the config + class you must use a path to it. Config classes also support the + notion of the current group, which makes it possible to use + relative paths. + + Keys are pairs "key_name = value" where value may be of string, + integer floating point or boolean, you can not store binary data + without first encoding it as a string. For performance reasons + items should be kept small, no more than a couple kilobytes. + + """ def __init__(self): raise RuntimeError, "No constructor defined" def __repr__(self): return "<%s.%s; proxy of C++ wxConfigBase instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) @@ -2493,147 +2514,311 @@ class ConfigBase(object): Type_Integer = _misc.ConfigBase_Type_Integer Type_Float = _misc.ConfigBase_Type_Float def Set(*args, **kwargs): - """Set(ConfigBase pConfig) -> ConfigBase""" + """ + Set(ConfigBase config) -> ConfigBase + + Sets the global config object (the one returned by Get) and + returns a reference to the previous global config object. + """ return _misc.ConfigBase_Set(*args, **kwargs) Set = staticmethod(Set) def Get(*args, **kwargs): - """Get(bool createOnDemand=True) -> ConfigBase""" + """ + Get(bool createOnDemand=True) -> ConfigBase + + Returns the current global config object, creating one if neccessary. + """ return _misc.ConfigBase_Get(*args, **kwargs) Get = staticmethod(Get) def Create(*args, **kwargs): - """Create() -> ConfigBase""" + """ + Create() -> ConfigBase + + Create and return a new global config object. This function will + create the "best" implementation of wx.Config available for the + current platform. + """ return _misc.ConfigBase_Create(*args, **kwargs) Create = staticmethod(Create) def DontCreateOnDemand(*args, **kwargs): - """DontCreateOnDemand()""" + """ + DontCreateOnDemand() + + Should Get() try to create a new log object if there isn't a current one? + """ return _misc.ConfigBase_DontCreateOnDemand(*args, **kwargs) DontCreateOnDemand = staticmethod(DontCreateOnDemand) def SetPath(*args, **kwargs): - """SetPath(String strPath)""" + """ + SetPath(String path) + + Set current path: if the first character is '/', it's the absolute path, + otherwise it's a relative path. '..' is supported. If the strPath + doesn't exist it is created. + """ return _misc.ConfigBase_SetPath(*args, **kwargs) def GetPath(*args, **kwargs): - """GetPath() -> String""" + """ + GetPath() -> String + + Retrieve the current path (always as absolute path) + """ return _misc.ConfigBase_GetPath(*args, **kwargs) def GetFirstGroup(*args, **kwargs): - """GetFirstGroup() -> PyObject""" + """ + GetFirstGroup() -> (more, value, index) + + Allows enumerating the subgroups in a config object. Returns + a tuple containing a flag indicating there are more items, the + name of the current item, and an index to pass to GetNextGroup to + fetch the next item. + """ return _misc.ConfigBase_GetFirstGroup(*args, **kwargs) def GetNextGroup(*args, **kwargs): - """GetNextGroup(long index) -> PyObject""" + """ + GetNextGroup(long index) -> (more, value, index) + + Allows enumerating the subgroups in a config object. Returns + a tuple containing a flag indicating there are more items, the + name of the current item, and an index to pass to GetNextGroup to + fetch the next item. + """ return _misc.ConfigBase_GetNextGroup(*args, **kwargs) def GetFirstEntry(*args, **kwargs): - """GetFirstEntry() -> PyObject""" + """ + GetFirstEntry() -> (more, value, index) + + Allows enumerating the entries in the current group in a config + object. Returns a tuple containing a flag indicating there are + more items, the name of the current item, and an index to pass to + GetNextGroup to fetch the next item. + """ return _misc.ConfigBase_GetFirstEntry(*args, **kwargs) def GetNextEntry(*args, **kwargs): - """GetNextEntry(long index) -> PyObject""" + """ + GetNextEntry(long index) -> (more, value, index) + + Allows enumerating the entries in the current group in a config + object. Returns a tuple containing a flag indicating there are + more items, the name of the current item, and an index to pass to + GetNextGroup to fetch the next item. + """ return _misc.ConfigBase_GetNextEntry(*args, **kwargs) def GetNumberOfEntries(*args, **kwargs): - """GetNumberOfEntries(bool bRecursive=False) -> size_t""" + """ + GetNumberOfEntries(bool recursive=False) -> size_t + + Get the number of entries in the current group, with or + without its subgroups. + """ return _misc.ConfigBase_GetNumberOfEntries(*args, **kwargs) def GetNumberOfGroups(*args, **kwargs): - """GetNumberOfGroups(bool bRecursive=False) -> size_t""" + """ + GetNumberOfGroups(bool recursive=False) -> size_t + + Get the number of subgroups in the current group, with or + without its subgroups. + """ return _misc.ConfigBase_GetNumberOfGroups(*args, **kwargs) def HasGroup(*args, **kwargs): - """HasGroup(String strName) -> bool""" + """ + HasGroup(String name) -> bool + + Returns True if the group by this name exists + """ return _misc.ConfigBase_HasGroup(*args, **kwargs) def HasEntry(*args, **kwargs): - """HasEntry(String strName) -> bool""" + """ + HasEntry(String name) -> bool + + Returns True if the entry by this name exists + """ return _misc.ConfigBase_HasEntry(*args, **kwargs) def Exists(*args, **kwargs): - """Exists(String strName) -> bool""" + """ + Exists(String name) -> bool + + Returns True if either a group or an entry with a given name exists + """ return _misc.ConfigBase_Exists(*args, **kwargs) def GetEntryType(*args, **kwargs): - """GetEntryType(String name) -> int""" + """ + GetEntryType(String name) -> int + + Get the type of the entry. Returns one of the wx.Config.Type_XXX values. + """ return _misc.ConfigBase_GetEntryType(*args, **kwargs) def Read(*args, **kwargs): - """Read(String key, String defaultVal=EmptyString) -> String""" + """ + Read(String key, String defaultVal=EmptyString) -> String + + Returns the value of key if it exists, defaultVal otherwise. + """ return _misc.ConfigBase_Read(*args, **kwargs) def ReadInt(*args, **kwargs): - """ReadInt(String key, long defaultVal=0) -> long""" + """ + ReadInt(String key, long defaultVal=0) -> long + + Returns the value of key if it exists, defaultVal otherwise. + """ return _misc.ConfigBase_ReadInt(*args, **kwargs) def ReadFloat(*args, **kwargs): - """ReadFloat(String key, double defaultVal=0.0) -> double""" + """ + ReadFloat(String key, double defaultVal=0.0) -> double + + Returns the value of key if it exists, defaultVal otherwise. + """ return _misc.ConfigBase_ReadFloat(*args, **kwargs) def ReadBool(*args, **kwargs): - """ReadBool(String key, bool defaultVal=False) -> bool""" + """ + ReadBool(String key, bool defaultVal=False) -> bool + + Returns the value of key if it exists, defaultVal otherwise. + """ return _misc.ConfigBase_ReadBool(*args, **kwargs) def Write(*args, **kwargs): - """Write(String key, String value) -> bool""" + """ + Write(String key, String value) -> bool + + write the value (return True on success) + """ return _misc.ConfigBase_Write(*args, **kwargs) def WriteInt(*args, **kwargs): - """WriteInt(String key, long value) -> bool""" + """ + WriteInt(String key, long value) -> bool + + write the value (return True on success) + """ return _misc.ConfigBase_WriteInt(*args, **kwargs) def WriteFloat(*args, **kwargs): - """WriteFloat(String key, double value) -> bool""" + """ + WriteFloat(String key, double value) -> bool + + write the value (return True on success) + """ return _misc.ConfigBase_WriteFloat(*args, **kwargs) def WriteBool(*args, **kwargs): - """WriteBool(String key, bool value) -> bool""" + """ + WriteBool(String key, bool value) -> bool + + write the value (return True on success) + """ return _misc.ConfigBase_WriteBool(*args, **kwargs) def Flush(*args, **kwargs): - """Flush(bool bCurrentOnly=False) -> bool""" + """ + Flush(bool currentOnly=False) -> bool + + permanently writes all changes + """ return _misc.ConfigBase_Flush(*args, **kwargs) def RenameEntry(*args, **kwargs): - """RenameEntry(String oldName, String newName) -> bool""" + """ + RenameEntry(String oldName, String newName) -> bool + + Rename an entry. Returns False on failure (probably because the new + name is already taken by an existing entry) + """ return _misc.ConfigBase_RenameEntry(*args, **kwargs) def RenameGroup(*args, **kwargs): - """RenameGroup(String oldName, String newName) -> bool""" + """ + RenameGroup(String oldName, String newName) -> bool + + Rename aa group. Returns False on failure (probably because the new + name is already taken by an existing entry) + """ return _misc.ConfigBase_RenameGroup(*args, **kwargs) def DeleteEntry(*args, **kwargs): - """DeleteEntry(String key, bool bDeleteGroupIfEmpty=True) -> bool""" + """ + DeleteEntry(String key, bool deleteGroupIfEmpty=True) -> bool + + Deletes the specified entry and the group it belongs to if + it was the last key in it and the second parameter is True + """ return _misc.ConfigBase_DeleteEntry(*args, **kwargs) def DeleteGroup(*args, **kwargs): - """DeleteGroup(String key) -> bool""" + """ + DeleteGroup(String key) -> bool + + Delete the group (with all subgroups) + """ return _misc.ConfigBase_DeleteGroup(*args, **kwargs) def DeleteAll(*args, **kwargs): - """DeleteAll() -> bool""" - return _misc.ConfigBase_DeleteAll(*args, **kwargs) + """ + DeleteAll() -> bool - def IsExpandingEnvVars(*args, **kwargs): - """IsExpandingEnvVars() -> bool""" - return _misc.ConfigBase_IsExpandingEnvVars(*args, **kwargs) + Delete the whole underlying object (disk file, registry key, ...) + primarly intended for use by desinstallation routine. + """ + return _misc.ConfigBase_DeleteAll(*args, **kwargs) def SetExpandEnvVars(*args, **kwargs): - """SetExpandEnvVars(bool bDoIt=True)""" + """ + SetExpandEnvVars(bool doIt=True) + + We can automatically expand environment variables in the config entries + (this option is on by default, you can turn it on/off at any time) + """ return _misc.ConfigBase_SetExpandEnvVars(*args, **kwargs) + def IsExpandingEnvVars(*args, **kwargs): + """ + IsExpandingEnvVars() -> bool + + Are we currently expanding environment variables? + """ + return _misc.ConfigBase_IsExpandingEnvVars(*args, **kwargs) + def SetRecordDefaults(*args, **kwargs): - """SetRecordDefaults(bool bDoIt=True)""" + """ + SetRecordDefaults(bool doIt=True) + + Set whether the config objec should record default values. + """ return _misc.ConfigBase_SetRecordDefaults(*args, **kwargs) def IsRecordingDefaults(*args, **kwargs): - """IsRecordingDefaults() -> bool""" + """ + IsRecordingDefaults() -> bool + + Are we currently recording default values? + """ return _misc.ConfigBase_IsRecordingDefaults(*args, **kwargs) def ExpandEnvVars(*args, **kwargs): - """ExpandEnvVars(String str) -> String""" + """ + ExpandEnvVars(String str) -> String + + Expand any environment variables in str and return the result + """ return _misc.ConfigBase_ExpandEnvVars(*args, **kwargs) def GetAppName(*args, **kwargs): @@ -2669,56 +2854,52 @@ class ConfigBasePtr(ConfigBase): _misc.ConfigBase_swigregister(ConfigBasePtr) def ConfigBase_Set(*args, **kwargs): - """ConfigBase_Set(ConfigBase pConfig) -> ConfigBase""" + """ + ConfigBase_Set(ConfigBase config) -> ConfigBase + + Sets the global config object (the one returned by Get) and + returns a reference to the previous global config object. + """ return _misc.ConfigBase_Set(*args, **kwargs) def ConfigBase_Get(*args, **kwargs): - """ConfigBase_Get(bool createOnDemand=True) -> ConfigBase""" + """ + ConfigBase_Get(bool createOnDemand=True) -> ConfigBase + + Returns the current global config object, creating one if neccessary. + """ return _misc.ConfigBase_Get(*args, **kwargs) def ConfigBase_Create(*args, **kwargs): - """ConfigBase_Create() -> ConfigBase""" + """ + ConfigBase_Create() -> ConfigBase + + Create and return a new global config object. This function will + create the "best" implementation of wx.Config available for the + current platform. + """ return _misc.ConfigBase_Create(*args, **kwargs) def ConfigBase_DontCreateOnDemand(*args, **kwargs): - """ConfigBase_DontCreateOnDemand()""" - return _misc.ConfigBase_DontCreateOnDemand(*args, **kwargs) - -class ConfigPathChanger(object): - def __repr__(self): - return "<%s.%s; proxy of C++ wxConfigPathChanger instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) - def __init__(self, *args, **kwargs): - """__init__(ConfigBase pContainer, String strEntry) -> ConfigPathChanger""" - newobj = _misc.new_ConfigPathChanger(*args, **kwargs) - self.this = newobj.this - self.thisown = 1 - del newobj.thisown - def __del__(self, destroy=_misc.delete_ConfigPathChanger): - """__del__()""" - try: - if self.thisown: destroy(self) - except: pass - - def Name(*args, **kwargs): - """Name() -> String""" - return _misc.ConfigPathChanger_Name(*args, **kwargs) - + """ + ConfigBase_DontCreateOnDemand() -class ConfigPathChangerPtr(ConfigPathChanger): - def __init__(self, this): - self.this = this - if not hasattr(self,"thisown"): self.thisown = 0 - self.__class__ = ConfigPathChanger -_misc.ConfigPathChanger_swigregister(ConfigPathChangerPtr) + Should Get() try to create a new log object if there isn't a current one? + """ + return _misc.ConfigBase_DontCreateOnDemand(*args, **kwargs) class Config(ConfigBase): + """ + This ConfigBase-derived class will use the registry on Windows, + and will be a wx.FileConfig on other platforms. + """ def __repr__(self): return "<%s.%s; proxy of C++ wxConfig instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): """ __init__(String appName=EmptyString, String vendorName=EmptyString, String localFilename=EmptyString, String globalFilename=EmptyString, - long style=0) -> Config + long style=wxCONFIG_USE_LOCAL_FILE|wxCONFIG_USE_GLOBAL_FILE) -> Config """ newobj = _misc.new_Config(*args, **kwargs) self.this = newobj.this @@ -2739,13 +2920,14 @@ class ConfigPtr(Config): _misc.Config_swigregister(ConfigPtr) class FileConfig(ConfigBase): + """This config class will use a file for storage on all platforms.""" def __repr__(self): return "<%s.%s; proxy of C++ wxFileConfig instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): """ __init__(String appName=EmptyString, String vendorName=EmptyString, String localFilename=EmptyString, String globalFilename=EmptyString, - long style=0) -> FileConfig + long style=wxCONFIG_USE_LOCAL_FILE|wxCONFIG_USE_GLOBAL_FILE) -> FileConfig """ newobj = _misc.new_FileConfig(*args, **kwargs) self.this = newobj.this @@ -2765,9 +2947,53 @@ class FileConfigPtr(FileConfig): self.__class__ = FileConfig _misc.FileConfig_swigregister(FileConfigPtr) +class ConfigPathChanger(object): + """ + A handy little class which changes current path to the path of + given entry and restores it in the destructoir: so if you declare + a local variable of this type, you work in the entry directory + and the path is automatically restored when the function returns. + """ + def __repr__(self): + return "<%s.%s; proxy of C++ wxConfigPathChanger instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) + def __init__(self, *args, **kwargs): + """__init__(ConfigBase config, String entry) -> ConfigPathChanger""" + newobj = _misc.new_ConfigPathChanger(*args, **kwargs) + self.this = newobj.this + self.thisown = 1 + del newobj.thisown + def __del__(self, destroy=_misc.delete_ConfigPathChanger): + """__del__()""" + try: + if self.thisown: destroy(self) + except: pass + + def Name(*args, **kwargs): + """ + Name() -> String + + Get the key name + """ + return _misc.ConfigPathChanger_Name(*args, **kwargs) + + +class ConfigPathChangerPtr(ConfigPathChanger): + def __init__(self, this): + self.this = this + if not hasattr(self,"thisown"): self.thisown = 0 + self.__class__ = ConfigPathChanger +_misc.ConfigPathChanger_swigregister(ConfigPathChangerPtr) + def ExpandEnvVars(*args, **kwargs): - """ExpandEnvVars(String sz) -> String""" + """ + ExpandEnvVars(String sz) -> String + + Replace environment variables ($SOMETHING) with their values. The + format is $VARNAME or ${VARNAME} where VARNAME contains + alphanumeric characters and '_' only. '$' must be escaped ('\$') + in order to be taken literally. + """ return _misc.ExpandEnvVars(*args, **kwargs) #--------------------------------------------------------------------------- @@ -3992,10 +4218,27 @@ DF_PRIVATE = _misc.DF_PRIVATE DF_HTML = _misc.DF_HTML DF_MAX = _misc.DF_MAX class DataFormat(object): + """ + A wx.DataFormat is an encapsulation of a platform-specific format + handle which is used by the system for the clipboard and drag and + drop operations. The applications are usually only interested in, + for example, pasting data from the clipboard only if the data is + in a format the program understands. A data format is is used to + uniquely identify this format. + + On the system level, a data format is usually just a number + (CLIPFORMAT under Windows or Atom under X11, for example). + """ def __repr__(self): return "<%s.%s; proxy of C++ wxDataFormat instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): - """__init__(int type) -> DataFormat""" + """ + __init__(int type) -> DataFormat + + Constructs a data format object for one of the standard data + formats or an empty data object (use SetType or SetId later in + this case) + """ newobj = _misc.new_DataFormat(*args, **kwargs) self.this = newobj.this self.thisown = 1 @@ -4021,19 +4264,35 @@ class DataFormat(object): return _misc.DataFormat___ne__(*args) def SetType(*args, **kwargs): - """SetType(int format)""" + """ + SetType(int format) + + Sets the format to the given value, which should be one of wx.DF_XXX constants. + """ return _misc.DataFormat_SetType(*args, **kwargs) def GetType(*args, **kwargs): - """GetType() -> int""" + """ + GetType() -> int + + Returns the platform-specific number identifying the format. + """ return _misc.DataFormat_GetType(*args, **kwargs) def GetId(*args, **kwargs): - """GetId() -> String""" + """ + GetId() -> String + + Returns the name of a custom format (this function will fail for a standard format). + """ return _misc.DataFormat_GetId(*args, **kwargs) def SetId(*args, **kwargs): - """SetId(String format)""" + """ + SetId(String format) + + Sets the format to be the custom format identified by the given name. + """ return _misc.DataFormat_SetId(*args, **kwargs) @@ -4046,7 +4305,11 @@ _misc.DataFormat_swigregister(DataFormatPtr) DefaultDateTime = cvar.DefaultDateTime def CustomDataFormat(*args, **kwargs): - """CustomDataFormat(String format) -> DataFormat""" + """ + CustomDataFormat(String format) -> DataFormat + + Constructs a data format object for a custom format identified by its name. + """ val = _misc.new_CustomDataFormat(*args, **kwargs) val.thisown = 1 return val @@ -4447,8 +4710,8 @@ class DropTarget(object): def __repr__(self): return "<%s.%s; proxy of C++ wxPyDropTarget instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) def __init__(self, *args, **kwargs): - """PyDropTarget(DataObject dataObject=None) -> DropTarget""" - newobj = _misc.new_PyDropTarget(*args, **kwargs) + """__init__(DataObject dataObject=None) -> DropTarget""" + newobj = _misc.new_DropTarget(*args, **kwargs) self.this = newobj.this self.thisown = 1 del newobj.thisown @@ -4760,4 +5023,252 @@ class ClipboardLockerPtr(ClipboardLocker): _misc.ClipboardLocker_swigregister(ClipboardLockerPtr) TheClipboard = cvar.TheClipboard +#--------------------------------------------------------------------------- + +class VideoMode(object): + """A simple struct containing video mode parameters for a display""" + def __repr__(self): + return "<%s.%s; proxy of C++ wxVideoMode instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) + def __init__(self, *args, **kwargs): + """ + __init__(int width=0, int height=0, int depth=0, int freq=0) -> VideoMode + + A simple struct containing video mode parameters for a display + """ + newobj = _misc.new_VideoMode(*args, **kwargs) + self.this = newobj.this + self.thisown = 1 + del newobj.thisown + def __del__(self, destroy=_misc.delete_VideoMode): + """__del__()""" + try: + if self.thisown: destroy(self) + except: pass + + def Matches(*args, **kwargs): + """ + Matches(VideoMode other) -> bool + + Returns true if this mode matches the other one in the sense that + all non zero fields of the other mode have the same value in this + one (except for refresh which is allowed to have a greater value) + """ + return _misc.VideoMode_Matches(*args, **kwargs) + + def GetWidth(*args, **kwargs): + """ + GetWidth() -> int + + Returns the screen width in pixels (e.g. 640*480), 0 means + unspecified + """ + return _misc.VideoMode_GetWidth(*args, **kwargs) + + def GetHeight(*args, **kwargs): + """ + GetHeight() -> int + + Returns the screen width in pixels (e.g. 640*480), 0 means + unspecified + """ + return _misc.VideoMode_GetHeight(*args, **kwargs) + + def GetDepth(*args, **kwargs): + """ + GetDepth() -> int + + Returns the screen's bits per pixel (e.g. 32), 1 is monochrome + and 0 means unspecified/known + """ + return _misc.VideoMode_GetDepth(*args, **kwargs) + + def IsOk(*args, **kwargs): + """ + IsOk() -> bool + + returns true if the object has been initialized + """ + return _misc.VideoMode_IsOk(*args, **kwargs) + + def __nonzero__(self): return self.IsOk() + def __eq__(*args, **kwargs): + """__eq__(VideoMode other) -> bool""" + return _misc.VideoMode___eq__(*args, **kwargs) + + def __ne__(*args, **kwargs): + """__ne__(VideoMode other) -> bool""" + return _misc.VideoMode___ne__(*args, **kwargs) + + w = property(_misc.VideoMode_w_get, _misc.VideoMode_w_set) + h = property(_misc.VideoMode_h_get, _misc.VideoMode_h_set) + bpp = property(_misc.VideoMode_bpp_get, _misc.VideoMode_bpp_set) + refresh = property(_misc.VideoMode_refresh_get, _misc.VideoMode_refresh_set) + +class VideoModePtr(VideoMode): + def __init__(self, this): + self.this = this + if not hasattr(self,"thisown"): self.thisown = 0 + self.__class__ = VideoMode +_misc.VideoMode_swigregister(VideoModePtr) + +class Display(object): + """Represents a display/monitor attached to the system""" + def __repr__(self): + return "<%s.%s; proxy of C++ wxDisplay instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) + def __init__(self, *args, **kwargs): + """ + __init__(size_t index=0) -> Display + + Set up a Display instance with the specified display. The + displays are numbered from 0 to GetCount() - 1, 0 is always the + primary display and the only one which is always supported + """ + newobj = _misc.new_Display(*args, **kwargs) + self.this = newobj.this + self.thisown = 1 + del newobj.thisown + def __del__(self, destroy=_misc.delete_Display): + """__del__()""" + try: + if self.thisown: destroy(self) + except: pass + + def GetCount(*args, **kwargs): + """ + GetCount() -> size_t + + Return the number of available displays. + """ + return _misc.Display_GetCount(*args, **kwargs) + + GetCount = staticmethod(GetCount) + def GetFromPoint(*args, **kwargs): + """ + GetFromPoint(Point pt) -> int + + Find the display where the given point lies, return wx.NOT_FOUND + if it doesn't belong to any display + """ + return _misc.Display_GetFromPoint(*args, **kwargs) + + GetFromPoint = staticmethod(GetFromPoint) + def GetFromWindow(*args, **kwargs): + """ + GetFromWindow(Window window) -> int + + Find the display where the given window lies, return wx.NOT_FOUND + if it is not shown at all. + """ + return _misc.Display_GetFromWindow(*args, **kwargs) + + GetFromWindow = staticmethod(GetFromWindow) + def IsOk(*args, **kwargs): + """ + IsOk() -> bool + + Return true if the object was initialized successfully + """ + return _misc.Display_IsOk(*args, **kwargs) + + def __nonzero__(self): return self.IsOk() + def GetGeometry(*args, **kwargs): + """ + GetGeometry() -> Rect + + Returns the bounding rectangle of the display whose index was + passed to the constructor. + """ + return _misc.Display_GetGeometry(*args, **kwargs) + + def GetName(*args, **kwargs): + """ + GetName() -> String + + Returns the display's name. A name is not available on all platforms. + """ + return _misc.Display_GetName(*args, **kwargs) + + def IsPrimary(*args, **kwargs): + """ + IsPrimary() -> bool + + Returns true if the display is the primary display. The primary + display is the one whose index is 0. + """ + return _misc.Display_IsPrimary(*args, **kwargs) + + def GetModes(*args, **kwargs): + """ + GetModes(VideoMode mode=DefaultVideoMode) -> [videoMode...] + + Enumerate all video modes supported by this display matching the + given one (in the sense of VideoMode.Match()). + + As any mode matches the default value of the argument and there + is always at least one video mode supported by display, the + returned array is only empty for the default value of the + argument if this function is not supported at all on this + platform. + """ + return _misc.Display_GetModes(*args, **kwargs) + + def GetCurrentMode(*args, **kwargs): + """ + GetCurrentMode() -> VideoMode + + Get the current video mode. + """ + return _misc.Display_GetCurrentMode(*args, **kwargs) + + def ChangeMode(*args, **kwargs): + """ + ChangeMode(VideoMode mode=DefaultVideoMode) -> bool + + Change current mode, return true if succeeded, false otherwise + """ + return _misc.Display_ChangeMode(*args, **kwargs) + + def ResetMode(*args, **kwargs): + """ + ResetMode() + + Restore the default video mode (just a more readable synonym) + """ + return _misc.Display_ResetMode(*args, **kwargs) + + +class DisplayPtr(Display): + def __init__(self, this): + self.this = this + if not hasattr(self,"thisown"): self.thisown = 0 + self.__class__ = Display +_misc.Display_swigregister(DisplayPtr) +DefaultVideoMode = cvar.DefaultVideoMode + +def Display_GetCount(*args, **kwargs): + """ + Display_GetCount() -> size_t + + Return the number of available displays. + """ + return _misc.Display_GetCount(*args, **kwargs) + +def Display_GetFromPoint(*args, **kwargs): + """ + Display_GetFromPoint(Point pt) -> int + + Find the display where the given point lies, return wx.NOT_FOUND + if it doesn't belong to any display + """ + return _misc.Display_GetFromPoint(*args, **kwargs) + +def Display_GetFromWindow(*args, **kwargs): + """ + Display_GetFromWindow(Window window) -> int + + Find the display where the given window lies, return wx.NOT_FOUND + if it is not shown at all. + """ + return _misc.Display_GetFromWindow(*args, **kwargs) +