2002-07-19 20:42:34 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2003-03-02 14:16:29 +00:00
|
|
|
// Name: wx/display.h
|
2002-07-19 20:42:34 +00:00
|
|
|
// Purpose: wxDisplay class
|
2006-03-16 04:23:07 +00:00
|
|
|
// Author: Royce Mitchell III, Vadim Zeitlin
|
2002-07-19 20:42:34 +00:00
|
|
|
// Created: 06/21/02
|
|
|
|
// RCS-ID: $Id$
|
2006-03-16 04:23:07 +00:00
|
|
|
// Copyright: (c) 2002-2006 wxWidgets team
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
2002-07-19 20:42:34 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_DISPLAY_H_BASE_
|
|
|
|
#define _WX_DISPLAY_H_BASE_
|
|
|
|
|
2006-03-16 04:23:07 +00:00
|
|
|
// NB: no #if wxUSE_DISPLAY here, the display geometry part of this class (but
|
|
|
|
// not the video mode stuff) is always available but if wxUSE_DISPLAY == 0
|
|
|
|
// it becomes just a trivial wrapper around the old wxDisplayXXX() functions
|
|
|
|
|
2004-03-19 08:53:09 +00:00
|
|
|
#if wxUSE_DISPLAY
|
2006-03-16 04:23:07 +00:00
|
|
|
#include "wx/dynarray.h"
|
|
|
|
#include "wx/vidmode.h"
|
|
|
|
|
|
|
|
WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode, wxArrayVideoModes);
|
2002-07-19 20:42:34 +00:00
|
|
|
|
2006-03-16 04:23:07 +00:00
|
|
|
// default, uninitialized, video mode object
|
|
|
|
extern WXDLLEXPORT_DATA(const wxVideoMode) wxDefaultVideoMode;
|
|
|
|
#endif // wxUSE_DISPLAY
|
2003-03-02 14:16:29 +00:00
|
|
|
|
2007-07-09 10:09:52 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxWindow;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxPoint;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxRect;
|
|
|
|
class WXDLLIMPEXP_FWD_BASE wxString;
|
2003-04-29 22:39:02 +00:00
|
|
|
|
2007-07-09 10:09:52 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxDisplayFactory;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxDisplayImpl;
|
2003-03-02 14:16:29 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2006-03-16 04:23:07 +00:00
|
|
|
// wxDisplay: represents a display/monitor attached to the system
|
2003-03-02 14:16:29 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
2002-07-19 20:42:34 +00:00
|
|
|
|
2006-03-16 04:23:07 +00:00
|
|
|
class WXDLLEXPORT wxDisplay
|
2002-07-19 20:42:34 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// initialize the object containing all information about the given
|
|
|
|
// display
|
2003-03-02 14:16:29 +00:00
|
|
|
//
|
|
|
|
// the displays are numbered from 0 to GetCount() - 1, 0 is always the
|
|
|
|
// primary display and the only one which is always supported
|
2006-10-02 05:38:05 +00:00
|
|
|
wxDisplay(unsigned n = 0);
|
2006-03-16 04:23:07 +00:00
|
|
|
|
|
|
|
// dtor is not virtual as this is a concrete class not meant to be derived
|
|
|
|
// from
|
|
|
|
~wxDisplay();
|
|
|
|
|
2002-07-19 20:42:34 +00:00
|
|
|
|
|
|
|
// return the number of available displays, valid parameters to
|
|
|
|
// wxDisplay ctor are from 0 up to this number
|
2006-10-02 05:38:05 +00:00
|
|
|
static unsigned GetCount();
|
2002-07-19 20:42:34 +00:00
|
|
|
|
2003-03-02 14:16:29 +00:00
|
|
|
// find the display where the given point lies, return wxNOT_FOUND if
|
2002-07-19 20:42:34 +00:00
|
|
|
// it doesn't belong to any display
|
2003-03-02 14:16:29 +00:00
|
|
|
static int GetFromPoint(const wxPoint& pt);
|
|
|
|
|
|
|
|
// find the display where the given window lies, return wxNOT_FOUND if it
|
|
|
|
// is not shown at all
|
2007-02-11 00:13:22 +00:00
|
|
|
static int GetFromWindow(const wxWindow *window);
|
2002-07-19 20:42:34 +00:00
|
|
|
|
|
|
|
|
2003-04-07 00:30:18 +00:00
|
|
|
// return true if the object was initialized successfully
|
2006-03-16 04:23:07 +00:00
|
|
|
bool IsOk() const { return m_impl != NULL; }
|
2003-04-07 00:30:18 +00:00
|
|
|
|
2006-03-16 16:07:24 +00:00
|
|
|
// get the full display size
|
2006-03-16 04:23:07 +00:00
|
|
|
wxRect GetGeometry() const;
|
2002-07-19 20:42:34 +00:00
|
|
|
|
2006-03-16 16:07:24 +00:00
|
|
|
// get the client area of the display, i.e. without taskbars and such
|
|
|
|
wxRect GetClientArea() const;
|
|
|
|
|
2002-07-19 20:42:34 +00:00
|
|
|
// name may be empty
|
2006-03-16 04:23:07 +00:00
|
|
|
wxString GetName() const;
|
2002-07-19 20:42:34 +00:00
|
|
|
|
2004-11-07 00:48:37 +00:00
|
|
|
// display 0 is usually the primary display
|
2006-03-16 04:23:07 +00:00
|
|
|
bool IsPrimary() const;
|
2003-03-02 14:16:29 +00:00
|
|
|
|
2002-07-19 20:42:34 +00:00
|
|
|
|
2006-03-16 04:23:07 +00:00
|
|
|
#if wxUSE_DISPLAY
|
2003-03-02 14:16:29 +00:00
|
|
|
// enumerate all video modes supported by this display matching the given
|
|
|
|
// one (in the sense of wxVideoMode::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
|
2006-03-16 04:23:07 +00:00
|
|
|
wxArrayVideoModes
|
|
|
|
GetModes(const wxVideoMode& mode = wxDefaultVideoMode) const;
|
2002-07-19 20:42:34 +00:00
|
|
|
|
2003-03-02 14:16:29 +00:00
|
|
|
// get current video mode
|
2006-03-16 04:23:07 +00:00
|
|
|
wxVideoMode GetCurrentMode() const;
|
2003-03-02 14:16:29 +00:00
|
|
|
|
|
|
|
// change current mode, return true if succeeded, false otherwise
|
|
|
|
//
|
|
|
|
// for the default value of the argument restores the video mode to default
|
2006-03-16 04:23:07 +00:00
|
|
|
bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode);
|
2003-03-02 14:16:29 +00:00
|
|
|
|
|
|
|
// restore the default video mode (just a more readable synonym)
|
|
|
|
void ResetMode() { (void)ChangeMode(); }
|
2006-03-16 04:23:07 +00:00
|
|
|
#endif // wxUSE_DISPLAY
|
2003-03-02 14:16:29 +00:00
|
|
|
|
2006-03-16 04:23:07 +00:00
|
|
|
private:
|
|
|
|
// returns the factory used to implement our static methods and create new
|
|
|
|
// displays
|
|
|
|
static wxDisplayFactory& Factory();
|
2002-07-19 20:42:34 +00:00
|
|
|
|
2006-03-16 04:23:07 +00:00
|
|
|
// creates the factory object, called by Factory() when it is called for
|
|
|
|
// the first time and should return a pointer allocated with new (the
|
|
|
|
// caller will delete it)
|
|
|
|
//
|
|
|
|
// this method must be implemented in platform-specific code if
|
|
|
|
// wxUSE_DISPLAY == 1 (if it is 0 we provide the stub in common code)
|
|
|
|
static wxDisplayFactory *CreateFactory();
|
2002-07-19 20:42:34 +00:00
|
|
|
|
|
|
|
|
2006-03-16 04:23:07 +00:00
|
|
|
// the real implementation
|
|
|
|
wxDisplayImpl *m_impl;
|
2003-03-02 14:16:29 +00:00
|
|
|
|
2002-07-19 20:42:34 +00:00
|
|
|
|
2006-03-16 04:23:07 +00:00
|
|
|
DECLARE_NO_COPY_CLASS(wxDisplay)
|
|
|
|
};
|
2002-07-19 20:42:34 +00:00
|
|
|
|
|
|
|
#endif // _WX_DISPLAY_H_BASE_
|