2002-07-19 16:42:34 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2003-03-02 09:16:29 -05:00
|
|
|
// Name: wx/display.h
|
2002-07-19 16:42:34 -04:00
|
|
|
// Purpose: wxDisplay class
|
2006-03-15 23:23:07 -05:00
|
|
|
// Author: Royce Mitchell III, Vadim Zeitlin
|
2002-07-19 16:42:34 -04:00
|
|
|
// Created: 06/21/02
|
|
|
|
// RCS-ID: $Id$
|
2006-03-15 23:23:07 -05:00
|
|
|
// Copyright: (c) 2002-2006 wxWidgets team
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2002-07-19 16:42:34 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_DISPLAY_H_BASE_
|
|
|
|
#define _WX_DISPLAY_H_BASE_
|
|
|
|
|
2006-03-15 23:23:07 -05: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 03:53:09 -05:00
|
|
|
#if wxUSE_DISPLAY
|
2006-03-15 23:23:07 -05:00
|
|
|
#include "wx/dynarray.h"
|
|
|
|
#include "wx/vidmode.h"
|
|
|
|
|
|
|
|
WX_DECLARE_EXPORTED_OBJARRAY(wxVideoMode, wxArrayVideoModes);
|
2002-07-19 16:42:34 -04:00
|
|
|
|
2006-03-15 23:23:07 -05:00
|
|
|
// default, uninitialized, video mode object
|
|
|
|
extern WXDLLEXPORT_DATA(const wxVideoMode) wxDefaultVideoMode;
|
|
|
|
#endif // wxUSE_DISPLAY
|
2003-03-02 09:16:29 -05:00
|
|
|
|
2003-04-29 18:39:02 -04:00
|
|
|
class WXDLLEXPORT wxWindow;
|
2003-09-27 08:36:30 -04:00
|
|
|
class WXDLLEXPORT wxPoint;
|
|
|
|
class WXDLLEXPORT wxRect;
|
2006-05-20 01:44:22 -04:00
|
|
|
class WXDLLIMPEXP_BASE wxString;
|
2003-04-29 18:39:02 -04:00
|
|
|
|
2006-03-15 23:23:07 -05:00
|
|
|
class WXDLLEXPORT wxDisplayFactory;
|
|
|
|
class WXDLLEXPORT wxDisplayImpl;
|
2003-03-02 09:16:29 -05:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2006-03-15 23:23:07 -05:00
|
|
|
// wxDisplay: represents a display/monitor attached to the system
|
2003-03-02 09:16:29 -05:00
|
|
|
// ----------------------------------------------------------------------------
|
2002-07-19 16:42:34 -04:00
|
|
|
|
2006-03-15 23:23:07 -05:00
|
|
|
class WXDLLEXPORT wxDisplay
|
2002-07-19 16:42:34 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// initialize the object containing all information about the given
|
|
|
|
// display
|
2003-03-02 09:16:29 -05: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 01:38:05 -04:00
|
|
|
wxDisplay(unsigned n = 0);
|
2006-03-15 23:23:07 -05:00
|
|
|
|
|
|
|
// dtor is not virtual as this is a concrete class not meant to be derived
|
|
|
|
// from
|
|
|
|
~wxDisplay();
|
|
|
|
|
2002-07-19 16:42:34 -04:00
|
|
|
|
|
|
|
// return the number of available displays, valid parameters to
|
|
|
|
// wxDisplay ctor are from 0 up to this number
|
2006-10-02 01:38:05 -04:00
|
|
|
static unsigned GetCount();
|
2002-07-19 16:42:34 -04:00
|
|
|
|
2003-03-02 09:16:29 -05:00
|
|
|
// find the display where the given point lies, return wxNOT_FOUND if
|
2002-07-19 16:42:34 -04:00
|
|
|
// it doesn't belong to any display
|
2003-03-02 09:16:29 -05: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
|
|
|
|
static int GetFromWindow(wxWindow *window);
|
2002-07-19 16:42:34 -04:00
|
|
|
|
|
|
|
|
2003-04-06 20:30:18 -04:00
|
|
|
// return true if the object was initialized successfully
|
2006-03-15 23:23:07 -05:00
|
|
|
bool IsOk() const { return m_impl != NULL; }
|
2003-04-06 20:30:18 -04:00
|
|
|
|
2006-03-16 11:07:24 -05:00
|
|
|
// get the full display size
|
2006-03-15 23:23:07 -05:00
|
|
|
wxRect GetGeometry() const;
|
2002-07-19 16:42:34 -04:00
|
|
|
|
2006-03-16 11:07:24 -05:00
|
|
|
// get the client area of the display, i.e. without taskbars and such
|
|
|
|
wxRect GetClientArea() const;
|
|
|
|
|
2002-07-19 16:42:34 -04:00
|
|
|
// name may be empty
|
2006-03-15 23:23:07 -05:00
|
|
|
wxString GetName() const;
|
2002-07-19 16:42:34 -04:00
|
|
|
|
2004-11-06 19:48:37 -05:00
|
|
|
// display 0 is usually the primary display
|
2006-03-15 23:23:07 -05:00
|
|
|
bool IsPrimary() const;
|
2003-03-02 09:16:29 -05:00
|
|
|
|
2002-07-19 16:42:34 -04:00
|
|
|
|
2006-03-15 23:23:07 -05:00
|
|
|
#if wxUSE_DISPLAY
|
2003-03-02 09:16:29 -05: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-15 23:23:07 -05:00
|
|
|
wxArrayVideoModes
|
|
|
|
GetModes(const wxVideoMode& mode = wxDefaultVideoMode) const;
|
2002-07-19 16:42:34 -04:00
|
|
|
|
2003-03-02 09:16:29 -05:00
|
|
|
// get current video mode
|
2006-03-15 23:23:07 -05:00
|
|
|
wxVideoMode GetCurrentMode() const;
|
2003-03-02 09:16:29 -05: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-15 23:23:07 -05:00
|
|
|
bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode);
|
2003-03-02 09:16:29 -05:00
|
|
|
|
|
|
|
// restore the default video mode (just a more readable synonym)
|
|
|
|
void ResetMode() { (void)ChangeMode(); }
|
2006-03-15 23:23:07 -05:00
|
|
|
#endif // wxUSE_DISPLAY
|
2003-03-02 09:16:29 -05:00
|
|
|
|
2006-03-15 23:23:07 -05:00
|
|
|
private:
|
|
|
|
// returns the factory used to implement our static methods and create new
|
|
|
|
// displays
|
|
|
|
static wxDisplayFactory& Factory();
|
2002-07-19 16:42:34 -04:00
|
|
|
|
2006-03-15 23:23:07 -05: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 16:42:34 -04:00
|
|
|
|
|
|
|
|
2006-03-15 23:23:07 -05:00
|
|
|
// the real implementation
|
|
|
|
wxDisplayImpl *m_impl;
|
2003-03-02 09:16:29 -05:00
|
|
|
|
2002-07-19 16:42:34 -04:00
|
|
|
|
2006-03-15 23:23:07 -05:00
|
|
|
DECLARE_NO_COPY_CLASS(wxDisplay)
|
|
|
|
};
|
2002-07-19 16:42:34 -04:00
|
|
|
|
|
|
|
#endif // _WX_DISPLAY_H_BASE_
|