initial commit

Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
2025-10-31 23:37:30 +01:00
commit 7228269764
9653 changed files with 4034514 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/accel.h
// Purpose: wxAcceleratorTable class
// Author: Julian Smart
// Created: 31/7/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ACCEL_H_
#define _WX_ACCEL_H_
class WXDLLIMPEXP_FWD_CORE wxWindow;
// ----------------------------------------------------------------------------
// the accel table has all accelerators for a given window or menu
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxAcceleratorTable : public wxObject
{
public:
// default ctor
wxAcceleratorTable() = default;
// load from .rc resource (Windows specific)
wxAcceleratorTable(const wxString& resource);
// initialize from array
wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]);
bool Ok() const { return IsOk(); }
bool IsOk() const;
void SetHACCEL(WXHACCEL hAccel);
WXHACCEL GetHACCEL() const;
// translate the accelerator, return true if done
bool Translate(wxWindow *window, WXMSG *msg) const;
private:
wxDECLARE_DYNAMIC_CLASS(wxAcceleratorTable);
};
#endif
// _WX_ACCEL_H_

View File

@@ -0,0 +1,81 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/anybutton.h
// Purpose: wxAnyButton class
// Author: Julian Smart
// Created: 1997-02-01 (extracted from button.h)
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_ANYBUTTON_H_
#define _WX_MSW_ANYBUTTON_H_
// ----------------------------------------------------------------------------
// Common button functionality
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase
{
public:
wxAnyButton()
{
m_imageData = nullptr;
#if wxUSE_MARKUP
m_markupText = nullptr;
#endif // wxUSE_MARKUP
}
virtual ~wxAnyButton();
// overridden base class methods
virtual void SetLabel(const wxString& label) override;
virtual bool SetBackgroundColour(const wxColour &colour) override;
virtual bool SetForegroundColour(const wxColour &colour) override;
// implementation from now on
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) override;
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item) override;
// returns true if the platform should explicitly apply a theme border
virtual bool CanApplyThemeBorder() const override { return false; }
protected:
// usually overridden base class virtuals
virtual wxSize DoGetBestSize() const override;
virtual wxBitmap DoGetBitmap(State which) const override;
virtual void DoSetBitmap(const wxBitmapBundle& bitmap, State which) override;
virtual wxSize DoGetBitmapMargins() const override;
virtual void DoSetBitmapMargins(wxCoord x, wxCoord y) override;
virtual void DoSetBitmapPosition(wxDirection dir) override;
#if wxUSE_MARKUP
virtual bool DoSetLabelMarkup(const wxString& markup) override;
#endif // wxUSE_MARKUP
// Increases the passed in size to account for the button image.
//
// Should only be called if we do have a button, i.e. if m_imageData is
// non-null.
void AdjustForBitmapSize(wxSize& size) const;
class wxButtonImageData *m_imageData;
#if wxUSE_MARKUP
class wxMarkupText *m_markupText;
#endif // wxUSE_MARKUP
// Switches button into owner-drawn mode: this is used if we need to draw
// something not supported by the native control, such as using non default
// colours or font.
void MakeOwnerDrawn();
bool IsOwnerDrawn() const;
virtual bool MSWIsPushed() const;
private:
wxDECLARE_NO_COPY_CLASS(wxAnyButton);
};
#endif // _WX_MSW_ANYBUTTON_H_

View File

@@ -0,0 +1,152 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/app.h
// Purpose: wxApp class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_APP_H_
#define _WX_APP_H_
#include "wx/event.h"
#include "wx/icon.h"
class WXDLLIMPEXP_FWD_CORE wxFrame;
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_FWD_CORE wxApp;
class WXDLLIMPEXP_FWD_CORE wxDarkModeSettings;
class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
class WXDLLIMPEXP_FWD_BASE wxLog;
// Represents the application. Derive OnInit and declare
// a new App object to start application
class WXDLLIMPEXP_CORE wxApp : public wxAppBase
{
public:
wxApp();
virtual ~wxApp();
// override base class (pure) virtuals
virtual bool Initialize(int& argc, wxChar **argv) override;
virtual void CleanUp() override;
virtual void WakeUpIdle() override;
virtual void SetPrintMode(int mode) override { m_printMode = mode; }
virtual int GetPrintMode() const { return m_printMode; }
virtual AppearanceResult SetAppearance(Appearance appearance) override;
// MSW-specific function to enable experimental dark mode support.
//
// If settings are specified, the function takes ownership of the pointer,
// otherwise the defaults are used.
enum
{
DarkMode_Auto = 0, // Use dark mode if the system is using it.
DarkMode_Always = 1 // Force using dark mode.
};
bool
MSWEnableDarkMode(int flags = 0, wxDarkModeSettings* settings = nullptr);
// implementation only
void OnIdle(wxIdleEvent& event);
void OnEndSession(wxCloseEvent& event);
void OnQueryEndSession(wxCloseEvent& event);
#if wxUSE_EXCEPTIONS
virtual bool OnExceptionInMainLoop() override;
#endif // wxUSE_EXCEPTIONS
// MSW-specific from now on
// ------------------------
// this suffix should be appended to all our Win32 class names to obtain a
// variant registered without CS_[HV]REDRAW styles
static const wxChar *GetNoRedrawClassSuffix() { return wxT("NR"); }
// Flags for GetRegisteredClassName()
enum
{
// Just a symbolic name indicating absence of any special flags.
RegClass_Default = 0,
// Return the name with the GetNoRedrawClassSuffix() appended to it.
RegClass_ReturnNR = 1,
// Don't register the class with CS_[HV]REDRAW styles. This is useful
// for internal windows for which we can guarantee that they will be
// never created with wxFULL_REPAINT_ON_RESIZE flag.
//
// Notice that this implies RegClass_ReturnNR.
RegClass_OnlyNR = 3
};
// get the name of the registered Win32 class with the given (unique) base
// name: this function constructs the unique class name using this name as
// prefix, checks if the class is already registered and registers it if it
// isn't and returns the name it was registered under (or nullptr if it failed)
//
// the registered class will always have CS_[HV]REDRAW and CS_DBLCLKS
// styles as well as any additional styles specified as arguments here; and
// there will be also a companion registered class identical to this one
// but without CS_[HV]REDRAW whose name will be the same one but with
// GetNoRedrawClassSuffix()
//
// the background brush argument must be either a COLOR_XXX standard value
// or (default) -1 meaning that the class paints its background itself
static const wxChar *GetRegisteredClassName(const wxChar *name,
int bgBrushCol = -1,
int extraStyles = 0,
int flags = RegClass_Default);
// return true if this name corresponds to one of the classes we registered
// in the previous GetRegisteredClassName() calls
static bool IsRegisteredClassName(const wxString& name);
// Return the layout direction to use for a window by default.
//
// If the parent is specified, use the same layout direction as it uses.
// Otherwise use the default global layout, either from wxTheApp, if it
// exists, or Windows itself.
//
// Notice that this normally should not be used for the child windows as
// they already inherit, just dialogs such as wxMessageDialog may want to
// use it.
static wxLayoutDirection MSWGetDefaultLayout(wxWindow* parent = nullptr);
// Call ProcessPendingEvents() but only if we need to do it, i.e. there was
// a recent call to WakeUpIdle().
void MSWProcessPendingEventsIfNeeded();
protected:
int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
public:
// unregister any window classes registered by GetRegisteredClassName()
static void UnregisterWindowClasses();
#if wxUSE_RICHEDIT
// initialize the richedit DLL of (at least) given version, return true if
// ok
static bool InitRichEdit(int version = 2);
#endif // wxUSE_RICHEDIT
// returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it
// wasn't found at all
static int GetComCtl32Version();
// the SW_XXX value to be used for the frames opened by the application
// (currently seems unused which is a bug -- TODO)
static int m_nCmdShow;
protected:
wxDECLARE_EVENT_TABLE();
wxDECLARE_NO_COPY_CLASS(wxApp);
wxDECLARE_DYNAMIC_CLASS(wxApp);
};
#endif // _WX_APP_H_

View File

@@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/appprogress.h
// Purpose: wxAppProgressIndicator interface.
// Author: Chaobin Zhang <zhchbin@gmail.com>
// Created: 2014-09-05
// Copyright: (c) 2014 wxWidgets development team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_APPPROG_H_
#define _WX_MSW_APPPROG_H_
#include "wx/vector.h"
class WXDLLIMPEXP_FWD_CORE wxTaskBarButton;
class WXDLLIMPEXP_CORE wxAppProgressIndicator
: public wxAppProgressIndicatorBase
{
public:
wxAppProgressIndicator(wxWindow* parent = nullptr, int maxValue = 100);
virtual ~wxAppProgressIndicator();
virtual bool IsAvailable() const override;
virtual void SetValue(int value) override;
virtual void SetRange(int range) override;
virtual void Pulse() override;
virtual void Reset() override;
private:
int m_maxValue;
wxVector<wxTaskBarButton*> m_taskBarButtons;
wxDECLARE_NO_COPY_CLASS(wxAppProgressIndicator);
};
#endif // _WX_MSW_APPPROG_H_

View File

@@ -0,0 +1,76 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/apptbase.h
// Purpose: declaration of wxAppTraits for MSW
// Author: Vadim Zeitlin
// Created: 22.06.2003
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_APPTBASE_H_
#define _WX_MSW_APPTBASE_H_
// ----------------------------------------------------------------------------
// wxAppTraits: the MSW version adds extra hooks needed by MSW-only code
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase
{
public:
// wxExecute() support methods
// ---------------------------
// called before starting to wait for the child termination, may return
// some opaque data which will be passed later to AfterChildWaitLoop()
virtual void *BeforeChildWaitLoop() = 0;
// called after starting to wait for the child termination, the parameter
// is the return value of BeforeChildWaitLoop()
virtual void AfterChildWaitLoop(void *data) = 0;
#if wxUSE_THREADS
// wxThread helpers
// ----------------
// process a message while waiting for a(nother) thread, should return
// false if and only if we have to exit the application
virtual bool DoMessageFromThreadWait() = 0;
// wait for the handle to be signaled, return WAIT_OBJECT_0 if it is or, in
// the GUI code, WAIT_OBJECT_0 + 1 if a Windows message arrived
virtual WXDWORD WaitForThread(WXHANDLE hThread, int flags) = 0;
#endif // wxUSE_THREADS
// console helpers
// ---------------
// this method can be overridden by a derived class to always return true
// or false to force [not] using the console for output to stderr
//
// by default console applications always return true from here while the
// GUI ones only return true if they're being run from console and there is
// no other activity happening in this console
virtual bool CanUseStderr() = 0;
// write text to the console, return true if ok or false on error
virtual bool WriteToStderr(const wxString& text) = 0;
// return the main application window or 0 if none
virtual WXHWND GetMainHWND() const = 0;
// implement this base class function for both console and GUI applications
virtual bool SafeMessageBox(const wxString& text,
const wxString& title) override;
protected:
#if wxUSE_THREADS
// implementation of WaitForThread() for the console applications which is
// also used by the GUI code if it doesn't [yet|already] dispatch events
WXDWORD DoSimpleWaitForThread(WXHANDLE hThread);
#endif // wxUSE_THREADS
};
#endif // _WX_MSW_APPTBASE_H_

View File

@@ -0,0 +1,125 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/apptrait.h
// Purpose: class implementing wxAppTraits for MSW
// Author: Vadim Zeitlin
// Created: 21.06.2003
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_APPTRAIT_H_
#define _WX_MSW_APPTRAIT_H_
// ----------------------------------------------------------------------------
// wxGUI/ConsoleAppTraits: must derive from wxAppTraits, not wxAppTraitsBase
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxConsoleAppTraits : public wxConsoleAppTraitsBase
{
public:
virtual wxEventLoopBase *CreateEventLoop() override;
virtual void *BeforeChildWaitLoop() override;
virtual void AfterChildWaitLoop(void *data) override;
#if wxUSE_TIMER
virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) override;
#endif // wxUSE_TIMER
#if wxUSE_THREADS
virtual bool DoMessageFromThreadWait() override;
virtual WXDWORD WaitForThread(WXHANDLE hThread, int flags) override;
#endif // wxUSE_THREADS
virtual bool CanUseStderr() override { return true; }
virtual bool WriteToStderr(const wxString& text) override;
virtual WXHWND GetMainHWND() const override { return nullptr; }
};
#if wxUSE_GUI
#if defined(__WXMSW__)
class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase
{
public:
virtual wxEventLoopBase *CreateEventLoop() override;
virtual void *BeforeChildWaitLoop() override;
virtual void AfterChildWaitLoop(void *data) override;
#if wxUSE_TIMER
virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) override;
#endif // wxUSE_TIMER
#if wxUSE_THREADS
virtual bool DoMessageFromThreadWait() override;
virtual WXDWORD WaitForThread(WXHANDLE hThread, int flags) override;
#endif // wxUSE_THREADS
wxPortId GetToolkitVersion(int *majVer = nullptr,
int *minVer = nullptr,
int *microVer = nullptr) const override;
virtual bool CanUseStderr() override;
virtual bool WriteToStderr(const wxString& text) override;
virtual WXHWND GetMainHWND() const override;
};
#elif defined(__WXGTK__)
class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase
{
public:
virtual wxEventLoopBase *CreateEventLoop() override;
virtual void *BeforeChildWaitLoop() override { return nullptr; }
virtual void AfterChildWaitLoop(void *WXUNUSED(data)) override { }
#if wxUSE_TIMER
virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) override;
#endif
#if wxUSE_THREADS
virtual void MutexGuiEnter() override;
virtual void MutexGuiLeave() override;
#endif
#if wxUSE_THREADS
virtual bool DoMessageFromThreadWait() override { return true; }
virtual WXDWORD WaitForThread(WXHANDLE hThread, int WXUNUSED(flags)) override
{ return DoSimpleWaitForThread(hThread); }
#endif // wxUSE_THREADS
virtual wxPortId GetToolkitVersion(int *majVer = nullptr,
int *minVer = nullptr,
int *microVer = nullptr) const override;
virtual bool CanUseStderr() override { return false; }
virtual bool WriteToStderr(const wxString& WXUNUSED(text)) override
{ return false; }
virtual WXHWND GetMainHWND() const override { return nullptr; }
virtual wxString GetPlatformDescription() const override;
};
#elif defined(__WXQT__)
class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase
{
public:
virtual wxEventLoopBase *CreateEventLoop() override;
virtual void *BeforeChildWaitLoop() override { return nullptr; }
virtual void AfterChildWaitLoop(void*) override { }
#if wxUSE_TIMER
virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) override;
#endif
#if wxUSE_THREADS
virtual bool DoMessageFromThreadWait() override { return true; }
virtual WXDWORD WaitForThread(WXHANDLE hThread, int WXUNUSED(flags)) override
{ return DoSimpleWaitForThread(hThread); }
#endif // wxUSE_THREADS
virtual wxPortId GetToolkitVersion(int *majVer = nullptr,
int *minVer = nullptr,
int *microVer = nullptr) const override;
virtual bool CanUseStderr() override { return false; }
virtual bool WriteToStderr(const wxString&) override { return false; }
virtual WXHWND GetMainHWND() const override { return nullptr; }
virtual wxString GetPlatformDescription() const override;
};
#endif
#endif // wxUSE_GUI
#endif // _WX_MSW_APPTRAIT_H_

View File

@@ -0,0 +1,341 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/bitmap.h
// Purpose: wxBitmap class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_BITMAP_H_
#define _WX_BITMAP_H_
#include "wx/msw/gdiimage.h"
#include "wx/math.h"
#include "wx/palette.h"
class WXDLLIMPEXP_FWD_CORE wxBitmapRefData;
#if wxUSE_WXDIB
class WXDLLIMPEXP_FWD_CORE wxDIB;
#endif
// What kind of transparency should a bitmap copied from an icon or cursor
// have?
enum wxBitmapTransparency
{
wxBitmapTransparency_Auto, // default: copy alpha if the source has it
wxBitmapTransparency_None, // never create alpha
wxBitmapTransparency_Always // always use alpha
};
// ----------------------------------------------------------------------------
// wxBitmap: a mono or colour bitmap
// NOTE: for wxMSW we don't use the wxBitmapBase base class declared in bitmap.h!
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBitmap : public wxGDIImage,
public wxBitmapHelpers
{
public:
// default ctor creates an invalid bitmap, you must Create() it later
wxBitmap() = default;
// Initialize with raw data
wxBitmap(const char bits[], int width, int height, int depth = 1);
// Initialize with XPM data
wxBitmap(const char* const* data);
// Load a file or resource
wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
// New constructor for generalised creation from data
wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1);
// Create a new, uninitialized bitmap of the given size and depth (if it
// is omitted, will create a bitmap compatible with the display)
//
// NB: this ctor will create a DIB for 24 and 32bpp bitmaps, use ctor
// taking a DC argument if you want to force using DDB in this case
wxBitmap(int width, int height, int depth = -1) { (void)Create(width, height, depth); }
wxBitmap(const wxSize& sz, int depth = -1) { (void)Create(sz, depth); }
// Create a bitmap compatible with the given DC
wxBitmap(int width, int height, const wxDC& dc);
#if wxUSE_IMAGE
// Convert from wxImage
wxBitmap(const wxImage& image, int depth = -1, double WXUNUSED(scale) = 1.0)
{ (void)CreateFromImage(image, depth); }
// Create a DDB compatible with the given DC from wxImage
wxBitmap(const wxImage& image, const wxDC& dc)
{ (void)CreateFromImage(image, dc); }
#endif // wxUSE_IMAGE
// we must have this, otherwise icons are silently copied into bitmaps using
// the copy ctor but the resulting bitmap is invalid!
wxBitmap(const wxIcon& icon,
wxBitmapTransparency transp = wxBitmapTransparency_Auto)
{
CopyFromIcon(icon, transp);
}
// Convert from wxCursor
explicit wxBitmap(const wxCursor& cursor)
{
(void)CopyFromCursor(cursor, wxBitmapTransparency_Auto);
}
#if wxUSE_IMAGE
wxBitmap& operator=(const wxImage& image)
{
return *this = wxBitmap(image);
}
#endif // wxUSE_IMAGE
wxBitmap& operator=(const wxIcon& icon)
{
(void)CopyFromIcon(icon);
return *this;
}
#if WXWIN_COMPATIBILITY_3_0
// This assignment operator is not portable as it is not implemented in any
// other ports.
wxDEPRECATED_MSG("Don't assign wxCursor to an existing wxBitmap, create a new wxBitmap from wxCursor instead.")
wxBitmap& operator=(const wxCursor& cursor)
{
(void)CopyFromCursor(cursor);
return *this;
}
#endif // WXWIN_COMPATIBILITY_3_0
#if wxUSE_IMAGE
wxImage ConvertToImage() const;
wxBitmap ConvertToDisabled(unsigned char brightness = 255) const;
#endif // wxUSE_IMAGE
// get the given part of bitmap
wxBitmap GetSubBitmap( const wxRect& rect ) const;
// NB: This should not be called from user code. It is for wx internal
// use only.
wxBitmap GetSubBitmapOfHDC( const wxRect& rect, WXHDC hdc ) const;
// copies the contents and mask of the given (colour) icon to the bitmap
bool CopyFromIcon(const wxIcon& icon,
wxBitmapTransparency transp = wxBitmapTransparency_Auto);
// copies the contents and mask of the given cursor to the bitmap
bool CopyFromCursor(const wxCursor& cursor,
wxBitmapTransparency transp = wxBitmapTransparency_Auto);
#if wxUSE_WXDIB
// copies from a device independent bitmap
bool CopyFromDIB(const wxDIB& dib);
bool IsDIB() const;
bool ConvertToDIB();
#endif
bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
{ return Create(sz.GetWidth(), sz.GetHeight(), depth); }
bool Create(int width, int height, const wxDC& dc);
bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1);
bool CreateWithDIPSize(const wxSize& sz,
double scale,
int depth = wxBITMAP_SCREEN_DEPTH);
bool CreateWithDIPSize(int width, int height,
double scale,
int depth = wxBITMAP_SCREEN_DEPTH)
{ return CreateWithDIPSize(wxSize(width, height), scale, depth); }
bool CreateWithLogicalSize(const wxSize& sz,
double scale,
int depth = wxBITMAP_SCREEN_DEPTH);
bool CreateWithLogicalSize(int width, int height,
double scale,
int depth = wxBITMAP_SCREEN_DEPTH)
{ return CreateWithLogicalSize(wxSize(width, height), scale, depth); }
virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = nullptr) const;
wxBitmapRefData *GetBitmapData() const
{ return (wxBitmapRefData *)m_refData; }
// raw bitmap access support functions
void *GetRawData(wxPixelDataBase& data, int bpp);
void UngetRawData(wxPixelDataBase& data);
#if wxUSE_PALETTE
wxPalette* GetPalette() const;
void SetPalette(const wxPalette& palette);
#endif // wxUSE_PALETTE
wxMask *GetMask() const;
void SetMask(wxMask *mask);
bool HasAlpha() const;
bool UseAlpha(bool use = true);
void ResetAlpha() { UseAlpha(false); }
// old synonyms for CreateWithDIPSize() and GetLogicalXXX() functions
bool CreateScaled(int w, int h, int d, double logicalScale)
{ return CreateWithDIPSize(wxSize(w, h), logicalScale, d); }
double GetScaledWidth() const { return GetLogicalWidth(); }
double GetScaledHeight() const { return GetLogicalHeight(); }
wxSize GetScaledSize() const { return GetLogicalSize(); }
// implementation only from now on
// -------------------------------
// Set alpha flag to true if this is a 32bpp bitmap which has any non-0
// values in its alpha channel.
void MSWUpdateAlpha();
// Blend mask with alpha channel and remove the mask
void MSWBlendMaskWithAlpha();
public:
#if WXWIN_COMPATIBILITY_3_0
wxDEPRECATED_INLINE(void SetHBITMAP(WXHBITMAP bmp), SetHandle((WXHANDLE)bmp); )
#endif // WXWIN_COMPATIBILITY_3_0
WXHBITMAP GetHBITMAP() const { return (WXHBITMAP)GetHandle(); }
bool InitFromHBITMAP(WXHBITMAP bmp, int width, int height, int depth);
void ResetHBITMAP() { InitFromHBITMAP(nullptr, 0, 0, 0); }
void SetSelectedInto(wxDC *dc);
wxDC *GetSelectedInto() const;
protected:
virtual wxGDIImageRefData *CreateData() const override;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const override;
// creates an uninitialized bitmap, called from Create()s above
bool DoCreate(int w, int h, int depth, WXHDC hdc);
#if wxUSE_IMAGE
// creates the bitmap from wxImage, supposed to be called from ctor
bool CreateFromImage(const wxImage& image, int depth);
// creates a DDB from wxImage, supposed to be called from ctor
bool CreateFromImage(const wxImage& image, const wxDC& dc);
// common part of the 2 methods above (hdc may be 0)
bool CreateFromImage(const wxImage& image, int depth, WXHDC hdc);
#endif // wxUSE_IMAGE
private:
// common part of CopyFromIcon/CopyFromCursor for Win32
bool
CopyFromIconOrCursor(const wxGDIImage& icon,
wxBitmapTransparency transp = wxBitmapTransparency_Auto);
wxDECLARE_DYNAMIC_CLASS(wxBitmap);
};
// ----------------------------------------------------------------------------
// wxMask: a mono bitmap used for drawing bitmaps transparently.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMask : public wxObject
{
public:
wxMask();
// Copy constructor
wxMask(const wxMask &mask);
// Construct a mask from a bitmap and a colour indicating the transparent
// area
wxMask(const wxBitmap& bitmap, const wxColour& colour);
// Construct a mask from a bitmap and a palette index indicating the
// transparent area
wxMask(const wxBitmap& bitmap, int paletteIndex);
// Construct a mask from a mono bitmap (copies the bitmap).
wxMask(const wxBitmap& bitmap);
// construct a mask from the givne bitmap handle
wxMask(WXHBITMAP hbmp) { m_maskBitmap = hbmp; }
virtual ~wxMask();
bool Create(const wxBitmap& bitmap, const wxColour& colour);
bool Create(const wxBitmap& bitmap, int paletteIndex);
bool Create(const wxBitmap& bitmap);
wxBitmap GetBitmap() const;
// Implementation
WXHBITMAP GetMaskBitmap() const { return m_maskBitmap; }
void SetMaskBitmap(WXHBITMAP bmp) { m_maskBitmap = bmp; }
#if wxUSE_IMAGE
bool MSWCreateFromImageMask(const wxImage& image);
#endif // wxUSE_IMAGE
protected:
WXHBITMAP m_maskBitmap;
wxDECLARE_DYNAMIC_CLASS(wxMask);
};
// ----------------------------------------------------------------------------
// wxBitmapHandler is a class which knows how to load/save bitmaps to/from file
// NOTE: for wxMSW we don't use the wxBitmapHandler class declared in bitmap.h!
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBitmapHandler : public wxGDIImageHandler
{
public:
wxBitmapHandler() = default;
wxBitmapHandler(const wxString& name, const wxString& ext, wxBitmapType type)
: wxGDIImageHandler(name, ext, type) { }
// implement wxGDIImageHandler's pure virtuals:
virtual bool Create(wxGDIImage *image,
const void* data,
wxBitmapType type,
int width, int height, int depth = 1) override;
virtual bool Load(wxGDIImage *image,
const wxString& name,
wxBitmapType type,
int desiredWidth, int desiredHeight) override;
virtual bool Save(const wxGDIImage *image,
const wxString& name,
wxBitmapType type) const override;
// make wxBitmapHandler compatible with the wxBitmapHandler interface
// declared in bitmap.h, even if it's derived from wxGDIImageHandler:
virtual bool Create(wxBitmap *bitmap,
const void* data,
wxBitmapType type,
int width, int height, int depth = 1);
virtual bool LoadFile(wxBitmap *bitmap,
const wxString& name,
wxBitmapType type,
int desiredWidth, int desiredHeight);
virtual bool SaveFile(const wxBitmap *bitmap,
const wxString& name,
wxBitmapType type,
const wxPalette *palette = nullptr) const;
private:
wxDECLARE_DYNAMIC_CLASS(wxBitmapHandler);
};
#endif
// _WX_BITMAP_H_

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

View File

@@ -0,0 +1,50 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/bmpbuttn.h
// Purpose: wxBitmapButton class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_BMPBUTTN_H_
#define _WX_BMPBUTTN_H_
#include "wx/button.h"
#include "wx/bitmap.h"
#include "wx/brush.h"
class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase
{
public:
wxBitmapButton() = default;
wxBitmapButton(wxWindow *parent,
wxWindowID id,
const wxBitmapBundle& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxButtonNameStr))
{
Create(parent, id, bitmap, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxBitmapBundle& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxButtonNameStr));
bool CreateCloseButton(wxWindow* parent,
wxWindowID winid,
const wxString& name = wxString());
protected:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapButton);
};
#endif // _WX_BMPBUTTN_H_

View File

@@ -0,0 +1,136 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/bmpcbox.h
// Purpose: wxBitmapComboBox
// Author: Jaakko Salli
// Created: 2008-04-06
// Copyright: (c) 2008 Jaakko Salli
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_BMPCBOX_H_
#define _WX_MSW_BMPCBOX_H_
#include "wx/combobox.h"
// ----------------------------------------------------------------------------
// wxBitmapComboBox: a wxComboBox that allows images to be shown
// in front of string items.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxBitmapComboBox : public wxComboBox,
public wxBitmapComboBoxBase
{
public:
// ctors and such
wxBitmapComboBox() : wxComboBox(), wxBitmapComboBoxBase()
{
Init();
}
wxBitmapComboBox(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0,
const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr))
: wxComboBox(),
wxBitmapComboBoxBase()
{
Init();
(void)Create(parent, id, value, pos, size, n,
choices, style, validator, name);
}
wxBitmapComboBox(wxWindow *parent,
wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
int n,
const wxString choices[],
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr));
virtual ~wxBitmapComboBox();
// Sets the image for the given item.
virtual void SetItemBitmap(unsigned int n, const wxBitmapBundle& bitmap) override;
virtual bool SetFont(const wxFont& font) override;
// Adds item with image to the end of the combo box.
int Append(const wxString& item, const wxBitmapBundle& bitmap = wxBitmapBundle());
int Append(const wxString& item, const wxBitmapBundle& bitmap, void *clientData);
int Append(const wxString& item, const wxBitmapBundle& bitmap, wxClientData *clientData);
// Inserts item with image into the list before pos. Not valid for wxCB_SORT
// styles, use Append instead.
int Insert(const wxString& item, const wxBitmapBundle& bitmap, unsigned int pos);
int Insert(const wxString& item, const wxBitmapBundle& bitmap,
unsigned int pos, void *clientData);
int Insert(const wxString& item, const wxBitmapBundle& bitmap,
unsigned int pos, wxClientData *clientData);
protected:
WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const override;
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item) override;
virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item) override;
virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) override;
// Event handlers
void OnSize(wxSizeEvent& event);
virtual wxItemContainer* GetItemContainer() override { return this; }
virtual wxWindow* GetControl() override { return this; }
// wxItemContainer implementation
virtual int DoInsertItems(const wxArrayStringsAdapter & items,
unsigned int pos,
void **clientData, wxClientDataType type) override;
virtual void DoClear() override;
virtual void DoDeleteOneItem(unsigned int n) override;
virtual bool OnAddBitmap(const wxBitmapBundle& bitmap) override;
virtual wxSize DoGetBestSize() const override;
void RecreateControl();
private:
void Init();
bool m_inResize;
wxDECLARE_EVENT_TABLE();
wxDECLARE_DYNAMIC_CLASS(wxBitmapComboBox);
};
#endif // _WX_MSW_BMPCBOX_H_

View File

@@ -0,0 +1,58 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/brush.h
// Purpose: wxBrush class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_BRUSH_H_
#define _WX_BRUSH_H_
class WXDLLIMPEXP_FWD_CORE wxBrush;
class WXDLLIMPEXP_FWD_CORE wxColour;
class WXDLLIMPEXP_FWD_CORE wxBitmap;
// ----------------------------------------------------------------------------
// wxBrush
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBrush : public wxBrushBase
{
public:
wxBrush();
wxBrush(const wxColour& col, wxBrushStyle style = wxBRUSHSTYLE_SOLID);
wxBrush(const wxBitmap& stipple);
virtual void SetColour(const wxColour& col) override;
virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) override;
virtual void SetStyle(wxBrushStyle style) override;
virtual void SetStipple(const wxBitmap& stipple) override;
bool operator==(const wxBrush& brush) const;
bool operator!=(const wxBrush& brush) const { return !(*this == brush); }
wxColour GetColour() const override;
wxBrushStyle GetStyle() const override;
wxBitmap *GetStipple() const override;
wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants")
wxBrush(const wxColour& col, int style);
wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants")
void SetStyle(int style) { SetStyle((wxBrushStyle)style); }
// return the HBRUSH for this brush
virtual WXHANDLE GetResourceHandle() const override;
protected:
virtual wxGDIRefData *CreateGDIRefData() const override;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const override;
private:
wxDECLARE_DYNAMIC_CLASS(wxBrush);
};
#endif // _WX_BRUSH_H_

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

View File

@@ -0,0 +1,84 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/button.h
// Purpose: wxButton class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_BUTTON_H_
#define _WX_MSW_BUTTON_H_
// ----------------------------------------------------------------------------
// Pushbutton
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxButton : public wxButtonBase
{
public:
wxButton() { Init(); }
wxButton(wxWindow *parent,
wxWindowID id,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxButtonNameStr))
{
Init();
Create(parent, id, label, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxButtonNameStr));
virtual ~wxButton();
virtual wxWindow *SetDefault() override;
// implementation from now on
virtual void Command(wxCommandEvent& event) override;
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) override;
virtual bool MSWCommand(WXUINT param, WXWORD id) override;
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const override;
protected:
// send a notification event, return true if processed
bool SendClickEvent();
// default button handling
void SetTmpDefault();
void UnsetTmpDefault();
// set or unset BS_DEFPUSHBUTTON style
static void SetDefaultStyle(wxButton *btn, bool on);
virtual bool DoGetAuthNeeded() const override;
virtual void DoSetAuthNeeded(bool show) override;
// true if the UAC symbol is shown
bool m_authNeeded;
private:
void Init()
{
m_authNeeded = false;
}
void OnCharHook(wxKeyEvent& event);
wxDECLARE_EVENT_TABLE();
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxButton);
};
#endif // _WX_MSW_BUTTON_H_

View File

@@ -0,0 +1,98 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/calctrl.h
// Purpose: wxCalendarCtrl control implementation for MSW
// Author: Vadim Zeitlin
// Copyright: (C) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_CALCTRL_H_
#define _WX_MSW_CALCTRL_H_
class WXDLLIMPEXP_ADV wxCalendarCtrl : public wxCalendarCtrlBase
{
public:
wxCalendarCtrl() { Init(); }
wxCalendarCtrl(wxWindow *parent,
wxWindowID id,
const wxDateTime& date = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAL_SHOW_HOLIDAYS,
const wxString& name = wxASCII_STR(wxCalendarNameStr))
{
Init();
Create(parent, id, date, pos, size, style, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxDateTime& date = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAL_SHOW_HOLIDAYS,
const wxString& name = wxASCII_STR(wxCalendarNameStr));
virtual bool SetDate(const wxDateTime& date) override;
virtual wxDateTime GetDate() const override;
virtual bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime,
const wxDateTime& upperdate = wxDefaultDateTime) override;
virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const override;
virtual bool EnableMonthChange(bool enable = true) override;
virtual void Mark(size_t day, bool mark) override;
virtual void SetHoliday(size_t day) override;
virtual wxCalendarHitTestResult HitTest(const wxPoint& pos,
wxDateTime *date = nullptr,
wxDateTime::WeekDay *wd = nullptr) override;
virtual void SetWindowStyleFlag(long style) override;
protected:
virtual wxSize DoGetBestSize() const override;
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const override;
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) override;
void MSWOnClick(wxMouseEvent& event);
void MSWOnDoubleClick(wxMouseEvent& event);
private:
void Init();
// bring the control in sync with m_marks
void UpdateMarks();
// set first day of week in the control to correspond to our
// wxCAL_MONDAY_FIRST flag
void UpdateFirstDayOfWeek();
// reset holiday information
virtual void ResetHolidayAttrs() override { m_holidays = 0; }
// redisplay holidays
virtual void RefreshHolidays() override { UpdateMarks(); }
// current date, we need to store it instead of simply retrieving it from
// the control as needed in order to be able to generate the correct events
// from MSWOnNotify()
wxDateTime m_date;
// bit field containing the state (marked or not) of all days in the month
wxUint32 m_marks;
// the same but indicating whether a day is a holiday or not
wxUint32 m_holidays;
wxDECLARE_DYNAMIC_CLASS(wxCalendarCtrl);
wxDECLARE_NO_COPY_CLASS(wxCalendarCtrl);
};
#endif // _WX_MSW_CALCTRL_H_

View File

@@ -0,0 +1,60 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/caret.h
// Purpose: wxCaret class - the MSW implementation of wxCaret
// Author: Vadim Zeitlin
// Created: 23.05.99
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CARET_H_
#define _WX_CARET_H_
class WXDLLIMPEXP_CORE wxCaret : public wxCaretBase
{
public:
wxCaret() { Init(); }
// create the caret of given (in pixels) width and height and associate
// with the given window
wxCaret(wxWindow *window, int width, int height)
{
Init();
(void)Create(window, width, height);
}
// same as above
wxCaret(wxWindowBase *window, const wxSize& size)
{
Init();
(void)Create(window, size);
}
// process wxWindow notifications
virtual void OnSetFocus() override;
virtual void OnKillFocus() override;
protected:
// override base class virtuals
virtual void DoMove() override;
virtual void DoShow() override;
virtual void DoHide() override;
virtual void DoSize() override;
// helper function which creates the system caret
bool MSWCreateCaret();
private:
void Init()
{
m_hasCaret = false;
}
bool m_hasCaret;
wxDECLARE_NO_COPY_CLASS(wxCaret);
};
#endif // _WX_CARET_H_

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,86 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/checkbox.h
// Purpose: wxCheckBox class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CHECKBOX_H_
#define _WX_CHECKBOX_H_
#include "wx/msw/ownerdrawnbutton.h"
// Checkbox item (single checkbox)
class WXDLLIMPEXP_CORE wxCheckBox : public wxMSWOwnerDrawnButton<wxCheckBoxBase>
{
public:
wxCheckBox() : m_state(wxCHK_UNCHECKED) { }
wxCheckBox(wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxCheckBoxNameStr))
{
Create(parent, id, label, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxCheckBoxNameStr));
virtual void SetValue(bool value) override;
virtual bool GetValue() const override;
// override some base class virtuals
virtual void SetLabel(const wxString& label) override;
virtual void SetTransparentPartColour(const wxColour& col) override
{
SetBackgroundColour(col);
}
virtual bool MSWCommand(WXUINT param, WXWORD id) override;
virtual void Command(wxCommandEvent& event) override;
// returns true if the platform should explicitly apply a theme border
virtual bool CanApplyThemeBorder() const override { return false; }
// implementation only from now on
virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = nullptr) const override;
protected:
virtual wxSize DoGetBestClientSize() const override;
virtual bool MSWGetDarkModeSupport(MSWDarkModeSupport& support) const override;
virtual void DoSet3StateValue(wxCheckBoxState value) override;
virtual wxCheckBoxState DoGet3StateValue() const override;
// Implement wxMSWOwnerDrawnButtonBase methods.
virtual int MSWGetButtonStyle() const override;
virtual void MSWOnButtonResetOwnerDrawn() override;
virtual int MSWGetButtonCheckedFlag() const override;
virtual void
MSWDrawButtonBitmap(wxDC& dc, const wxRect& rect, int flags) override;
private:
// common part of all ctors
void Init();
// current state of the checkbox
wxCheckBoxState m_state;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckBox);
};
#endif // _WX_CHECKBOX_H_

View File

@@ -0,0 +1,91 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/checklst.h
// Purpose: wxCheckListBox class - a listbox with checkable items
// Author: Vadim Zeitlin
// Created: 16.11.97
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef __CHECKLST__H_
#define __CHECKLST__H_
#if !wxUSE_OWNER_DRAWN
#error "wxCheckListBox class requires owner-drawn functionality."
#endif
class WXDLLIMPEXP_FWD_CORE wxOwnerDrawn;
class WXDLLIMPEXP_FWD_CORE wxCheckListBoxItem; // fwd decl, defined in checklst.cpp
class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase
{
public:
// ctors
wxCheckListBox();
wxCheckListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int nStrings = 0,
const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
wxCheckListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
// items may be checked
virtual bool IsChecked(unsigned int uiIndex) const override;
virtual void Check(unsigned int uiIndex, bool bCheck = true) override;
virtual void Toggle(unsigned int uiIndex);
// we create our items ourselves and they have non-standard size,
// so we need to override these functions
virtual wxOwnerDrawn *CreateLboxItem(size_t n) override;
virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item) override;
protected:
virtual wxSize MSWGetFullItemSize(int w, int h) const override;
// pressing space or clicking the check box toggles the item
void OnKeyDown(wxKeyEvent& event);
void OnLeftClick(wxMouseEvent& event);
// send an "item checked" event
void SendEvent(unsigned int uiIndex)
{
wxCommandEvent event(wxEVT_CHECKLISTBOX, GetId());
event.SetInt(uiIndex);
event.SetEventObject(this);
event.SetString(GetString(uiIndex));
ProcessCommand(event);
}
virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) override;
wxSize DoGetBestClientSize() const override;
wxDECLARE_EVENT_TABLE();
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox);
};
#endif //_CHECKLST_H

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,423 @@
/*
* Name: wx/msw/chkconf.h
* Purpose: Compiler-specific configuration checking
* Author: Julian Smart
* Modified by:
* Created: 01/02/97
* Copyright: (c) Julian Smart
* Licence: wxWindows licence
*/
/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
#ifndef _WX_MSW_CHKCONF_H_
#define _WX_MSW_CHKCONF_H_
/* ensure that CPU parameter is specified (only nmake .vc makefile) */
#ifdef _MSC_VER
#if defined(_WIN64) && defined(TARGET_CPU_COMPFLAG) && (TARGET_CPU_COMPFLAG == 0)
#error CPU must be defined
#endif
#endif
/* ensure that MSW-specific settings are defined */
#ifndef wxUSE_ACTIVEX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ACTIVEX must be defined."
# else
# define wxUSE_ACTIVEX 0
# endif
#endif /* !defined(wxUSE_ACTIVEX) */
#ifndef wxUSE_WINRT
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_WINRT must be defined."
# else
# define wxUSE_WINRT 0
# endif
#endif /* !defined(wxUSE_ACTIVEX) */
#ifndef wxUSE_CRASHREPORT
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CRASHREPORT must be defined."
# else
# define wxUSE_CRASHREPORT 0
# endif
#endif /* !defined(wxUSE_CRASHREPORT) */
#ifndef wxUSE_DBGHELP
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DBGHELP must be defined"
# else
# define wxUSE_DBGHELP 1
# endif
#endif /* wxUSE_DBGHELP */
#ifndef wxUSE_DC_CACHEING
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DC_CACHEING must be defined"
# else
# define wxUSE_DC_CACHEING 1
# endif
#endif /* wxUSE_DC_CACHEING */
#ifndef wxUSE_DIALUP_MANAGER
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DIALUP_MANAGER must be defined."
# else
# define wxUSE_DIALUP_MANAGER 0
# endif
#endif /* !defined(wxUSE_DIALUP_MANAGER) */
#ifndef wxUSE_MS_HTML_HELP
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_MS_HTML_HELP must be defined."
# else
# define wxUSE_MS_HTML_HELP 0
# endif
#endif /* !defined(wxUSE_MS_HTML_HELP) */
#ifndef wxUSE_INICONF
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_INICONF must be defined."
# else
# define wxUSE_INICONF 0
# endif
#endif /* !defined(wxUSE_INICONF) */
#ifndef wxUSE_OLE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_OLE must be defined."
# else
# define wxUSE_OLE 0
# endif
#endif /* !defined(wxUSE_OLE) */
#ifndef wxUSE_OLE_AUTOMATION
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_OLE_AUTOMATION must be defined."
# else
# define wxUSE_OLE_AUTOMATION 0
# endif
#endif /* !defined(wxUSE_OLE_AUTOMATION) */
#ifndef wxUSE_TASKBARICON_BALLOONS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TASKBARICON_BALLOONS must be defined."
# else
# define wxUSE_TASKBARICON_BALLOONS 0
# endif
#endif /* wxUSE_TASKBARICON_BALLOONS */
#ifndef wxUSE_TASKBARBUTTON
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TASKBARBUTTON must be defined."
# else
# define wxUSE_TASKBARBUTTON 0
# endif
#endif /* wxUSE_TASKBARBUTTON */
#ifndef wxUSE_UXTHEME
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_UXTHEME must be defined."
# else
# define wxUSE_UXTHEME 0
# endif
#endif /* wxUSE_UXTHEME */
#ifndef wxUSE_WINSOCK2
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_WINSOCK2 must be defined."
# else
# define wxUSE_WINSOCK2 0
# endif
#endif /* wxUSE_WINSOCK2 */
/*
* disable the settings which don't work for some compilers
*/
/*
* All of the settings below require SEH support (__try/__catch) and can't work
* without it.
*/
#if !defined(_MSC_VER)
# undef wxUSE_ON_FATAL_EXCEPTION
# define wxUSE_ON_FATAL_EXCEPTION 0
# undef wxUSE_CRASHREPORT
# define wxUSE_CRASHREPORT 0
#endif /* compiler doesn't support SEH */
/* MinGW32 doesn't provide wincred.h defining the API needed by this */
#ifdef __MINGW32_TOOLCHAIN__
#undef wxUSE_SECRETSTORE
#define wxUSE_SECRETSTORE 0
#endif
#if wxUSE_SPINCTRL
# if !wxUSE_SPINBTN
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxSpinCtrl requires wxSpinButton on MSW"
# else
# undef wxUSE_SPINBTN
# define wxUSE_SPINBTN 1
# endif
# endif
#endif
/* wxMSW-specific checks: notice that this file is also used with wxUniv
and can even be used with wxGTK, when building it under Windows.
*/
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
# if !wxUSE_OWNER_DRAWN
# undef wxUSE_CHECKLISTBOX
# define wxUSE_CHECKLISTBOX 0
# endif
# if !wxUSE_CHECKLISTBOX
# undef wxUSE_REARRANGECTRL
# define wxUSE_REARRANGECTRL 0
# endif
#endif
/* wxMSW implementation requires wxDynamicLibrary. */
#if defined(__WXMSW__) && !wxUSE_DYNLIB_CLASS
# undef wxUSE_DYNLIB_CLASS
# define wxUSE_DYNLIB_CLASS 1
#endif /* !wxUSE_DYNLIB_CLASS */
/*
un/redefine the options which we can't compile (after checking that they're
defined
*/
#ifdef __WINE__
# if wxUSE_ACTIVEX
# undef wxUSE_ACTIVEX
# define wxUSE_ACTIVEX 0
# endif /* wxUSE_ACTIVEX */
#endif /* __WINE__ */
/*
Currently wxUSE_GRAPHICS_CONTEXT is only enabled with MSVC by default, so
only check for wxUSE_ACTIVITYINDICATOR dependency on it if it can be
enabled, otherwise turn the latter off to allow the library to compile.
*/
#if !wxUSE_GRAPHICS_CONTEXT && !defined(_MSC_VER)
# undef wxUSE_ACTIVITYINDICATOR
# define wxUSE_ACTIVITYINDICATOR 0
#endif /* !wxUSE_ACTIVITYINDICATOR && !_MSC_VER */
/* MinGW-w64 (32 and 64 bit) has winhttp.h available, legacy MinGW does not. */
#if (!defined(_MSC_VER) && !defined(__MINGW64_VERSION_MAJOR))
#undef wxUSE_WEBREQUEST_WINHTTP
#define wxUSE_WEBREQUEST_WINHTTP 0
#endif
/*
Similarly, turn off wxUSE_WEBREQUEST if we can't enable it because we don't
have any of its backends to allow the library to compile with the default
options when using MinGW32 which doesn't come with winhttp.h and so for
which we have to disable wxUSE_WEBREQUEST_WINHTTP.
*/
#if wxUSE_WEBREQUEST && !wxUSE_WEBREQUEST_CURL && !wxUSE_WEBREQUEST_WINHTTP
# undef wxUSE_WEBREQUEST
# define wxUSE_WEBREQUEST 0
#endif /* wxUSE_WEBREQUEST */
/* check settings consistency for MSW-specific ones */
#if wxUSE_CRASHREPORT && !wxUSE_ON_FATAL_EXCEPTION
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CRASHREPORT requires wxUSE_ON_FATAL_EXCEPTION"
# else
# undef wxUSE_CRASHREPORT
# define wxUSE_CRASHREPORT 0
# endif
#endif /* wxUSE_CRASHREPORT */
#if !wxUSE_VARIANT
# if wxUSE_ACTIVEX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxActiveXContainer requires wxVariant"
# else
# undef wxUSE_ACTIVEX
# define wxUSE_ACTIVEX 0
# endif
# endif
# if wxUSE_OLE_AUTOMATION
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxAutomationObject requires wxVariant"
# else
# undef wxUSE_OLE_AUTOMATION
# define wxUSE_OLE_AUTOMATION 0
# endif
# endif
#endif /* !wxUSE_VARIANT */
#if !wxUSE_DATAOBJ
# if wxUSE_OLE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_OLE requires wxDataObject"
# else
# undef wxUSE_OLE
# define wxUSE_OLE 0
# endif
# endif
#endif /* !wxUSE_DATAOBJ */
#if !wxUSE_DYNAMIC_LOADER
# if wxUSE_MS_HTML_HELP
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_MS_HTML_HELP requires wxUSE_DYNAMIC_LOADER."
# else
# undef wxUSE_MS_HTML_HELP
# define wxUSE_MS_HTML_HELP 0
# endif
# endif
# if wxUSE_DIALUP_MANAGER
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DIALUP_MANAGER requires wxUSE_DYNAMIC_LOADER."
# else
# undef wxUSE_DIALUP_MANAGER
# define wxUSE_DIALUP_MANAGER 0
# endif
# endif
#endif /* !wxUSE_DYNAMIC_LOADER */
#if !wxUSE_OLE
# if wxUSE_ACTIVEX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxActiveXContainer requires wxUSE_OLE"
# else
# undef wxUSE_ACTIVEX
# define wxUSE_ACTIVEX 0
# endif
# endif
# if wxUSE_OLE_AUTOMATION
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxAutomationObject requires wxUSE_OLE"
# else
# undef wxUSE_OLE_AUTOMATION
# define wxUSE_OLE_AUTOMATION 0
# endif
# endif
# if wxUSE_CLIPBOARD
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CLIPBOARD requires wxUSE_OLE"
# else
# undef wxUSE_CLIPBOARD
# define wxUSE_CLIPBOARD 0
# endif
# endif
# if wxUSE_DRAG_AND_DROP
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DRAG_AND_DROP requires wxUSE_OLE"
# else
# undef wxUSE_DRAG_AND_DROP
# define wxUSE_DRAG_AND_DROP 0
# endif
# endif
# if wxUSE_ACCESSIBILITY
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ACCESSIBILITY requires wxUSE_OLE"
# else
# undef wxUSE_ACCESSIBILITY
# define wxUSE_ACCESSIBILITY 0
# endif
# endif
#endif /* !wxUSE_OLE */
#if !wxUSE_ACTIVEX
# if wxUSE_MEDIACTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxMediaCtl requires wxActiveXContainer"
# else
# undef wxUSE_MEDIACTRL
# define wxUSE_MEDIACTRL 0
# endif
# endif
# if wxUSE_WEBVIEW && wxUSE_WEBVIEW_IE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxWebViewIE requires wxActiveXContainer under MSW"
# else
# undef wxUSE_WEBVIEW_IE
# define wxUSE_WEBVIEW_IE 0
# endif
# endif
#endif /* !wxUSE_ACTIVEX */
#if wxUSE_ACTIVITYINDICATOR && !wxUSE_GRAPHICS_CONTEXT
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ACTIVITYINDICATOR requires wxGraphicsContext"
# else
# undef wxUSE_ACTIVITYINDICATOR
# define wxUSE_ACTIVITYINDICATOR 0
# endif
#endif /* wxUSE_ACTIVITYINDICATOR */
#if wxUSE_STACKWALKER && !wxUSE_DBGHELP
/*
Don't give an error in this case because wxUSE_DBGHELP could be 0
because the compiler just doesn't support it, there is really no other
choice than to disable wxUSE_STACKWALKER too in this case.
Unfortunately we can't distinguish between the missing compiler support
and explicitly disabling wxUSE_DBGHELP (which would ideally result in
an error if wxUSE_STACKWALKER is not disabled too), but it's better to
avoid giving a compiler error in the former case even if it means not
giving it either in the latter one.
*/
#undef wxUSE_STACKWALKER
#define wxUSE_STACKWALKER 0
#endif /* wxUSE_STACKWALKER && !wxUSE_DBGHELP */
#if !wxUSE_THREADS
# if wxUSE_FSWATCHER
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxFileSystemWatcher requires wxThread under MSW"
# else
# undef wxUSE_FSWATCHER
# define wxUSE_FSWATCHER 0
# endif
# endif
# if wxUSE_JOYSTICK
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxJoystick requires wxThread under MSW"
# else
# undef wxUSE_JOYSTICK
# define wxUSE_JOYSTICK 0
# endif
# endif
#endif /* !wxUSE_THREADS */
#if !wxUSE_OLE_AUTOMATION
# if wxUSE_WEBVIEW
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxWebView requires wxUSE_OLE_AUTOMATION under MSW"
# else
# undef wxUSE_WEBVIEW
# define wxUSE_WEBVIEW 0
# endif
# endif
#endif /* !wxUSE_OLE_AUTOMATION */
#if defined(__WXUNIVERSAL__) && wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW && !wxUSE_POSTSCRIPT
# undef wxUSE_POSTSCRIPT
# define wxUSE_POSTSCRIPT 1
#endif
/*
IPv6 support requires winsock2.h, but the default of wxUSE_WINSOCK2 is 0.
Don't require changing it explicitly and just turn it on automatically if
wxUSE_IPV6 is on.
*/
#if wxUSE_IPV6 && !wxUSE_WINSOCK2
#undef wxUSE_WINSOCK2
#define wxUSE_WINSOCK2 1
#endif
#endif /* _WX_MSW_CHKCONF_H_ */

View File

@@ -0,0 +1,178 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/choice.h
// Purpose: wxChoice class
// Author: Julian Smart
// Modified by: Vadim Zeitlin to derive from wxChoiceBase
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CHOICE_H_
#define _WX_CHOICE_H_
struct tagCOMBOBOXINFO;
// ----------------------------------------------------------------------------
// Choice item
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase
{
public:
// ctors
wxChoice() { Init(); }
virtual ~wxChoice();
wxChoice(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxChoiceNameStr))
{
Init();
Create(parent, id, pos, size, n, choices, style, validator, name);
}
wxChoice(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxChoiceNameStr))
{
Init();
Create(parent, id, pos, size, choices, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxChoiceNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxChoiceNameStr));
virtual bool Show(bool show = true) override;
virtual void SetLabel(const wxString& label) override;
virtual unsigned int GetCount() const override;
virtual int GetSelection() const override;
virtual int GetCurrentSelection() const override;
virtual void SetSelection(int n) override;
virtual int FindString(const wxString& s, bool bCase = false) const override;
virtual wxString GetString(unsigned int n) const override;
virtual void SetString(unsigned int n, const wxString& s) override;
virtual wxVisualAttributes GetDefaultAttributes() const override
{
return GetClassDefaultAttributes(GetWindowVariant());
}
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
// MSW only
virtual bool MSWCommand(WXUINT param, WXWORD id) override;
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) override;
virtual WXHBRUSH MSWControlColor(WXHDC hDC, WXHWND hWnd) override;
virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg) override;
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const override;
// returns true if the platform should explicitly apply a theme border
virtual bool CanApplyThemeBorder() const override { return false; }
protected:
// choose the default border for this window
virtual wxBorder GetDefaultBorder() const override { return wxBORDER_NONE; }
// common part of all ctors
void Init()
{
m_lastAcceptedSelection =
m_pendingSelection = wxID_NONE;
m_heightOwn = wxDefaultCoord;
}
virtual void DoDeleteOneItem(unsigned int n) override;
virtual void DoClear() override;
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
unsigned int pos,
void **clientData, wxClientDataType type) override;
virtual void DoMoveWindow(int x, int y, int width, int height) override;
virtual void DoSetItemClientData(unsigned int n, void* clientData) override;
virtual void* DoGetItemClientData(unsigned int n) const override;
// MSW implementation
virtual wxSize DoGetBestSize() const override;
virtual void DoGetSize(int *w, int *h) const override;
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO) override;
virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const override;
virtual bool MSWGetDarkModeSupport(MSWDarkModeSupport& support) const override;
// Show or hide the popup part of the control.
void MSWDoPopupOrDismiss(bool show);
// update the height of the drop down list to fit the number of items we
// have (without changing the visible height)
void MSWUpdateDropDownHeight();
// set the height of the visible part of the control to m_heightOwn
void MSWUpdateVisibleHeight();
// create and initialize the control
bool CreateAndInit(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
int n, const wxString choices[],
long style,
const wxValidator& validator,
const wxString& name);
// free all memory we have (used by Clear() and dtor)
void Free();
// set the height for simple combo box
int SetHeightSimpleComboBox(int nItems) const;
#if wxUSE_DEFERRED_SIZING
virtual void MSWEndDeferWindowPos() override;
#endif // wxUSE_DEFERRED_SIZING
// These variables are only used while the drop down is opened.
//
// The first one contains the item that had been originally selected before
// the drop down was opened and the second one the item we should select
// when the drop down is closed again.
int m_lastAcceptedSelection,
m_pendingSelection;
// the height of the control itself if it was set explicitly or
// wxDefaultCoord if it hadn't
int m_heightOwn;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice);
};
#endif // _WX_CHOICE_H_

View File

@@ -0,0 +1,84 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/clipbrd.h
// Purpose: wxClipboard class and clipboard functions for MSW
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CLIPBRD_H_
#define _WX_CLIPBRD_H_
#if wxUSE_CLIPBOARD
// Deprecated wxMSW-only function superseded by wxClipboard, don't use them and
// use that class instead.
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("Use wxClipboard") WXDLLIMPEXP_CORE bool wxOpenClipboard();
wxDEPRECATED_MSG("Use wxClipboard") WXDLLIMPEXP_CORE bool wxIsClipboardOpened();
wxDEPRECATED_MSG("Use wxClipboard") WXDLLIMPEXP_CORE bool wxClipboardOpen();
wxDEPRECATED_MSG("Use wxClipboard") WXDLLIMPEXP_CORE bool wxCloseClipboard();
wxDEPRECATED_MSG("Use wxClipboard") WXDLLIMPEXP_CORE bool wxEmptyClipboard();
#endif // WXWIN_COMPATIBILITY_3_2
// Non-deprecated but still wxMSW-specific functions working with clipboard
// formats -- don't use them neither.
WXDLLIMPEXP_CORE bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat);
WXDLLIMPEXP_CORE wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat);
WXDLLIMPEXP_CORE int wxRegisterClipboardFormat(wxChar *formatName);
WXDLLIMPEXP_CORE bool wxGetClipboardFormatName(wxDataFormat dataFormat,
wxChar *formatName,
int maxCount);
//-----------------------------------------------------------------------------
// wxClipboard
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase
{
public:
wxClipboard();
virtual ~wxClipboard();
// open the clipboard before SetData() and GetData()
virtual bool Open() override;
// close the clipboard after SetData() and GetData()
virtual void Close() override;
// query whether the clipboard is opened
virtual bool IsOpened() const override;
// set the clipboard data. all other formats will be deleted.
virtual bool SetData( wxDataObject *data ) override;
// add to the clipboard data.
virtual bool AddData( wxDataObject *data ) override;
// ask if data in correct format is available
virtual bool IsSupported( const wxDataFormat& format ) override;
// fill data with data on the clipboard (if available)
virtual bool GetData( wxDataObject& data ) override;
// clears wxTheClipboard and the system's clipboard if possible
virtual void Clear() override;
// flushes the clipboard: this means that the data which is currently on
// clipboard will stay available even after the application exits (possibly
// eating memory), otherwise the clipboard will be emptied on exit
virtual bool Flush() override;
private:
IDataObject *m_lastDataObject;
bool m_isOpened;
wxDECLARE_DYNAMIC_CLASS(wxClipboard);
};
#endif // wxUSE_CLIPBOARD
#endif // _WX_CLIPBRD_H_

View File

@@ -0,0 +1,76 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/colordlg.h
// Purpose: wxColourDialog class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COLORDLG_H_
#define _WX_COLORDLG_H_
#include "wx/dialog.h"
// ----------------------------------------------------------------------------
// wxColourDialog: dialog for choosing a colours
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxColourDialog : public wxDialog
{
public:
wxColourDialog() { Init(); }
wxColourDialog(wxWindow *parent, const wxColourData *data = nullptr)
{
Init();
Create(parent, data);
}
bool Create(wxWindow *parent, const wxColourData *data = nullptr);
wxColourData& GetColourData() { return m_colourData; }
// override some base class virtuals
virtual void SetTitle(const wxString& title) override;
virtual wxString GetTitle() const override;
virtual int ShowModal() override;
// wxMSW-specific implementation from now on
// -----------------------------------------
// called from the hook procedure on WM_INITDIALOG reception
virtual void MSWOnInitDone(WXHWND hDlg);
// called from the hook procedure
void MSWCheckIfCurrentChanged(WXCOLORREF currentCol);
protected:
// common part of all ctors
void Init();
virtual void DoGetPosition( int *x, int *y ) const override;
virtual void DoGetSize(int *width, int *height) const override;
virtual void DoGetClientSize(int *width, int *height) const override;
virtual void DoMoveWindow(int x, int y, int width, int height) override;
virtual void DoCentre(int dir) override;
wxColourData m_colourData;
wxString m_title;
// Currently selected colour, used while the dialog is being shown.
WXCOLORREF m_currentCol;
// indicates that the dialog should be centered in this direction if non 0
// (set by DoCentre(), used by MSWOnInitDone())
int m_centreDir;
// true if DoMoveWindow() had been called
bool m_movedWindow;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxColourDialog);
};
#endif // _WX_COLORDLG_H_

View File

@@ -0,0 +1,71 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/colour.h
// Purpose: wxColour class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COLOUR_H_
#define _WX_COLOUR_H_
#include "wx/object.h"
// ----------------------------------------------------------------------------
// Colour
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxWARN_UNUSED wxColour : public wxColourBase
{
public:
// constructors
// ------------
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
// accessors
// ---------
virtual bool IsOk() const override { return m_isInit; }
unsigned char Red() const override { return m_red; }
unsigned char Green() const override { return m_green; }
unsigned char Blue() const override { return m_blue; }
unsigned char Alpha() const override { return m_alpha ; }
// comparison
bool operator==(const wxColour& colour) const
{
return m_isInit == colour.m_isInit
&& m_red == colour.m_red
&& m_green == colour.m_green
&& m_blue == colour.m_blue
&& m_alpha == colour.m_alpha;
}
bool operator!=(const wxColour& colour) const { return !(*this == colour); }
WXCOLORREF GetPixel() const { return m_pixel; }
public:
WXCOLORREF m_pixel;
protected:
// Helper function
void Init();
virtual void
InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a) override;
private:
bool m_isInit;
unsigned char m_red;
unsigned char m_blue;
unsigned char m_green;
unsigned char m_alpha;
private:
wxDECLARE_DYNAMIC_CLASS(wxColour);
};
#endif // _WX_COLOUR_H_

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

View File

@@ -0,0 +1,114 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/combo.h
// Purpose: wxComboCtrl class
// Author: Jaakko Salli
// Created: Apr-30-2006
// Copyright: (c) Jaakko Salli
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COMBOCONTROL_H_
#define _WX_COMBOCONTROL_H_
// NB: Definition of _WX_COMBOCONTROL_H_ is used in wx/generic/combo.h to
// determine whether there is native wxComboCtrl, so make sure you
// use it in all native wxComboCtrls.
#if wxUSE_COMBOCTRL
#if wxUSE_TIMER
#include "wx/timer.h"
#define wxUSE_COMBOCTRL_POPUP_ANIMATION 1
#endif
// ----------------------------------------------------------------------------
// Native wxComboCtrl
// ----------------------------------------------------------------------------
// Define this only if native implementation includes all features
#define wxCOMBOCONTROL_FULLY_FEATURED
extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[];
class WXDLLIMPEXP_CORE wxComboCtrl : public wxComboCtrlBase
{
public:
// ctors and such
wxComboCtrl() : wxComboCtrlBase() { Init(); }
wxComboCtrl(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxComboBoxNameStr))
: wxComboCtrlBase()
{
Init();
(void)Create(parent, id, value, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxComboBoxNameStr));
virtual ~wxComboCtrl();
virtual void PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const override;
virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const override;
static int GetFeatures() { return wxComboCtrlFeatures::All; }
#if wxUSE_COMBOCTRL_POPUP_ANIMATION
void OnTimerEvent(wxTimerEvent& WXUNUSED(event)) { DoTimerEvent(); }
protected:
void DoTimerEvent();
virtual bool AnimateShow( const wxRect& rect, int flags ) override;
#endif // wxUSE_COMBOCTRL_POPUP_ANIMATION
protected:
// Dummy method - we override all functions that call this
virtual WXHWND GetEditHWND() const override { return nullptr; }
// customization
virtual void OnResize() override;
virtual wxCoord GetNativeTextIndent() const override;
// event handlers
void OnPaintEvent( wxPaintEvent& event );
void OnMouseEvent( wxMouseEvent& event );
virtual bool HasTransparentBackground() override { return IsDoubleBuffered(); }
private:
void Init();
#if wxUSE_COMBOCTRL_POPUP_ANIMATION
// Popup animation related
wxMilliClock_t m_animStart;
wxTimer m_animTimer;
wxRect m_animRect;
int m_animFlags;
#endif
wxDECLARE_EVENT_TABLE();
wxDECLARE_DYNAMIC_CLASS(wxComboCtrl);
};
#endif // wxUSE_COMBOCTRL
#endif
// _WX_COMBOCONTROL_H_

View File

@@ -0,0 +1,186 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/combobox.h
// Purpose: wxComboBox class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COMBOBOX_H_
#define _WX_COMBOBOX_H_
#include "wx/choice.h"
#include "wx/textentry.h"
#if wxUSE_COMBOBOX
// ----------------------------------------------------------------------------
// Combobox control
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxComboBox : public wxChoice,
public wxTextEntry
{
public:
wxComboBox() { Init(); }
wxComboBox(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxComboBoxNameStr))
{
Init();
Create(parent, id, value, pos, size, n, choices, style, validator, name);
}
wxComboBox(wxWindow *parent, wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxComboBoxNameStr))
{
Init();
Create(parent, id, value, pos, size, choices, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0,
const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxComboBoxNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxComboBoxNameStr));
// See wxComboBoxBase discussion of IsEmpty().
bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
// resolve ambiguities among virtual functions inherited from both base
// classes
virtual void Clear() override;
virtual wxString GetValue() const override;
virtual void SetValue(const wxString& value) override;
virtual wxString GetStringSelection() const override
{ return wxChoice::GetStringSelection(); }
virtual void Popup() { MSWDoPopupOrDismiss(true); }
virtual void Dismiss() { MSWDoPopupOrDismiss(false); }
virtual void SetSelection(int n) override { wxChoice::SetSelection(n); }
virtual void SetSelection(long from, long to) override
{ wxTextEntry::SetSelection(from, to); }
virtual int GetSelection() const override { return wxChoice::GetSelection(); }
virtual bool ContainsHWND(WXHWND hWnd) const override;
virtual void GetSelection(long *from, long *to) const override;
virtual bool IsEditable() const override;
// implementation only from now on
virtual bool MSWCommand(WXUINT param, WXWORD id) override;
bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam);
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) override;
bool MSWShouldPreProcessMessage(WXMSG *pMsg) override;
// Standard event handling
void OnCut(wxCommandEvent& event);
void OnCopy(wxCommandEvent& event);
void OnPaste(wxCommandEvent& event);
void OnUndo(wxCommandEvent& event);
void OnRedo(wxCommandEvent& event);
void OnDelete(wxCommandEvent& event);
void OnSelectAll(wxCommandEvent& event);
void OnUpdateCut(wxUpdateUIEvent& event);
void OnUpdateCopy(wxUpdateUIEvent& event);
void OnUpdatePaste(wxUpdateUIEvent& event);
void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(wxUpdateUIEvent& event);
void OnUpdateDelete(wxUpdateUIEvent& event);
void OnUpdateSelectAll(wxUpdateUIEvent& event);
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const override;
virtual void SetLayoutDirection(wxLayoutDirection dir) override;
virtual const wxTextEntry* WXGetTextEntry() const override { return this; }
protected:
#if wxUSE_TOOLTIPS
virtual void DoSetToolTip(wxToolTip *tip) override;
#endif
virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const override;
// Override this one to avoid eating events from our popup listbox.
virtual wxWindow *MSWFindItem(long id, WXHWND hWnd) const override;
// this is the implementation of GetEditHWND() which can also be used when
// we don't have the edit control, it simply returns nullptr then
//
// try not to use this function unless absolutely necessary (as in the
// message handling code where the edit control might not be created yet
// for the messages we receive during the control creation) as normally
// just testing for IsEditable() and using GetEditHWND() should be enough
WXHWND GetEditHWNDIfAvailable() const;
virtual void EnableTextChangedEvents(bool enable) override
{
m_allowTextEvents = enable;
}
// Recreate the native control entirely while preserving its initial
// contents and attributes: this is useful if the height of the items must
// be changed as the native control doesn't seem to support doing this once
// it had been already determined.
void MSWRecreate();
private:
// there are the overridden wxTextEntry methods which should only be called
// when we do have an edit control so they assert if this is not the case
virtual wxWindow *GetEditableWindow() override;
virtual WXHWND GetEditHWND() const override;
// Common part of MSWProcessEditMsg() and MSWProcessSpecialKey(), return
// true if the key was processed.
bool MSWProcessEditSpecialKey(WXWPARAM vkey);
#if wxUSE_OLE
virtual void MSWProcessSpecialKey(wxKeyEvent& event) override;
#endif // wxUSE_OLE
// common part of all ctors
void Init()
{
m_allowTextEvents = true;
}
// normally true, false if text events are currently disabled
bool m_allowTextEvents;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox);
wxDECLARE_EVENT_TABLE();
};
#endif // wxUSE_COMBOBOX
#endif // _WX_COMBOBOX_H_

View File

@@ -0,0 +1,73 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/commandlinkbutton.h
// Purpose: wxCommandLinkButton class
// Author: Rickard Westerlund
// Created: 2010-06-11
// Copyright: (c) 2010 wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_COMMANDLINKBUTTON_H_
#define _WX_MSW_COMMANDLINKBUTTON_H_
// ----------------------------------------------------------------------------
// Command link button for wxMSW
// ----------------------------------------------------------------------------
// Derive from the generic version to be able to fall back to it during
// run-time if the command link buttons are not supported by the system we're
// running under.
class WXDLLIMPEXP_ADV wxCommandLinkButton : public wxGenericCommandLinkButton
{
public:
wxCommandLinkButton () : wxGenericCommandLinkButton() { }
wxCommandLinkButton(wxWindow *parent,
wxWindowID id,
const wxString& mainLabel = wxEmptyString,
const wxString& note = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxButtonNameStr))
: wxGenericCommandLinkButton()
{
Create(parent, id, mainLabel, note, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& mainLabel = wxEmptyString,
const wxString& note = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxButtonNameStr));
// overridden base class methods
// -----------------------------
// do the same thing as in the generic case here
virtual void SetLabel(const wxString& label) override
{
SetMainLabelAndNote(label.BeforeFirst('\n'), label.AfterFirst('\n'));
}
virtual void SetMainLabelAndNote(const wxString& mainLabel,
const wxString& note) override;
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const override;
protected:
virtual wxSize DoGetBestSize() const override;
virtual bool HasNativeBitmap() const override;
private:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxCommandLinkButton);
};
#endif // _WX_MSW_COMMANDLINKBUTTON_H_

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,155 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/control.h
// Purpose: wxControl class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CONTROL_H_
#define _WX_CONTROL_H_
#include "wx/dynarray.h"
// General item class
class WXDLLIMPEXP_CORE wxControl : public wxControlBase
{
public:
wxControl() = default;
wxControl(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxControlNameStr))
{
Create(parent, id, pos, size, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxControlNameStr));
// Simulates an event
virtual void Command(wxCommandEvent& event) override { ProcessCommand(event); }
// implementation from now on
// --------------------------
virtual wxVisualAttributes GetDefaultAttributes() const override
{
return GetClassDefaultAttributes(GetWindowVariant());
}
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
// Calls the callback and appropriate event handlers
bool ProcessCommand(wxCommandEvent& event);
// MSW-specific
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) override;
// For ownerdraw items
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return false; }
virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return false; }
const wxArrayLong& GetSubcontrols() const { return m_subControls; }
// default handling of WM_CTLCOLORxxx: this is public so that wxWindow
// could call it
virtual WXHBRUSH MSWControlColor(WXHDC pDC, WXHWND hWnd);
// default style for the control include WS_TABSTOP if it AcceptsFocus()
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const override;
protected:
// Hook for common controls for which we don't want to set the default font
// as if we do set it, the controls don't update their font size
// automatically in response to WM_SETTINGCHANGE if it's changed in the
// display properties in the control panel, so avoid doing this for them.
virtual bool MSWShouldSetDefaultFont() const { return true; }
// choose the default border for this window
virtual wxBorder GetDefaultBorder() const override;
// return default best size (doesn't really make any sense, override this)
virtual wxSize DoGetBestSize() const override;
// create the control of the given Windows class: this is typically called
// from Create() method of the derived class passing its label, pos and
// size parameter (style parameter is not needed because m_windowStyle is
// supposed to had been already set and so is used instead when this
// function is called)
//
// Note that this calls MSWGetStyle() to determine the Windows styles to
// use, so it must be implemented correctly in the derived class.
bool MSWCreateControl(const wxChar *classname,
const wxString& label,
const wxPoint& pos,
const wxSize& size);
// Prefer the overload above, this one should only be used if the styles
// can't be completely determined from the window style.
bool MSWCreateControl(const wxChar *classname,
WXDWORD style,
const wxPoint& pos,
const wxSize& size,
const wxString& label,
WXDWORD exstyle);
// call this from the derived class MSWControlColor() if you want to show
// the control greyed out (and opaque)
WXHBRUSH MSWControlColorDisabled(WXHDC pDC);
// common part of the 3 functions above: pass wxNullColour to use the
// appropriate background colour (meaning ours or our parents) or a fixed
// one
virtual WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd);
// Look in our GetSubcontrols() for the windows with the given ID.
virtual wxWindow *MSWFindItem(long id, WXHWND hWnd) const override;
// Struct used for MSWGetDarkModeSupport() below.
struct MSWDarkModeSupport
{
// The name of the theme to use (also called "app name").
const wchar_t* themeName = nullptr;
// The theme IDs to use. If neither this field nor the theme name is
// set, no theme is applied to the window.
const wchar_t* themeId = nullptr;
// For some controls we need to set the foreground explicitly, even if
// they have some support for the dark theme.
bool setForeground = false;
};
// Called after creating the control to enable dark mode support if needed.
//
// If this function returns true, wxControl allows using dark mode for the
// window and set its theme to the one specified by MSWDarkModeSupport
// fields.
virtual bool MSWGetDarkModeSupport(MSWDarkModeSupport& support) const;
// Return the message that can be used to retrieve the tooltip window used
// by a native control. If this message is non-zero and sending it returns
// a valid HWND, the dark theme is also applied to it, if appropriate.
virtual int MSWGetToolTipMessage() const { return 0; }
// for controls like radiobuttons which are really composite this array
// holds the ids (not HWNDs!) of the sub controls
wxArrayLong m_subControls;
private:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxControl);
};
#endif // _WX_CONTROL_H_

View File

@@ -0,0 +1,118 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/crashrpt.h
// Purpose: helpers for the structured exception handling (SEH) under Win32
// Author: Vadim Zeitlin
// Created: 13.07.2003
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_CRASHRPT_H_
#define _WX_MSW_CRASHRPT_H_
#include "wx/defs.h"
#if wxUSE_CRASHREPORT
struct _EXCEPTION_POINTERS;
// ----------------------------------------------------------------------------
// crash report generation flags
// ----------------------------------------------------------------------------
enum
{
// we always report where the crash occurred
wxCRASH_REPORT_LOCATION = 0,
// if this flag is given, the call stack is dumped
//
// this results in dump/crash report as small as possible, this is the
// default flag
wxCRASH_REPORT_STACK = 1,
// if this flag is given, the values of the local variables are dumped
//
// note that with the current implementation it requires dumping the full
// process address space and so this will result in huge dump file and will
// take some time to generate
//
// it's probably not a good idea to use this by default, start with default
// mini dump and ask your users to set WX_CRASH_FLAGS environment variable
// to 2 or 4 if you need more information in the dump
wxCRASH_REPORT_LOCALS = 2,
// if this flag is given, the values of all global variables are dumped
//
// this creates a much larger mini dump than just wxCRASH_REPORT_STACK but
// still much smaller than wxCRASH_REPORT_LOCALS one
wxCRASH_REPORT_GLOBALS = 4,
// default is to create the smallest possible crash report
wxCRASH_REPORT_DEFAULT = wxCRASH_REPORT_LOCATION | wxCRASH_REPORT_STACK
};
// ----------------------------------------------------------------------------
// wxCrashContext: information about the crash context
// ----------------------------------------------------------------------------
struct WXDLLIMPEXP_BASE wxCrashContext
{
// initialize this object with the given information or from the current
// global exception info which is only valid inside wxApp::OnFatalException
wxCrashContext(_EXCEPTION_POINTERS *ep = nullptr);
// get the name for this exception code
wxString GetExceptionString() const;
// exception code
size_t code;
// exception address
void *addr;
// machine-specific registers vaues
struct
{
#ifdef __INTEL__
wxInt32 eax, ebx, ecx, edx, esi, edi,
ebp, esp, eip,
cs, ds, es, fs, gs, ss,
flags;
#endif // __INTEL__
} regs;
};
// ----------------------------------------------------------------------------
// wxCrashReport: this class is used to create crash reports
// ----------------------------------------------------------------------------
struct WXDLLIMPEXP_BASE wxCrashReport
{
// set the name of the file to which the report is written, it is
// constructed from the .exe name by default
static void SetFileName(const wxString& filename);
// return the current file name
static wxString GetFileName();
// write the exception report to the file, return true if it could be done
// or false otherwise
//
// if ep pointer is null, the global exception info which is valid only
// inside wxApp::OnFatalException() is used
static bool Generate(int flags = wxCRASH_REPORT_DEFAULT,
_EXCEPTION_POINTERS *ep = nullptr);
// generate a crash report from outside of wxApp::OnFatalException(), this
// can be used to take "snapshots" of the program in wxApp::OnAssert() for
// example
static bool GenerateNow(int flags = wxCRASH_REPORT_DEFAULT);
};
#endif // wxUSE_CRASHREPORT
#endif // _WX_MSW_CRASHRPT_H_

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

View File

@@ -0,0 +1,42 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/ctrlsub.h
// Purpose: common functionality of wxItemContainer-derived controls
// Author: Vadim Zeitlin
// Created: 2007-07-25
// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_CTRLSUB_H_
#define _WX_MSW_CTRLSUB_H_
// ----------------------------------------------------------------------------
// wxControlWithItems
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxControlWithItems : public wxControlWithItemsBase
{
public:
wxControlWithItems() = default;
protected:
// preallocate memory for inserting the given new items into the control
// using the wm message (normally either LB_INITSTORAGE or CB_INITSTORAGE)
void MSWAllocStorage(const wxArrayStringsAdapter& items, unsigned wm);
// insert or append a string to the controls using the given message
// (one of {CB,LB}_{ADD,INSERT}STRING, pos must be 0 when appending)
int MSWInsertOrAppendItem(unsigned pos, const wxString& item, unsigned wm);
// normally the control containing the items is this window itself but if
// the derived control is composed of several windows, this method can be
// overridden to return the real list/combobox control
virtual WXHWND MSWGetItemsHWND() const { return GetHWND(); }
private:
wxDECLARE_ABSTRACT_CLASS(wxControlWithItems);
wxDECLARE_NO_COPY_CLASS(wxControlWithItems);
};
#endif // _WX_MSW_CTRLSUB_H_

View File

@@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/cursor.h
// Purpose: wxCursor class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CURSOR_H_
#define _WX_CURSOR_H_
class WXDLLIMPEXP_FWD_CORE wxImage;
// Cursor
class WXDLLIMPEXP_CORE wxCursor : public wxCursorBase
{
public:
// constructors
wxCursor();
wxCursor(const wxBitmap& bitmap, const wxPoint& hotSpot);
wxCursor(const wxBitmap& bitmap, int hotSpotX = 0, int hotSpotY = 0)
: wxCursor(bitmap, wxPoint(hotSpotX, hotSpotY)) { }
#if wxUSE_IMAGE
wxCursor(const wxImage& image);
wxCursor(const char* const* xpmData);
#endif // wxUSE_IMAGE
wxCursor(const wxString& name, wxBitmapType type, const wxPoint& hotSpot)
: wxCursor(name, type, hotSpot.x, hotSpot.y) { }
wxCursor(const wxString& name,
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
int hotSpotX = 0, int hotSpotY = 0);
wxCursor(wxStockCursor id) { InitFromStock(id); }
virtual wxPoint GetHotSpot() const override;
// implementation only
void SetHCURSOR(WXHCURSOR cursor) { SetHandle((WXHANDLE)cursor); }
WXHCURSOR GetHCURSOR() const { return (WXHCURSOR)GetHandle(); }
protected:
void InitFromStock(wxStockCursor);
virtual wxGDIImageRefData *CreateData() const override;
private:
void InitFromBitmap(const wxBitmap& bmp, const wxPoint& hotSpot);
#if wxUSE_IMAGE
void InitFromImage(const wxImage& image);
#endif // wxUSE_IMAGE
wxDECLARE_DYNAMIC_CLASS(wxCursor);
};
#endif
// _WX_CURSOR_H_

View File

@@ -0,0 +1,54 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/custombgwin.h
// Purpose: wxMSW implementation of wxCustomBackgroundWindow
// Author: Vadim Zeitlin
// Created: 2011-10-10
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_CUSTOMBGWIN_H_
#define _WX_MSW_CUSTOMBGWIN_H_
#include "wx/bitmap.h"
#include "wx/brush.h"
// ----------------------------------------------------------------------------
// wxCustomBackgroundWindow
// ----------------------------------------------------------------------------
template <class W>
class wxCustomBackgroundWindow : public W,
public wxCustomBackgroundWindowBase
{
public:
typedef W BaseWindowClass;
wxCustomBackgroundWindow() = default;
protected:
virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) override
{
m_backgroundBrush = bmp.IsOk() ? wxBrush(bmp) : wxNullBrush;
// Our transparent children should use our background if we have it,
// otherwise try to restore m_inheritBgCol to some reasonable value: true
// if we also have non-default background colour or false otherwise.
BaseWindowClass::m_inheritBgCol = bmp.IsOk()
|| BaseWindowClass::UseBgCol();
}
virtual WXHBRUSH MSWGetCustomBgBrush() override
{
if ( m_backgroundBrush.IsOk() )
return (WXHBRUSH)m_backgroundBrush.GetResourceHandle();
return BaseWindowClass::MSWGetCustomBgBrush();
}
wxBrush m_backgroundBrush;
wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCustomBackgroundWindow, W);
};
#endif // _WX_MSW_CUSTOMBGWIN_H_

View File

@@ -0,0 +1,52 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/darkmode.h
// Purpose: MSW-specific header with dark mode related declarations.
// Author: Vadim Zeitlin
// Created: 2023-02-19
// Copyright: (c) 2023 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_DARKMODE_H_
#define _WX_MSW_DARKMODE_H_
#include "wx/settings.h"
// Constants used with wxDarkModeSettings::GetMenuColour().
enum class wxMenuColour
{
StandardFg,
StandardBg,
DisabledFg,
HotBg
};
// ----------------------------------------------------------------------------
// wxDarkModeSettings: allows to customize some of dark mode settings
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDarkModeSettings
{
public:
wxDarkModeSettings() = default;
virtual ~wxDarkModeSettings();
// Get the colour to use for the given system colour when dark mode is on.
virtual wxColour GetColour(wxSystemColour index);
// Menu items don't use any of the standard colours, but are defined by
// this function.
virtual wxColour GetMenuColour(wxMenuColour which);
// Get the pen to use for drawing wxStaticBox border in dark mode.
//
// Returning an invalid pen indicates that the default border drawn by the
// system should be used, which doesn't look very well in dark mode but
// shouldn't result in any problems worse than cosmetic ones.
virtual wxPen GetBorderPen();
private:
wxDECLARE_NO_COPY_CLASS(wxDarkModeSettings);
};
#endif // _WX_MSW_DARKMODE_H_

View File

@@ -0,0 +1,68 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/datectrl.h
// Purpose: wxDatePickerCtrl for Windows
// Author: Vadim Zeitlin
// Created: 2005-01-09
// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_DATECTRL_H_
#define _WX_MSW_DATECTRL_H_
// ----------------------------------------------------------------------------
// wxDatePickerCtrl
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlBase
{
public:
// ctors
wxDatePickerCtrl() = default;
wxDatePickerCtrl(wxWindow *parent,
wxWindowID id,
const wxDateTime& dt = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxDatePickerCtrlNameStr)
{
Create(parent, id, dt, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxDateTime& dt = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxDatePickerCtrlNameStr);
// Override this one to add date-specific (and time-ignoring) checks.
virtual void SetValue(const wxDateTime& dt) override;
virtual wxDateTime GetValue() const override;
// Implement the base class pure virtuals.
virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2) override;
virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const override;
// Override MSW-specific functions used during control creation.
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const override;
protected:
#if wxUSE_INTL
virtual wxLocaleInfo MSWGetFormat() const override;
#endif // wxUSE_INTL
virtual bool MSWAllowsNone() const override { return HasFlag(wxDP_ALLOWNONE); }
virtual bool MSWOnDateTimeChange(const tagNMDATETIMECHANGE& dtch) override;
private:
wxDateTime MSWGetControlValue() const;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl);
};
#endif // _WX_MSW_DATECTRL_H_

View File

@@ -0,0 +1,84 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/datetimectrl.h
// Purpose: wxDateTimePickerCtrl for Windows.
// Author: Vadim Zeitlin
// Created: 2011-09-22 (extracted from wx/msw/datectrl.h).
// Copyright: (c) 2005-2011 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_DATETIMECTRL_H_
#define _WX_MSW_DATETIMECTRL_H_
#include "wx/intl.h"
// Forward declare a struct from Platform SDK.
struct tagNMDATETIMECHANGE;
// ----------------------------------------------------------------------------
// wxDateTimePickerCtrl
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxDateTimePickerCtrl : public wxDateTimePickerCtrlBase
{
public:
// set/get the date
virtual void SetValue(const wxDateTime& dt) override;
virtual wxDateTime GetValue() const override;
virtual void SetNullText(const wxString& text) override;
// returns true if the platform should explicitly apply a theme border
virtual bool CanApplyThemeBorder() const override { return false; }
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) override;
protected:
virtual wxBorder GetDefaultBorder() const override { return wxBORDER_NONE; }
virtual wxSize DoGetBestSize() const override;
// Helper for the derived classes Create(): creates a native control with
// the specified attributes.
bool MSWCreateDateTimePicker(wxWindow *parent,
wxWindowID id,
const wxDateTime& dt,
const wxPoint& pos,
const wxSize& size,
long style,
const wxValidator& validator,
const wxString& name);
#if wxUSE_INTL
// Override to return the date/time format used by this control.
virtual wxLocaleInfo MSWGetFormat() const = 0;
// Set the format used by the native control.
void MSWSetTimeFormat(wxLocaleInfo index);
#endif // wxUSE_INTL
// Override to indicate whether we can have no date at all.
virtual bool MSWAllowsNone() const = 0;
// Override to update m_date and send the event when the control contents
// changes, return true if the event was handled.
virtual bool MSWOnDateTimeChange(const tagNMDATETIMECHANGE& dtch) = 0;
// the date currently shown by the control, may be invalid
wxDateTime m_date;
private:
// Helper setting the appropriate format depending on the passed in state.
void MSWUpdateFormat(bool valid);
// Same thing, but only doing if the validity differs from the date
// validity, i.e. avoiding useless work if nothing needs to be done.
void MSWUpdateFormatIfNeeded(bool valid);
// shown when there is no valid value (so only used with wxDP_ALLOWNONE),
// always non-empty if SetNullText() was called, see the comments there
wxString m_nullText;
};
#endif // _WX_MSW_DATETIMECTRL_H_

View File

@@ -0,0 +1,383 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/dc.h
// Purpose: wxDC class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_DC_H_
#define _WX_MSW_DC_H_
#include "wx/defs.h"
#include "wx/dc.h"
// ---------------------------------------------------------------------------
// macros
// ---------------------------------------------------------------------------
#if wxUSE_DC_CACHEING
/*
* Cached blitting, maintaining a cache
* of bitmaps required for transparent blitting
* instead of constant creation/deletion
*/
class wxDCCacheEntry: public wxObject
{
public:
wxDCCacheEntry(WXHBITMAP hBitmap, int w, int h, int depth);
wxDCCacheEntry(WXHDC hDC, int depth);
virtual ~wxDCCacheEntry();
WXHBITMAP m_bitmap;
WXHDC m_dc;
int m_width;
int m_height;
int m_depth;
};
#endif
// this is an ABC: use one of the derived classes to create a DC associated
// with a window, screen, printer and so on
class WXDLLIMPEXP_CORE wxMSWDCImpl: public wxDCImpl
{
public:
wxMSWDCImpl(wxDC *owner, WXHDC hDC);
virtual ~wxMSWDCImpl();
// implement base class pure virtuals
// ----------------------------------
virtual void Clear() override;
virtual bool StartDoc(const wxString& message) override;
virtual void EndDoc() override;
virtual void StartPage() override;
virtual void EndPage() override;
virtual void SetFont(const wxFont& font) override;
virtual void SetPen(const wxPen& pen) override;
virtual void SetBrush(const wxBrush& brush) override;
virtual void SetBackground(const wxBrush& brush) override;
virtual void SetBackgroundMode(int mode) override;
#if wxUSE_PALETTE
virtual void SetPalette(const wxPalette& palette) override;
#endif // wxUSE_PALETTE
virtual void DestroyClippingRegion() override;
virtual wxCoord GetCharHeight() const override;
virtual wxCoord GetCharWidth() const override;
virtual bool CanDrawBitmap() const override;
virtual bool CanGetTextExtent() const override;
virtual int GetDepth() const override;
virtual wxSize GetPPI() const override;
virtual void SetMapMode(wxMappingMode mode) override;
virtual void SetUserScale(double x, double y) override;
virtual void SetLogicalScale(double x, double y) override;
virtual void SetLogicalOrigin(wxCoord x, wxCoord y) override;
virtual void SetDeviceOrigin(wxCoord x, wxCoord y) override;
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) override;
virtual wxPoint DeviceToLogical(wxCoord x, wxCoord y) const override;
virtual wxPoint LogicalToDevice(wxCoord x, wxCoord y) const override;
virtual wxSize DeviceToLogicalRel(int x, int y) const override;
virtual wxSize LogicalToDeviceRel(int x, int y) const override;
#if wxUSE_DC_TRANSFORM_MATRIX
virtual bool CanUseTransformMatrix() const override;
virtual bool SetTransformMatrix(const wxAffineMatrix2D& matrix) override;
virtual wxAffineMatrix2D GetTransformMatrix() const override;
virtual void ResetTransformMatrix() override;
#endif // wxUSE_DC_TRANSFORM_MATRIX
virtual void SetLogicalFunction(wxRasterOperationMode function) override;
// implementation from now on
// --------------------------
virtual void SetRop(WXHDC cdc);
virtual void SelectOldObjects(WXHDC dc);
void SetWindow(wxWindow *win)
{
m_window = win;
#if wxUSE_PALETTE
// if we have palettes use the correct one for this window
InitializePalette();
#endif // wxUSE_PALETTE
}
WXHDC GetHDC() const { return m_hDC; }
void SetHDC(WXHDC dc, bool bOwnsDC = false)
{
m_hDC = dc;
m_bOwnsDC = bOwnsDC;
// we might have a pre existing clipping region, make sure that we
// return it if asked -- but avoid calling ::GetClipBox() right now as
// it could be unnecessary wasteful
m_clipping = true;
m_isClipBoxValid = false;
}
void* GetHandle() const override { return (void*)GetHDC(); }
const wxBitmap& GetSelectedBitmap() const override { return m_selectedBitmap; }
wxBitmap& GetSelectedBitmap() override { return m_selectedBitmap; }
// update the internal clip box variables
void UpdateClipBox();
#if wxUSE_DC_CACHEING
static wxDCCacheEntry* FindBitmapInCache(WXHDC hDC, int w, int h);
static wxDCCacheEntry* FindDCInCache(wxDCCacheEntry* notThis, WXHDC hDC);
static void AddToBitmapCache(wxDCCacheEntry* entry);
static void AddToDCCache(wxDCCacheEntry* entry);
static void ClearCache();
#endif
// RTL related functions
// ---------------------
// get or change the layout direction (LTR or RTL) for this dc,
// wxLayout_Default is returned if layout direction is not supported
virtual wxLayoutDirection GetLayoutDirection() const override;
virtual void SetLayoutDirection(wxLayoutDirection dir) override;
protected:
void Init()
{
m_bOwnsDC = false;
m_hDC = nullptr;
m_oldBitmap = nullptr;
m_oldPen = nullptr;
m_oldBrush = nullptr;
m_oldFont = nullptr;
#if wxUSE_PALETTE
m_oldPalette = nullptr;
#endif // wxUSE_PALETTE
m_isClipBoxValid = false;
}
// Unlike the public SetWindow(), this one doesn't call InitializePalette().
void InitWindow(wxWindow* window);
// create an uninitialized DC: this should be only used by the derived
// classes
wxMSWDCImpl( wxDC *owner ) : wxDCImpl( owner ) { Init(); }
void RealizeScaleAndOrigin();
public:
virtual void DoGetFontMetrics(int *height,
int *ascent,
int *descent,
int *internalLeading,
int *externalLeading,
int *averageWidth) const override;
virtual void DoGetTextExtent(const wxString& string,
wxCoord *x, wxCoord *y,
wxCoord *descent = nullptr,
wxCoord *externalLeading = nullptr,
const wxFont *theFont = nullptr) const override;
virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const override;
virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
wxFloodFillStyle style = wxFLOOD_SURFACE) override;
virtual void DoGradientFillLinear(const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour,
wxDirection nDirection = wxEAST) override;
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const override;
virtual void DoDrawPoint(wxCoord x, wxCoord y) override;
virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) override;
virtual void DoDrawArc(wxCoord x1, wxCoord y1,
wxCoord x2, wxCoord y2,
wxCoord xc, wxCoord yc) override;
virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
double sa, double ea) override;
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) override;
virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
wxCoord width, wxCoord height,
double radius) override;
virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) override;
#if wxUSE_SPLINES
virtual void DoDrawSpline(const wxPointList *points) override;
#endif
virtual void DoCrossHair(wxCoord x, wxCoord y) override;
virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) override;
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
bool useMask = false) override;
virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) override;
virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
double angle) override;
virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) override;
virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest,
wxCoord dstWidth, wxCoord dstHeight,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
wxCoord srcWidth, wxCoord srcHeight,
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) override;
virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
wxCoord width, wxCoord height) override;
virtual void DoSetDeviceClippingRegion(const wxRegion& region) override;
virtual bool DoGetClippingRect(wxRect& rect) const override;
virtual void DoGetSizeMM(int* width, int* height) const override;
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset) override;
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE) override;
virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE) override;
virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const override
{
return subrect == nullptr ? GetSelectedBitmap()
: GetSelectedBitmap().GetSubBitmap(*subrect);
}
#if wxUSE_PALETTE
// MSW specific, select a logical palette into the HDC
// (tell windows to translate pixel from other palettes to our custom one
// and vice versa)
// Realize tells it to also reset the system palette to this one.
void DoSelectPalette(bool realize = false);
// Find out what palette our parent window has, then select it into the dc
void InitializePalette();
#endif // wxUSE_PALETTE
protected:
// common part of DoDrawText() and DoDrawRotatedText()
void DrawAnyText(const wxString& text, wxCoord x, wxCoord y);
// common part of DoSetClippingRegion() and DoSetDeviceClippingRegion()
void SetClippingHrgn(WXHRGN hrgn, bool doRtlOffset = false);
// implementation of DoGetSize() for wxScreen/PrinterDC: this simply
// returns the size of the entire device this DC is associated with
//
// notice that we intentionally put it in a separate function instead of
// DoGetSize() itself because we want it to remain pure virtual both
// because each derived class should take care to define it as needed (this
// implementation is not at all always appropriate) and because we want
// wxDC to be an ABC to prevent it from being created directly
void GetDeviceSize(int *width, int *height) const;
// MSW-specific member variables
// -----------------------------
wxBitmap m_selectedBitmap;
// TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it
bool m_bOwnsDC:1;
// our HDC
WXHDC m_hDC;
// Store all old GDI objects when do a SelectObject, so we can select them
// back in (this unselecting user's objects) so we can safely delete the
// DC.
WXHBITMAP m_oldBitmap;
WXHPEN m_oldPen;
WXHBRUSH m_oldBrush;
WXHFONT m_oldFont;
#if wxUSE_PALETTE
WXHPALETTE m_oldPalette;
#endif // wxUSE_PALETTE
#if wxUSE_DC_CACHEING
static wxObjectList sm_bitmapCache;
static wxObjectList sm_dcCache;
#endif
bool m_isClipBoxValid;
wxDECLARE_CLASS(wxMSWDCImpl);
wxDECLARE_NO_COPY_CLASS(wxMSWDCImpl);
};
// ----------------------------------------------------------------------------
// wxDCTemp: a wxDC which doesn't free the given HDC (used by wxWidgets
// only/mainly)
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDCTempImpl : public wxMSWDCImpl
{
public:
// construct a temporary DC with the specified HDC and size (it should be
// specified whenever we know it for this HDC)
wxDCTempImpl(wxDC *owner, WXHDC hdc, const wxSize& size )
: wxMSWDCImpl( owner, hdc ),
m_size(size)
{
}
virtual ~wxDCTempImpl()
{
// prevent base class dtor from freeing it
SetHDC((WXHDC)nullptr);
}
virtual void DoGetSize(int *w, int *h) const override
{
wxASSERT_MSG( m_size.IsFullySpecified(),
wxT("size of this DC hadn't been set and is unknown") );
if ( w )
*w = m_size.x;
if ( h )
*h = m_size.y;
}
private:
// size of this DC must be explicitly set by SetSize() as we have no way to
// find it ourselves
const wxSize m_size;
wxDECLARE_NO_COPY_CLASS(wxDCTempImpl);
};
class WXDLLIMPEXP_CORE wxDCTemp : public wxDC
{
public:
wxDCTemp(WXHDC hdc, const wxSize& size = wxDefaultSize)
: wxDC(new wxDCTempImpl(this, hdc, size))
{
}
};
#endif // _WX_MSW_DC_H_

View File

@@ -0,0 +1,110 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/dcclient.h
// Purpose: wxClientDC class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCCLIENT_H_
#define _WX_DCCLIENT_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/dc.h"
#include "wx/msw/dc.h"
#include "wx/dcclient.h"
class wxPaintDCInfo;
// ----------------------------------------------------------------------------
// DC classes
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxMSWDCImpl
{
public:
// default ctor
wxWindowDCImpl( wxDC *owner );
// Create a DC corresponding to the whole window
wxWindowDCImpl( wxDC *owner, wxWindow *win );
virtual void DoGetSize(int *width, int *height) const override;
protected:
// initialize the newly created DC
void InitDC();
wxDECLARE_CLASS(wxWindowDCImpl);
wxDECLARE_NO_COPY_CLASS(wxWindowDCImpl);
};
class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl
{
public:
// default ctor
wxClientDCImpl( wxDC *owner );
// Create a DC corresponding to the client area of the window
wxClientDCImpl( wxDC *owner, wxWindow *win );
virtual ~wxClientDCImpl();
virtual void DoGetSize(int *width, int *height) const override;
static bool
CanBeUsedForDrawing(const wxWindow* WXUNUSED(window)) { return true; }
protected:
void InitDC();
wxDECLARE_CLASS(wxClientDCImpl);
wxDECLARE_NO_COPY_CLASS(wxClientDCImpl);
};
class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl
{
public:
wxPaintDCImpl( wxDC *owner );
// Create a DC corresponding for painting the window in OnPaint()
wxPaintDCImpl( wxDC *owner, wxWindow *win );
virtual ~wxPaintDCImpl();
// find the entry for this DC in the cache (keyed by the window)
static WXHDC FindDCInCache(wxWindow* win);
// This must be called by the code handling WM_PAINT to remove the DC
// cached for this window for the duration of this message processing.
static void EndPaint(wxWindow *win);
protected:
// Find the DC for this window in the cache, return nullptr if not found.
static wxPaintDCInfo *FindInCache(wxWindow* win);
wxDECLARE_CLASS(wxPaintDCImpl);
wxDECLARE_NO_COPY_CLASS(wxPaintDCImpl);
};
/*
* wxPaintDCEx
* This class is used when an application sends an HDC with the WM_PAINT
* message. It is used in HandlePaint and need not be used by an application.
*/
class WXDLLIMPEXP_CORE wxPaintDCEx : public wxPaintDC
{
public:
wxPaintDCEx(wxWindow *canvas, WXHDC dc);
wxDECLARE_CLASS(wxPaintDCEx);
wxDECLARE_NO_COPY_CLASS(wxPaintDCEx);
};
#endif
// _WX_DCCLIENT_H_

View File

@@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/dcmemory.h
// Purpose: wxMemoryDC class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCMEMORY_H_
#define _WX_DCMEMORY_H_
#include "wx/dcmemory.h"
#include "wx/msw/dc.h"
class WXDLLIMPEXP_CORE wxMemoryDCImpl: public wxMSWDCImpl
{
public:
wxMemoryDCImpl( wxMemoryDC *owner );
wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap );
wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc ); // Create compatible DC
// override some base class virtuals
virtual wxSize GetPPI() const override;
virtual void SetFont(const wxFont& font) override;
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) override;
virtual void DoGetSize(int* width, int* height) const override;
virtual void DoSelect(const wxBitmap& bitmap) override;
virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const override
{ return subrect == nullptr ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmapOfHDC(*subrect, GetHDC() );}
protected:
// create DC compatible with the given one or screen if dc == nullptr
bool CreateCompatible(wxDC *dc);
// initialize the newly created DC
void Init();
wxDECLARE_CLASS(wxMemoryDCImpl);
wxDECLARE_NO_COPY_CLASS(wxMemoryDCImpl);
};
#endif
// _WX_DCMEMORY_H_

View File

@@ -0,0 +1,87 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/dcprint.h
// Purpose: wxPrinterDC class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_DCPRINT_H_
#define _WX_MSW_DCPRINT_H_
#if wxUSE_PRINTING_ARCHITECTURE
#include "wx/dcprint.h"
#include "wx/cmndata.h"
#include "wx/msw/dc.h"
// ------------------------------------------------------------------------
// wxPrinterDCImpl
//
class WXDLLIMPEXP_CORE wxPrinterDCImpl : public wxMSWDCImpl
{
public:
// Create from print data
wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data );
wxPrinterDCImpl( wxPrinterDC *owner, WXHDC theDC );
// override some base class virtuals
virtual bool StartDoc(const wxString& message) override;
virtual void EndDoc() override;
virtual void StartPage() override;
virtual void EndPage() override;
virtual wxRect GetPaperRect() const override;
virtual wxSize FromDIP(const wxSize& sz) const override;
virtual wxSize ToDIP(const wxSize& sz) const override;
void SetFont(const wxFont& font) override;
protected:
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
bool useMask = false) override;
virtual bool DoBlit(wxCoord xdest, wxCoord ydest,
wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) override;
virtual void DoGetSize(int *w, int *h) const override
{
GetDeviceSize(w, h);
}
// init the dc
void Init();
wxPrintData m_printData;
private:
wxDECLARE_CLASS(wxPrinterDCImpl);
wxDECLARE_NO_COPY_CLASS(wxPrinterDCImpl);
};
// Gets an HDC for the specified printer configuration
WXHDC WXDLLIMPEXP_CORE wxGetPrinterDC(const wxPrintData& data);
// ------------------------------------------------------------------------
// wxPrinterDCromHDC
//
class WXDLLIMPEXP_CORE wxPrinterDCFromHDC: public wxPrinterDC
{
public:
wxPrinterDCFromHDC( WXHDC theDC )
: wxPrinterDC(new wxPrinterDCImpl(this, theDC))
{
}
};
#endif // wxUSE_PRINTING_ARCHITECTURE
#endif // _WX_MSW_DCPRINT_H_

View File

@@ -0,0 +1,30 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/dcscreen.h
// Purpose: wxScreenDC class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_DCSCREEN_H_
#define _WX_MSW_DCSCREEN_H_
#include "wx/dcscreen.h"
#include "wx/msw/dc.h"
class WXDLLIMPEXP_CORE wxScreenDCImpl : public wxMSWDCImpl
{
public:
// Create a DC representing the whole virtual screen (all monitors)
wxScreenDCImpl( wxScreenDC *owner );
// Return the size of the whole virtual screen (all monitors)
virtual void DoGetSize(int *w, int *h) const override;
wxDECLARE_CLASS(wxScreenDCImpl);
wxDECLARE_NO_COPY_CLASS(wxScreenDCImpl);
};
#endif // _WX_MSW_DCSCREEN_H_

View File

@@ -0,0 +1,136 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/dde.h
// Purpose: DDE class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DDE_H_
#define _WX_DDE_H_
#include "wx/ipcbase.h"
/*
* Mini-DDE implementation
Most transactions involve a topic name and an item name (choose these
as befits your application).
A client can:
- ask the server to execute commands (data) associated with a topic
- request data from server by topic and item
- poke data into the server
- ask the server to start an advice loop on topic/item
- ask the server to stop an advice loop
A server can:
- respond to execute, request, poke and advice start/stop
- send advise data to client
Note that this limits the server in the ways it can send data to the
client, i.e. it can't send unsolicited information.
*
*/
class WXDLLIMPEXP_FWD_BASE wxDDEServer;
class WXDLLIMPEXP_FWD_BASE wxDDEClient;
class WXDLLIMPEXP_BASE wxDDEConnection : public wxConnectionBase
{
public:
wxDDEConnection(void *buffer, size_t size); // use external buffer
wxDDEConnection(); // use internal buffer
virtual ~wxDDEConnection();
// implement base class pure virtual methods
virtual const void *Request(const wxString& item,
size_t *size = nullptr,
wxIPCFormat format = wxIPC_TEXT) override;
virtual bool StartAdvise(const wxString& item) override;
virtual bool StopAdvise(const wxString& item) override;
virtual bool Disconnect() override;
protected:
virtual bool DoExecute(const void *data, size_t size, wxIPCFormat format) override;
virtual bool DoPoke(const wxString& item, const void *data, size_t size,
wxIPCFormat format) override;
virtual bool DoAdvise(const wxString& item, const void *data, size_t size,
wxIPCFormat format) override;
public:
wxString m_topicName;
wxDDEServer* m_server;
wxDDEClient* m_client;
WXHCONV m_hConv;
const void* m_sendingData;
int m_dataSize;
wxDECLARE_NO_COPY_CLASS(wxDDEConnection);
wxDECLARE_DYNAMIC_CLASS(wxDDEConnection);
};
class WXDLLIMPEXP_BASE wxDDEServer : public wxServerBase
{
public:
wxDDEServer();
bool Create(const wxString& server_name) override;
virtual ~wxDDEServer();
virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) override;
// Find/delete wxDDEConnection corresponding to the HCONV
wxDDEConnection *FindConnection(WXHCONV conv);
bool DeleteConnection(WXHCONV conv);
wxString& GetServiceName() { return m_serviceName; }
const wxString& GetServiceName() const { return m_serviceName; }
wxDDEConnectionList& GetConnections() { return m_connections; }
const wxDDEConnectionList& GetConnections() const { return m_connections; }
protected:
int m_lastError;
wxString m_serviceName;
wxDDEConnectionList m_connections;
wxDECLARE_DYNAMIC_CLASS(wxDDEServer);
};
class WXDLLIMPEXP_BASE wxDDEClient: public wxClientBase
{
public:
wxDDEClient();
virtual ~wxDDEClient();
bool ValidHost(const wxString& host) override;
// Call this to make a connection. Returns nullptr if cannot.
virtual wxConnectionBase *MakeConnection(const wxString& host,
const wxString& server,
const wxString& topic) override;
// Tailor this to return own connection.
virtual wxConnectionBase *OnMakeConnection() override;
// Find/delete wxDDEConnection corresponding to the HCONV
wxDDEConnection *FindConnection(WXHCONV conv);
bool DeleteConnection(WXHCONV conv);
wxDDEConnectionList& GetConnections() { return m_connections; }
const wxDDEConnectionList& GetConnections() const { return m_connections; }
protected:
int m_lastError;
wxDDEConnectionList m_connections;
wxDECLARE_DYNAMIC_CLASS(wxDDEClient);
};
void WXDLLIMPEXP_BASE wxDDEInitialize();
void WXDLLIMPEXP_BASE wxDDECleanUp();
#endif // _WX_DDE_H_

View File

@@ -0,0 +1,408 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/debughlp.h
// Purpose: wraps dbghelp.h standard file
// Author: Vadim Zeitlin, Suzumizaki-kimitaka
// Created: 2005-01-08 (extracted from msw/crashrpt.cpp)
// Copyright: (c) 2003-2005 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_DEBUGHLPH_H_
#define _WX_MSW_DEBUGHLPH_H_
#include "wx/defs.h"
#if wxUSE_DBGHELP
#include "wx/dynlib.h"
#include "wx/msw/wrapwin.h"
#ifdef __VISUALC__
// Disable a warning that we can do nothing about: we get it at least for
// imagehlp.h from 8.1 Windows kit when using VC14.
#pragma warning(push)
// 'typedef ': ignored on left of '' when no variable is declared
#pragma warning(disable:4091)
#endif
#include <imagehlp.h>
#ifdef __VISUALC__
#pragma warning(pop)
#endif
#include "wx/msw/private.h"
/*
The table below shows which functions are exported by dbghelp.dll.
On 64 bit Windows, there seems to be no difference between 32bit dll and 64bit
one. Vista-64 and Win8-64 look the same, but "Ex" and "ExW" versions exist only
in Windows 8.
Note that SymGetLineFromAddrW and EnumerateLoadedModulesW DON'T exist at all.
function | Windows | XP-32 Vista-64 Win8-64
SymEnumSymbolsW n/a v v
SymFromAddrW n/a v v
SymInitializeW n/a v v
SymEnumSymbols v v v
SymFromAddr v v v
SymInitialize v v v
SymGetLineFromAddrW64 n/a v v
SymGetLineFromAddr64 v v v
SymGetLineFromAddrW n/a n/a n/a
SymGetLineFromAddr v v v
EnumerateLoadedModulesW64 n/a v v
EnumerateLoadedModules64 v v v
EnumerateLoadedModulesW n/a n/a n/a
EnumerateLoadedModules v v v
*/
// It's not really clear whether API v10 is used by anything as VC8 still used
// v9, just as MSVC7.1, while VC9 already used v11, but provide support for it
// just in case.
#if API_VERSION_NUMBER < 10/*{{{*/
typedef BOOL
(CALLBACK *PENUMLOADED_MODULES_CALLBACKW64)(PWSTR ModuleName,
DWORD64 ModuleBase,
ULONG ModuleSize,
PVOID UserContext);
typedef struct _IMAGEHLP_LINEW64
{
DWORD SizeOfStruct;
PVOID Key;
DWORD LineNumber;
PWSTR FileName;
DWORD64 Address;
} IMAGEHLP_LINEW64, *PIMAGEHLP_LINEW64;
typedef struct _SYMBOL_INFOW
{
ULONG SizeOfStruct;
ULONG TypeIndex;
ULONG64 Reserved[2];
ULONG Index;
ULONG Size;
ULONG64 ModBase;
ULONG Flags;
ULONG64 Value;
ULONG64 Address;
ULONG Register;
ULONG Scope;
ULONG Tag;
ULONG NameLen;
ULONG MaxNameLen;
WCHAR Name[1];
} SYMBOL_INFOW, *PSYMBOL_INFOW;
typedef BOOL
(CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACKW)(PSYMBOL_INFOW pSymInfo,
ULONG SymbolSize,
PVOID UserContext);
typedef BOOL
(CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO pSymInfo,
ULONG SymbolSize,
PVOID UserContext);
#endif // API_VERSION_NUMBER < 10/*}}}*/
// wx-prefixed types map to Unicode ("W") version
#define wxPSYM_ENUMERATESYMBOLS_CALLBACK PSYM_ENUMERATESYMBOLS_CALLBACKW
// This one could be already defined by wx/msw/stackwalk.h
#ifndef wxSYMBOL_INFO
#define wxSYMBOL_INFO SYMBOL_INFOW
#endif // !defined(wxSYMBOL_INFO)
typedef wxSYMBOL_INFO* wxPSYMBOL_INFO;
// This differs from PENUMLOADED_MODULES_CALLBACK[W]64 in that it always uses
// "const" for its first argument when the SDK used to pass a non-const string
// here until API_VERSION_NUMBER==11, so we can't just define it as an existing
// typedef.
typedef BOOL
(CALLBACK *wxPENUMLOADED_MODULES_CALLBACK)(const wxChar* moduleName,
DWORD64 moduleBase,
ULONG moduleSize,
void *userContext);
// ----------------------------------------------------------------------------
// wxDbgHelpDLL: dynamically load dbghelp.dll functions
// ----------------------------------------------------------------------------
// wrapper for some functions from dbghelp.dll
//
// MT note: this class is not MT safe and should be only used from a single
// thread at a time (this is so because dbghelp.dll is not MT-safe
// itself anyhow)
class wxDbgHelpDLL
{
public:
// some useful constants not present in debughlp.h (stolen from DIA SDK)
enum BasicType
{
BASICTYPE_NOTYPE = 0,
BASICTYPE_VOID = 1,
BASICTYPE_CHAR = 2,
BASICTYPE_WCHAR = 3,
BASICTYPE_INT = 6,
BASICTYPE_UINT = 7,
BASICTYPE_FLOAT = 8,
BASICTYPE_BCD = 9,
BASICTYPE_BOOL = 10,
BASICTYPE_LONG = 13,
BASICTYPE_ULONG = 14,
BASICTYPE_CURRENCY = 25,
BASICTYPE_DATE = 26,
BASICTYPE_VARIANT = 27,
BASICTYPE_COMPLEX = 28,
BASICTYPE_BIT = 29,
BASICTYPE_BSTR = 30,
BASICTYPE_HRESULT = 31,
BASICTYPE_MAX
};
enum SymbolTag
{
SYMBOL_TAG_NULL,
SYMBOL_TAG_EXE,
SYMBOL_TAG_COMPILAND,
SYMBOL_TAG_COMPILAND_DETAILS,
SYMBOL_TAG_COMPILAND_ENV,
SYMBOL_TAG_FUNCTION,
SYMBOL_TAG_BLOCK,
SYMBOL_TAG_DATA,
SYMBOL_TAG_ANNOTATION,
SYMBOL_TAG_LABEL,
SYMBOL_TAG_PUBLIC_SYMBOL,
SYMBOL_TAG_UDT,
SYMBOL_TAG_ENUM,
SYMBOL_TAG_FUNCTION_TYPE,
SYMBOL_TAG_POINTER_TYPE,
SYMBOL_TAG_ARRAY_TYPE,
SYMBOL_TAG_BASE_TYPE,
SYMBOL_TAG_TYPEDEF,
SYMBOL_TAG_BASE_CLASS,
SYMBOL_TAG_FRIEND,
SYMBOL_TAG_FUNCTION_ARG_TYPE,
SYMBOL_TAG_FUNC_DEBUG_START,
SYMBOL_TAG_FUNC_DEBUG_END,
SYMBOL_TAG_USING_NAMESPACE,
SYMBOL_TAG_VTABLE_SHAPE,
SYMBOL_TAG_VTABLE,
SYMBOL_TAG_CUSTOM,
SYMBOL_TAG_THUNK,
SYMBOL_TAG_CUSTOM_TYPE,
SYMBOL_TAG_MANAGED_TYPE,
SYMBOL_TAG_DIMENSION,
SYMBOL_TAG_MAX
};
enum DataKind
{
DATA_UNKNOWN,
DATA_LOCAL,
DATA_STATIC_LOCAL,
DATA_PARAM,
DATA_OBJECT_PTR, // "this" pointer
DATA_FILE_STATIC,
DATA_GLOBAL,
DATA_MEMBER,
DATA_STATIC_MEMBER,
DATA_CONSTANT,
DATA_MAX
};
enum UdtKind
{
UDT_STRUCT,
UDT_CLASS,
UDT_UNION,
UDT_MAX
};
// function types
typedef DWORD (WINAPI *SymGetOptions_t)();
typedef DWORD (WINAPI *SymSetOptions_t)(DWORD);
typedef BOOL (WINAPI *SymInitialize_t)(HANDLE, LPCSTR, BOOL);
typedef BOOL (WINAPI *SymInitializeW_t)(HANDLE, LPCWSTR, BOOL);
typedef BOOL (WINAPI *StackWalk_t)(DWORD, HANDLE, HANDLE, LPSTACKFRAME,
LPVOID, PREAD_PROCESS_MEMORY_ROUTINE,
PFUNCTION_TABLE_ACCESS_ROUTINE,
PGET_MODULE_BASE_ROUTINE,
PTRANSLATE_ADDRESS_ROUTINE);
typedef BOOL (WINAPI *SymFromAddr_t)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO);
typedef BOOL (WINAPI *SymFromAddrW_t)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFOW);
typedef LPVOID (WINAPI *SymFunctionTableAccess_t)(HANDLE, DWORD_PTR);
typedef DWORD_PTR (WINAPI *SymGetModuleBase_t)(HANDLE, DWORD_PTR);
typedef BOOL (WINAPI *SymGetLineFromAddr_t)(HANDLE, DWORD,
PDWORD, PIMAGEHLP_LINE);
typedef BOOL (WINAPI *SymGetLineFromAddr64_t)(HANDLE, DWORD64,
PDWORD, PIMAGEHLP_LINE64);
typedef BOOL (WINAPI *SymGetLineFromAddrW64_t)(HANDLE, DWORD64,
PDWORD, PIMAGEHLP_LINEW64);
typedef BOOL (WINAPI *SymSetContext_t)(HANDLE, PIMAGEHLP_STACK_FRAME,
PIMAGEHLP_CONTEXT);
typedef BOOL (WINAPI *SymEnumSymbols_t)(HANDLE, ULONG64, PCSTR,
PSYM_ENUMERATESYMBOLS_CALLBACK,
const PVOID);
typedef BOOL (WINAPI *SymEnumSymbolsW_t)(HANDLE, ULONG64, PCWSTR,
PSYM_ENUMERATESYMBOLS_CALLBACKW,
const PVOID);
typedef BOOL (WINAPI *SymGetTypeInfo_t)(HANDLE, DWORD64, ULONG,
IMAGEHLP_SYMBOL_TYPE_INFO, PVOID);
typedef BOOL (WINAPI *SymCleanup_t)(HANDLE);
typedef BOOL (WINAPI *EnumerateLoadedModules_t)(HANDLE, PENUMLOADED_MODULES_CALLBACK, PVOID);
typedef BOOL (WINAPI *EnumerateLoadedModules64_t)(HANDLE, PENUMLOADED_MODULES_CALLBACK64, PVOID);
typedef BOOL (WINAPI *EnumerateLoadedModulesW64_t)(HANDLE, PENUMLOADED_MODULES_CALLBACKW64, PVOID);
typedef BOOL (WINAPI *MiniDumpWriteDump_t)(HANDLE, DWORD, HANDLE,
MINIDUMP_TYPE,
CONST PMINIDUMP_EXCEPTION_INFORMATION,
CONST PMINIDUMP_USER_STREAM_INFORMATION,
CONST PMINIDUMP_CALLBACK_INFORMATION);
// Higher level functions selecting the right debug help library function
// to call: for CallFoo(), it can be Foo(), Foo64(), FooW() or FooW64()
// depending on the build options and function availability.
//
// They also provide more convenient to use wx-specific API, e.g. work with
// wxString instead of char/wchar_t pointers and omit the arguments we
// don't need.
static BOOL CallSymInitialize(HANDLE, BOOL);
static BOOL CallEnumerateLoadedModules(HANDLE, wxPENUMLOADED_MODULES_CALLBACK, PVOID);
static BOOL CallSymFromAddr(HANDLE, DWORD64,
size_t* offset, wxString* name);
static BOOL CallSymGetLineFromAddr(HANDLE, DWORD64,
wxString* fileName, size_t* line);
static BOOL CallSymEnumSymbols(HANDLE hProcess,
ULONG64 baseOfDll,
wxPSYM_ENUMERATESYMBOLS_CALLBACK callback,
const PVOID callbackParam);
// The macro called by wxDO_FOR_ALL_SYM_FUNCS() below takes 2 arguments:
// the name of the function in the program code, which never has "64"
// suffix, and the name of the function in the DLL which can have "64"
// suffix in some cases. These 2 helper macros call the macro with the
// correct arguments in both cases.
#define wxSYM_CALL(what, name) what(name, name)
#if defined(_M_AMD64) || defined(_M_ARM64)
#define wxSYM_CALL_64(what, name) what(name, name ## 64)
// Also undo all the "helpful" definitions done by imagehlp.h that map 32
// bit functions to 64 bit ones, we don't need this as we do it ourselves.
#undef StackWalk
#undef SymFunctionTableAccess
#undef SymGetModuleBase
#undef SymGetLineFromAddr
#undef EnumerateLoadedModules
#else
#define wxSYM_CALL_64(what, name) what(name, name)
#endif
#define wxSYM_CALL_ALWAYS_W(what, name) what(name ## W, name ## W)
#define wxSYM_CALL_ALTERNATIVES(what, name) \
what(name, name); \
what(name ## 64, name ## 64); \
what(name ## W64, name ## W64)
#define wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PUBLIC(what) \
wxSYM_CALL_64(what, StackWalk); \
wxSYM_CALL_64(what, SymFunctionTableAccess); \
wxSYM_CALL_64(what, SymGetModuleBase); \
\
wxSYM_CALL(what, SymGetOptions); \
wxSYM_CALL(what, SymSetOptions); \
wxSYM_CALL(what, SymSetContext); \
wxSYM_CALL(what, SymGetTypeInfo); \
wxSYM_CALL(what, SymCleanup); \
wxSYM_CALL(what, MiniDumpWriteDump)
#define wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PRIVATE(what) \
wxSYM_CALL(what, SymInitialize); \
wxSYM_CALL(what, SymFromAddr); \
wxSYM_CALL(what, SymEnumSymbols)
#define wxDO_FOR_ALL_SYM_FUNCS_REQUIRED(what) \
wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PRIVATE(what); \
wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PUBLIC(what)
// Alternation will work when the following functions are not found,
// therefore they are not included in REQUIRED version.
#define wxDO_FOR_ALL_SYM_FUNCS_OPTIONAL(what) \
wxSYM_CALL_ALTERNATIVES(what, SymGetLineFromAddr); \
wxSYM_CALL_ALTERNATIVES(what, EnumerateLoadedModules); \
wxSYM_CALL_ALWAYS_W(what, SymInitialize); \
wxSYM_CALL_ALWAYS_W(what, SymFromAddr); \
wxSYM_CALL_ALWAYS_W(what, SymEnumSymbols)
#define wxDO_FOR_ALL_SYM_FUNCS(what) \
wxDO_FOR_ALL_SYM_FUNCS_REQUIRED(what); \
wxDO_FOR_ALL_SYM_FUNCS_OPTIONAL(what)
#define wxDECLARE_SYM_FUNCTION(func, name) static func ## _t func
wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PUBLIC(wxDECLARE_SYM_FUNCTION);
private:
wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PRIVATE(wxDECLARE_SYM_FUNCTION);
wxDO_FOR_ALL_SYM_FUNCS_OPTIONAL(wxDECLARE_SYM_FUNCTION);
public:
#undef wxDECLARE_SYM_FUNCTION
// load all functions from DLL, return true if ok
static bool Init();
// return the string with the error message explaining why Init() failed
static const wxString& GetErrorMessage();
// log error returned by the given function to debug output
static void LogError(const wxChar *func);
// return textual representation of the value of given symbol
static wxString DumpSymbol(wxPSYMBOL_INFO pSymInfo, void *pVariable);
// return the name of the symbol with given type index
static wxString GetSymbolName(wxPSYMBOL_INFO pSymInfo);
private:
// dereference the given symbol, i.e. return symbol which is not a
// pointer/reference any more
//
// if ppData != nullptr, dereference the pointer as many times as we
// dereferenced the symbol
//
// return the tag of the dereferenced symbol
static SymbolTag DereferenceSymbol(wxPSYMBOL_INFO pSymInfo, void **ppData);
static wxString DumpField(wxPSYMBOL_INFO pSymInfo,
void *pVariable,
unsigned level);
static wxString DumpBaseType(BasicType bt, DWORD64 length, void *pVariable);
static wxString DumpUDT(wxPSYMBOL_INFO pSymInfo,
void *pVariable,
unsigned level = 0);
static bool BindDbgHelpFunctions(const wxDynamicLibrary& dllDbgHelp);
static bool DoInit();
};
#endif // wxUSE_DBGHELP
#endif // _WX_MSW_DEBUGHLPH_H_

View File

@@ -0,0 +1,94 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/dialog.h
// Purpose: wxDialog class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DIALOG_H_
#define _WX_DIALOG_H_
#include "wx/panel.h"
extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr[];
class WXDLLIMPEXP_FWD_CORE wxDialogModalData;
// Dialog boxes
class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase
{
public:
wxDialog() { Init(); }
// full ctor
wxDialog(wxWindow *parent, wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
const wxString& name = wxASCII_STR(wxDialogNameStr))
{
Init();
(void)Create(parent, id, title, pos, size, style, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
const wxString& name = wxASCII_STR(wxDialogNameStr));
virtual ~wxDialog();
// return true if we're showing the dialog modally
virtual bool IsModal() const override { return m_modalData != nullptr; }
// show the dialog modally and return the value passed to EndModal()
virtual int ShowModal() override;
// may be called to terminate the dialog with the given return code
virtual void EndModal(int retCode) override;
// implementation only from now on
// -------------------------------
// override some base class virtuals
virtual bool Show(bool show = true) override;
virtual void SetWindowStyleFlag(long style) override;
// Windows callbacks
WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) override;
protected:
// common part of all ctors
void Init();
private:
// these functions deal with the gripper window shown in the corner of
// resizable dialogs
void CreateGripper();
void DestroyGripper();
void ShowGripper(bool show);
void ResizeGripper();
// this function is used to adjust Z-order of new children relative to the
// gripper if we have one
void OnWindowCreate(wxWindowCreateEvent& event);
// gripper window for a resizable dialog, nullptr if we're not resizable
WXHWND m_hGripper;
// this pointer is non-null only while the modal event loop is running
wxDialogModalData *m_modalData;
wxDECLARE_DYNAMIC_CLASS(wxDialog);
wxDECLARE_NO_COPY_CLASS(wxDialog);
};
#endif
// _WX_DIALOG_H_

View File

@@ -0,0 +1,243 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/dib.h
// Purpose: wxDIB class representing Win32 device independent bitmaps
// Author: Vadim Zeitlin
// Created: 03.03.03 (replaces the old file with the same name)
// Copyright: (c) 1997-2003 wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_DIB_H_
#define _WX_MSW_DIB_H_
class WXDLLIMPEXP_FWD_CORE wxPalette;
#include "wx/msw/private.h"
#if wxUSE_WXDIB
#ifdef __WXMSW__
#include "wx/bitmap.h"
#endif // __WXMSW__
// ----------------------------------------------------------------------------
// wxDIB: represents a DIB section
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDIB
{
public:
// ctors and such
// --------------
// create an uninitialized DIB with the given width, height and depth (only
// 24 and 32 bpp DIBs are currently supported)
//
// after using this ctor, GetData() and GetHandle() may be used if IsOk()
// returns true
wxDIB(int width, int height, int depth)
{ (void)Create(width, height, depth); }
#ifdef __WXMSW__
// create a DIB from the DDB
wxDIB(const wxBitmap& bmp, int depth = -1)
{ (void)Create(bmp, depth); }
#endif // __WXMSW__
// create a DIB from the Windows DDB
wxDIB(HBITMAP hbmp)
{ (void)Create(hbmp); }
// load a DIB from file (any depth is supported here unlike above)
//
// as above, use IsOk() to see if the bitmap was loaded successfully
wxDIB(const wxString& filename)
{ (void)Load(filename); }
// same as the corresponding ctors but with return value
bool Create(int width, int height, int depth);
#ifdef __WXMSW__
bool Create(const wxBitmap& bmp, int depth = -1) { return Create(GetHbitmapOf(bmp), depth); }
#endif
bool Create(HBITMAP hbmp, int depth = -1);
bool Load(const wxString& filename);
// dtor is not virtual, this class is not meant to be used polymorphically
~wxDIB()
{
if ( m_handle && m_ownsHandle )
{
if ( !::DeleteObject(m_handle) )
{
wxLogLastError(wxT("DeleteObject(hDIB)"));
}
}
}
// operations
// ----------
// create a bitmap compatible with the given HDC (or screen by default) and
// return its handle, the caller is responsible for freeing it (using
// DeleteObject())
HBITMAP CreateDDB(HDC hdc = nullptr) const;
// get the handle from the DIB and reset it, i.e. this object won't destroy
// the DIB after this (but the caller should do it)
HBITMAP Detach() { HBITMAP hbmp = m_handle; m_handle = nullptr; return hbmp; }
#if defined(__WXMSW__) && wxUSE_PALETTE
// create a palette for this DIB (always a trivial/default one for 24bpp)
wxPalette *CreatePalette() const;
#endif // defined(__WXMSW__) && wxUSE_PALETTE
// save the DIB as a .BMP file to the file with the given name
bool Save(const wxString& filename);
// accessors
// ---------
// return true if DIB was successfully created, false otherwise
bool IsOk() const { return m_handle != nullptr; }
// get the bitmap size
wxSize GetSize() const { DoGetObject(); return wxSize(m_width, m_height); }
int GetWidth() const { DoGetObject(); return m_width; }
int GetHeight() const { DoGetObject(); return m_height; }
// get the number of bits per pixel, or depth
int GetDepth() const { DoGetObject(); return m_depth; }
// get the DIB handle
HBITMAP GetHandle() const { return m_handle; }
// get raw pointer to bitmap bits, you should know what you do if you
// decide to use it
unsigned char *GetData() const
{ DoGetObject(); return (unsigned char *)m_data; }
// HBITMAP conversion
// ------------------
// these functions are only used by wxWidgets internally right now, please
// don't use them directly if possible as they're subject to change
// creates a DDB compatible with the given (or screen) DC from either
// a plain DIB or a DIB section (in which case the last parameter must be
// non null)
static HBITMAP ConvertToBitmap(const BITMAPINFO *pbi,
HDC hdc = nullptr,
const void *bits = nullptr);
// create a plain DIB (not a DIB section) from a DDB, the caller is
// responsible for freeing it using ::GlobalFree()
static HGLOBAL ConvertFromBitmap(HBITMAP hbmp);
// creates a DIB from the given DDB or calculates the space needed by it:
// if pbi is null, only the space is calculated, otherwise pbi is supposed
// to point at BITMAPINFO of the correct size which is filled by this
// function (this overload is needed for wxBitmapDataObject code in
// src/msw/ole/dataobj.cpp)
static size_t ConvertFromBitmap(BITMAPINFO *pbi, HBITMAP hbmp);
// wxImage conversion
// ------------------
#if wxUSE_IMAGE
// Possible formats for DIBs created by the functions below.
enum PixelFormat
{
PixelFormat_PreMultiplied = 0,
PixelFormat_NotPreMultiplied = 1
};
// Create a DIB from the given image, the DIB will be either 24 or 32 (if
// the image has alpha channel) bpp.
//
// By default the DIB stores pixel data in pre-multiplied format so that it
// can be used with ::AlphaBlend() but it is also possible to disable
// pre-multiplication for the DIB to be usable with ImageList_Draw() which
// does pre-multiplication internally.
wxDIB(const wxImage& image, PixelFormat pf = PixelFormat_PreMultiplied, int depth = -1)
{
(void)Create(image, pf, depth);
}
// same as the above ctor but with the return code
bool Create(const wxImage& image, PixelFormat pf = PixelFormat_PreMultiplied, int depth = -1);
// create wxImage having the same data as this DIB
// Possible options of conversion to wxImage
enum ConversionFlags
{
// Determine whether 32bpp DIB contains real alpha channel
// and return wxImage with or without alpha channel values.
Convert_AlphaAuto,
// Assume that 32bpp DIB contains valid alpha channel and always
// return wxImage with alpha channel values in this case.
Convert_AlphaAlwaysIf32bpp
};
wxImage ConvertToImage(ConversionFlags flags = Convert_AlphaAuto) const;
#endif // wxUSE_IMAGE
// helper functions
// ----------------
// return the size of one line in a DIB with given width and depth: the
// point here is that as the scan lines need to be DWORD aligned so we may
// need to add some padding
static unsigned long GetLineSize(int width, int depth)
{
return ((width*depth + 31) & ~31) >> 3;
}
private:
// initialize the contents from the provided DDB (Create() must have been
// already called)
bool CopyFromDDB(HBITMAP hbmp);
// the DIB section handle, 0 if invalid
HBITMAP m_handle = nullptr;
// NB: we could store only m_handle and not any of the other fields as
// we may always retrieve them from it using ::GetObject(), but we
// decide to still store them for efficiency concerns -- however if we
// don't have them from the very beginning (e.g. DIB constructed from a
// bitmap), we only retrieve them when necessary and so these fields
// should *never* be accessed directly, even from inside wxDIB code
// function which must be called before accessing any members and which
// gets their values from m_handle, if not done yet
void DoGetObject() const;
// pointer to DIB bits, may be null
void *m_data = nullptr;
// size and depth of the image
int m_width = 0,
m_height = 0,
m_depth = 0;
// in some cases we could be using a handle which we didn't create and in
// this case we shouldn't free it either -- this flag tell us if this is
// the case
bool m_ownsHandle = true;
// DIBs can't be copied
wxDIB(const wxDIB&) = delete;
wxDIB& operator=(const wxDIB&) = delete;
};
#endif
// wxUSE_WXDIB
#endif // _WX_MSW_DIB_H_

View File

@@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/dirdlg.h
// Purpose: wxDirDialog class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DIRDLG_H_
#define _WX_DIRDLG_H_
class WXDLLIMPEXP_CORE wxDirDialog : public wxDirDialogBase
{
public:
wxDirDialog(wxWindow *parent,
const wxString& message = wxASCII_STR(wxDirSelectorPromptStr),
const wxString& defaultPath = wxEmptyString,
long style = wxDD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& name = wxASCII_STR(wxDirDialogNameStr));
void SetPath(const wxString& path) override;
virtual int ShowModal() override;
private:
// The real implementations of ShowModal(), one using the traditional shell
// function and another one using IFileOpenDialog.
int ShowSHBrowseForFolder(WXHWND owner);
int ShowIFileOpenDialog(WXHWND owner);
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDirDialog);
};
#endif
// _WX_DIRDLG_H_

View File

@@ -0,0 +1,233 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/dragimag.h
// Purpose: wxDragImage class: a kind of a cursor, that can cope
// with more sophisticated images
// Author: Julian Smart
// Created: 08/04/99
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DRAGIMAG_H_
#define _WX_DRAGIMAG_H_
#if wxUSE_DRAGIMAGE
#include "wx/bitmap.h"
#include "wx/icon.h"
#include "wx/cursor.h"
#include "wx/treectrl.h"
#include "wx/listctrl.h"
// If 1, use a simple wxCursor instead of ImageList_SetDragCursorImage
#define wxUSE_SIMPLER_DRAGIMAGE 0
/*
To use this class, create a wxDragImage when you start dragging, for example:
void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event)
{
#ifdef __WXMSW__
::UpdateWindow((HWND) GetHWND()); // We need to implement this in wxWidgets
#endif
CaptureMouse();
m_dragImage = new wxDragImage(* this, itemId);
m_dragImage->BeginDrag(wxPoint(0, 0), this);
m_dragImage->Move(pt, this);
m_dragImage->Show(this);
...
}
In your OnMouseMove function, hide the image, do any display updating required,
then move and show the image again:
void MyTreeCtrl::OnMouseMove(wxMouseEvent& event)
{
if (m_dragMode == MY_TREE_DRAG_NONE)
{
event.Skip();
return;
}
// Prevent screen corruption by hiding the image
if (m_dragImage)
m_dragImage->Hide(this);
// Do some updating of the window, such as highlighting the drop target
...
#ifdef __WXMSW__
if (updateWindow)
::UpdateWindow((HWND) GetHWND());
#endif
// Move and show the image again
m_dragImage->Move(event.GetPosition(), this);
m_dragImage->Show(this);
}
Eventually we end the drag and delete the drag image.
void MyTreeCtrl::OnLeftUp(wxMouseEvent& event)
{
...
// End the drag and delete the drag image
if (m_dragImage)
{
m_dragImage->EndDrag(this);
delete m_dragImage;
m_dragImage = nullptr;
}
ReleaseMouse();
}
*/
/*
Notes for Unix version:
Can we simply use cursors instead, creating a cursor dynamically, setting it into the window
in BeginDrag, and restoring the old cursor in EndDrag?
For a really bog-standard implementation, we could simply use a normal dragging cursor
and ignore the image.
*/
/*
* wxDragImage
*/
class WXDLLIMPEXP_CORE wxDragImage: public wxObject
{
public:
// Ctors & dtor
////////////////////////////////////////////////////////////////////////////
wxDragImage();
wxDragImage(const wxBitmap& image, const wxCursor& cursor = wxNullCursor)
{
Init();
Create(image, cursor);
}
wxDragImage(const wxIcon& image, const wxCursor& cursor = wxNullCursor)
{
Init();
Create(image, cursor);
}
wxDragImage(const wxString& str, const wxCursor& cursor = wxNullCursor)
{
Init();
Create(str, cursor);
}
#if wxUSE_TREECTRL
wxDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id)
{
Init();
Create(treeCtrl, id);
}
#endif
#if wxUSE_LISTCTRL
wxDragImage(const wxListCtrl& listCtrl, long id)
{
Init();
Create(listCtrl, id);
}
#endif
virtual ~wxDragImage();
// Attributes
////////////////////////////////////////////////////////////////////////////
// Operations
////////////////////////////////////////////////////////////////////////////
// Create a drag image from a bitmap and optional cursor
bool Create(const wxBitmap& image, const wxCursor& cursor = wxNullCursor);
// Create a drag image from an icon and optional cursor
bool Create(const wxIcon& image, const wxCursor& cursor = wxNullCursor);
// Create a drag image from a string and optional cursor
bool Create(const wxString& str, const wxCursor& cursor = wxNullCursor);
#if wxUSE_TREECTRL
// Create a drag image for the given tree control item
bool Create(const wxTreeCtrl& treeCtrl, wxTreeItemId& id);
#endif
#if wxUSE_LISTCTRL
// Create a drag image for the given list control item
bool Create(const wxListCtrl& listCtrl, long id);
#endif
// Begin drag. hotspot is the location of the drag position relative to the upper-left
// corner of the image.
bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = nullptr);
// Begin drag. hotspot is the location of the drag position relative to the upper-left
// corner of the image. This is full screen only. fullScreenRect gives the
// position of the window on the screen, to restrict the drag to.
bool BeginDrag(const wxPoint& hotspot, wxWindow* window, wxWindow* fullScreenRect);
// End drag
bool EndDrag();
// Move the image: call from OnMouseMove. Pt is in window client coordinates if window
// is non-null, or in screen coordinates if null.
bool Move(const wxPoint& pt);
// Show the image
bool Show();
// Hide the image
bool Hide();
// Implementation
////////////////////////////////////////////////////////////////////////////
// Initialize variables
void Init();
// Returns the native image list handle
WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; }
#if !wxUSE_SIMPLER_DRAGIMAGE
// Returns the native image list handle for the cursor
WXHIMAGELIST GetCursorHIMAGELIST() const { return m_hCursorImageList; }
#endif
protected:
WXHIMAGELIST m_hImageList;
#if wxUSE_SIMPLER_DRAGIMAGE
wxCursor m_oldCursor;
#else
WXHIMAGELIST m_hCursorImageList;
#endif
wxCursor m_cursor;
// wxPoint m_cursorHotspot; // Obsolete
wxPoint m_position;
wxWindow* m_window;
wxRect m_boundingRect;
bool m_fullScreen;
private:
wxDECLARE_DYNAMIC_CLASS(wxDragImage);
wxDECLARE_NO_COPY_CLASS(wxDragImage);
};
#endif // wxUSE_DRAGIMAGE
#endif
// _WX_DRAGIMAG_H_

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,200 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/enhmeta.h
// Purpose: wxEnhMetaFile class for Win32
// Author: Vadim Zeitlin
// Created: 13.01.00
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_ENHMETA_H_
#define _WX_MSW_ENHMETA_H_
#include "wx/defs.h"
#if wxUSE_ENH_METAFILE
#include "wx/dc.h"
#include "wx/gdiobj.h"
#if wxUSE_DATAOBJ
#include "wx/dataobj.h"
#endif
// ----------------------------------------------------------------------------
// wxEnhMetaFile: encapsulation of Win32 HENHMETAFILE
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxEnhMetaFile : public wxGDIObject
{
public:
wxEnhMetaFile(const wxString& file = wxEmptyString) : m_filename(file)
{ Init(); }
wxEnhMetaFile(const wxEnhMetaFile& metafile) : wxGDIObject()
{ Init(); Assign(metafile); }
wxEnhMetaFile& operator=(const wxEnhMetaFile& metafile)
{ Free(); Assign(metafile); return *this; }
virtual ~wxEnhMetaFile()
{ Free(); }
// display the picture stored in the metafile on the given DC
bool Play(wxDC *dc, wxRect *rectBound = nullptr);
// accessors
virtual bool IsOk() const override { return m_hMF != nullptr; }
wxSize GetSize() const;
int GetWidth() const { return GetSize().x; }
int GetHeight() const { return GetSize().y; }
const wxString& GetFileName() const { return m_filename; }
// copy the metafile to the clipboard: the width and height parameters are
// for backwards compatibility (with wxMetaFile) only, they are ignored by
// this method
bool SetClipboard(int width = 0, int height = 0);
// Detach the HENHMETAFILE from this object, i.e. don't delete the handle
// in the dtor -- the caller is now responsible for doing this, e.g. using
// Free() method below.
WXHANDLE Detach() { WXHANDLE h = m_hMF; m_hMF = nullptr; return h; }
// Destroy the given HENHMETAFILE object.
static void Free(WXHANDLE handle);
// implementation
WXHANDLE GetHENHMETAFILE() const { return m_hMF; }
void SetHENHMETAFILE(WXHANDLE hMF) { Free(); m_hMF = hMF; }
protected:
void Init();
void Free() { Free(m_hMF); }
void Assign(const wxEnhMetaFile& mf);
// we don't use these functions (but probably should) but have to implement
// them as they're pure virtual in the base class
virtual wxGDIRefData *CreateGDIRefData() const override;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const override;
private:
wxString m_filename;
WXHANDLE m_hMF;
wxDECLARE_DYNAMIC_CLASS(wxEnhMetaFile);
};
// ----------------------------------------------------------------------------
// wxEnhMetaFileDC: allows to create a wxEnhMetaFile
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxEnhMetaFileDC : public wxDC
{
public:
// the ctor parameters specify the filename (empty for memory metafiles),
// the metafile picture size and the optional description/comment
wxEnhMetaFileDC(const wxString& filename = wxEmptyString,
int width = 0, int height = 0,
const wxString& description = wxEmptyString);
// as above, but takes reference DC as first argument to take resolution,
// size, font metrics etc. from
explicit
wxEnhMetaFileDC(const wxDC& referenceDC,
const wxString& filename = wxEmptyString,
int width = 0, int height = 0,
const wxString& description = wxEmptyString);
// obtain a pointer to the new metafile (caller should delete it)
wxEnhMetaFile *Close();
private:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxEnhMetaFileDC);
};
#if wxUSE_DATAOBJ
// ----------------------------------------------------------------------------
// wxEnhMetaFileDataObject is a specialization of wxDataObject for enh metafile
// ----------------------------------------------------------------------------
// notice that we want to support both CF_METAFILEPICT and CF_ENHMETAFILE and
// so we derive from wxDataObject and not from wxDataObjectSimple
class WXDLLIMPEXP_CORE wxEnhMetaFileDataObject : public wxDataObject
{
public:
// ctors
wxEnhMetaFileDataObject() = default;
wxEnhMetaFileDataObject(const wxEnhMetaFile& metafile)
: m_metafile(metafile) { }
// virtual functions which you may override if you want to provide data on
// demand only - otherwise, the trivial default versions will be used
virtual void SetMetafile(const wxEnhMetaFile& metafile)
{ m_metafile = metafile; }
virtual wxEnhMetaFile GetMetafile() const
{ return m_metafile; }
// implement base class pure virtuals
virtual wxDataFormat GetPreferredFormat(Direction dir) const override;
virtual size_t GetFormatCount(Direction dir) const override;
virtual void GetAllFormats(wxDataFormat *formats, Direction dir) const override;
virtual size_t GetDataSize(const wxDataFormat& format) const override;
virtual bool GetDataHere(const wxDataFormat& format, void *buf) const override;
virtual bool SetData(const wxDataFormat& format, size_t len,
const void *buf) override;
protected:
wxEnhMetaFile m_metafile;
wxDECLARE_NO_COPY_CLASS(wxEnhMetaFileDataObject);
};
// ----------------------------------------------------------------------------
// wxEnhMetaFileSimpleDataObject does derive from wxDataObjectSimple which
// makes it more convenient to use (it can be used with wxDataObjectComposite)
// at the price of not supporting any more CF_METAFILEPICT but only
// CF_ENHMETAFILE
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxEnhMetaFileSimpleDataObject : public wxDataObjectSimple
{
public:
// ctors
wxEnhMetaFileSimpleDataObject() : wxDataObjectSimple(wxDF_ENHMETAFILE) { }
wxEnhMetaFileSimpleDataObject(const wxEnhMetaFile& metafile)
: wxDataObjectSimple(wxDF_ENHMETAFILE), m_metafile(metafile) { }
// virtual functions which you may override if you want to provide data on
// demand only - otherwise, the trivial default versions will be used
virtual void SetEnhMetafile(const wxEnhMetaFile& metafile)
{ m_metafile = metafile; }
virtual wxEnhMetaFile GetEnhMetafile() const
{ return m_metafile; }
// implement base class pure virtuals
virtual size_t GetDataSize() const override;
virtual bool GetDataHere(void *buf) const override;
virtual bool SetData(size_t len, const void *buf) override;
virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const override
{ return GetDataSize(); }
virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format),
void *buf) const override
{ return GetDataHere(buf); }
virtual bool SetData(const wxDataFormat& WXUNUSED(format),
size_t len, const void *buf) override
{ return SetData(len, buf); }
protected:
wxEnhMetaFile m_metafile;
wxDECLARE_NO_COPY_CLASS(wxEnhMetaFileSimpleDataObject);
};
#endif // wxUSE_DATAOBJ
#endif // wxUSE_ENH_METAFILE
#endif // _WX_MSW_ENHMETA_H_

View File

@@ -0,0 +1,65 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/evtloop.h
// Purpose: wxEventLoop class for wxMSW port
// Author: Vadim Zeitlin
// Created: 2004-07-31
// Copyright: (c) 2003-2004 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_EVTLOOP_H_
#define _WX_MSW_EVTLOOP_H_
#include "wx/window.h"
#include "wx/msw/evtloopconsole.h" // for wxMSWEventLoopBase
// ----------------------------------------------------------------------------
// wxEventLoop
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxMSWEventLoopBase
{
public:
wxGUIEventLoop() = default;
// process a single message: calls PreProcessMessage() before dispatching
// it
virtual void ProcessMessage(WXMSG *msg);
// preprocess a message, return true if processed (i.e. no further
// dispatching required)
virtual bool PreProcessMessage(WXMSG *msg);
// set the critical window: this is the window such that all the events
// except those to this window (and its children) stop to be processed
// (typical examples: assert or crash report dialog)
//
// calling this function with null argument restores the normal event
// handling
static void SetCriticalWindow(wxWindowMSW *win) { ms_winCritical = win; }
// return true if there is no critical window or if this window is [a child
// of] the critical one
static bool AllowProcessing(wxWindowMSW *win)
{
return !ms_winCritical || IsChildOfCriticalWindow(win);
}
// override/implement base class virtuals
virtual bool Dispatch() override;
virtual int DispatchTimeout(unsigned long timeout) override;
protected:
virtual void OnNextIteration() override;
virtual void DoYieldFor(long eventsToProcess) override;
private:
// check if the given window is a child of ms_winCritical (which must be
// non null)
static bool IsChildOfCriticalWindow(wxWindowMSW *win);
// critical window or nullptr
static wxWindowMSW *ms_winCritical;
};
#endif // _WX_MSW_EVTLOOP_H_

View File

@@ -0,0 +1,71 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/evtloopconsole.h
// Purpose: wxConsoleEventLoop class for Windows
// Author: Vadim Zeitlin
// Created: 2004-07-31
// Copyright: (c) 2003-2004 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_EVTLOOPCONSOLE_H_
#define _WX_MSW_EVTLOOPCONSOLE_H_
class WXDLLIMPEXP_BASE wxMSWEventLoopBase : public wxEventLoopManual
{
public:
wxMSWEventLoopBase();
virtual ~wxMSWEventLoopBase();
// implement base class pure virtuals
virtual bool Pending() const override;
virtual void WakeUp() override;
#if wxUSE_THREADS
// MSW-specific method to wait for the termination of the specified (by its
// native handle) thread or any input message arriving (in GUI case).
//
// Return value is WAIT_OBJECT_0 if the thread terminated, WAIT_OBJECT_0+1
// if a message arrived with anything else indicating an error.
WXDWORD MSWWaitForThread(WXHANDLE hThread);
#endif // wxUSE_THREADS
// Return true if wake up was requested and not handled yet, i.e. if
// m_heventWake is signaled.
bool MSWIsWakeUpRequested();
protected:
// get the next message from queue and return true or return false if we
// got WM_QUIT or an error occurred
bool GetNextMessage(WXMSG *msg);
// same as above but with a timeout and return value can be -1 meaning that
// time out expired in addition to true/false
int GetNextMessageTimeout(WXMSG *msg, unsigned long timeout);
private:
// An auto-reset Win32 event which is signalled when we need to wake up the
// main thread waiting in GetNextMessage[Timeout]().
WXHANDLE m_heventWake;
};
#if wxUSE_CONSOLE_EVENTLOOP
class WXDLLIMPEXP_BASE wxConsoleEventLoop : public wxMSWEventLoopBase
{
public:
wxConsoleEventLoop() = default;
// override/implement base class virtuals
virtual bool Dispatch() override;
virtual int DispatchTimeout(unsigned long timeout) override;
// Windows-specific function to process a single message
virtual void ProcessMessage(WXMSG *msg);
protected:
virtual void DoYieldFor(long eventsToProcess) override;
};
#endif // wxUSE_CONSOLE_EVENTLOOP
#endif // _WX_MSW_EVTLOOPCONSOLE_H_

View File

@@ -0,0 +1,63 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/fdrepdlg.h
// Purpose: wxFindReplaceDialog class
// Author: Markus Greither
// Modified by: 31.07.01: VZ: integrated into wxWidgets
// Created: 23/03/2001
// Copyright: (c) Markus Greither
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_FDREPDLG_H_
#define _WX_MSW_FDREPDLG_H_
// ----------------------------------------------------------------------------
// wxFindReplaceDialog: dialog for searching / replacing text
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFindReplaceDialog : public wxFindReplaceDialogBase
{
public:
// ctors and such
wxFindReplaceDialog() { Init(); }
wxFindReplaceDialog(wxWindow *parent,
wxFindReplaceData *data,
const wxString &title,
int style = 0);
bool Create(wxWindow *parent,
wxFindReplaceData *data,
const wxString &title,
int style = 0);
virtual ~wxFindReplaceDialog();
// implementation only from now on
wxFindReplaceDialogImpl *GetImpl() const { return m_impl; }
// override some base class virtuals
virtual bool Show(bool show = true) override;
virtual void SetTitle( const wxString& title) override;
virtual wxString GetTitle() const override;
virtual bool MSWProcessMessage(WXMSG* pMsg) override;
protected:
virtual void DoGetSize(int *width, int *height) const override;
virtual void DoGetClientSize(int *width, int *height) const override;
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO) override;
void Init();
wxString m_title;
wxFindReplaceDialogImpl *m_impl;
wxDECLARE_DYNAMIC_CLASS(wxFindReplaceDialog);
wxDECLARE_NO_COPY_CLASS(wxFindReplaceDialog);
};
#endif // _WX_MSW_FDREPDLG_H_

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,98 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/filedlg.h
// Purpose: wxFileDialog class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FILEDLG_H_
#define _WX_FILEDLG_H_
class wxFileDialogMSWData;
//-------------------------------------------------------------------------
// wxFileDialog
//-------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFileDialog: public wxFileDialogBase
{
public:
wxFileDialog() = default;
wxFileDialog(wxWindow *parent,
const wxString& message = wxASCII_STR(wxFileSelectorPromptStr),
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr),
long style = wxFD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize,
const wxString& name = wxASCII_STR(wxFileDialogNameStr));
virtual ~wxFileDialog();
virtual void GetPaths(wxArrayString& paths) const override;
virtual void GetFilenames(wxArrayString& files) const override;
virtual bool AddShortcut(const wxString& directory, int flags = 0) override;
virtual bool SupportsExtraControl() const override { return true; }
virtual int ShowModal() override;
protected:
virtual void DoMoveWindow(int x, int y, int width, int height) override;
virtual void DoCentre(int dir) override;
virtual void DoGetSize( int *width, int *height ) const override;
virtual void DoGetPosition( int *x, int *y ) const override;
private:
// Allow it to call MSWOnXXX() functions below.
friend class wxFileDialogMSWData;
// called when the dialog is created
void MSWOnInitDialogHook(WXHWND hwnd);
// called when the dialog initialization is fully done
void MSWOnInitDone(WXHWND hDlg);
// called when the currently selected file changes in the dialog
void MSWOnSelChange(const wxString& selectedFilename);
// called when the currently selected type of files changes in the dialog
void MSWOnTypeChange(int nFilterIndex);
// called when the dialog is accepted, i.e. a file is chosen in it
void MSWOnFileOK();
// The real implementation of ShowModal() using traditional common dialog
// functions.
int ShowCommFileDialog(WXHWND owner);
// And another one using IFileDialog.
int ShowIFileDialog(WXHWND owner);
// Get the data object, allocating it if necessary.
wxFileDialogMSWData& MSWData();
wxArrayString m_fileNames;
// Extra data, possibly null if not needed, use MSWData() to access it if
// it should be created on demand.
wxFileDialogMSWData* m_data = nullptr;
// This class is also used as part of wxQt, provide the functions normally
// defined in the base wxWindow in wxMSW port in this case.
#if defined(__WXQT__)
WXHWND GetHWND() const { return m_hWnd; }
void SetHWND(WXHWND hwnd) { m_hWnd = hwnd; }
WXHWND m_hWnd = nullptr;
#endif // __WXQT__
wxDECLARE_DYNAMIC_CLASS(wxFileDialog);
wxDECLARE_NO_COPY_CLASS(wxFileDialog);
};
#endif // _WX_FILEDLG_H_

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,177 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/font.h
// Purpose: wxFont class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FONT_H_
#define _WX_FONT_H_
#include "wx/gdicmn.h"
// ----------------------------------------------------------------------------
// wxFont
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFont : public wxFontBase
{
public:
// ctors and such
wxFont() = default;
wxFont(const wxFontInfo& info);
wxFont(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
Create(size, family, style, weight, underlined, face, encoding);
}
bool Create(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
return DoCreate(InfoFromLegacyParams(size,
family,
style,
weight,
underlined,
face,
encoding));
}
wxFont(const wxSize& pixelSize,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
(void)Create(pixelSize, family, style, weight,
underlined, face, encoding);
}
wxFont(const wxNativeFontInfo& info, WXHFONT hFont = nullptr)
{
Create(info, hFont);
}
wxFont(const wxString& fontDesc);
bool Create(const wxSize& pixelSize,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
return DoCreate(InfoFromLegacyParams(pixelSize,
family,
style,
weight,
underlined,
face,
encoding));
}
bool Create(const wxNativeFontInfo& info, WXHFONT hFont = nullptr);
// implement base class pure virtuals
virtual double GetFractionalPointSize() const override;
virtual wxSize GetPixelSize() const override;
virtual bool IsUsingSizeInPixels() const override;
virtual wxFontStyle GetStyle() const override;
virtual int GetNumericWeight() const override;
virtual bool GetUnderlined() const override;
virtual bool GetStrikethrough() const override;
virtual wxString GetFaceName() const override;
virtual wxFontEncoding GetEncoding() const override;
virtual const wxNativeFontInfo *GetNativeFontInfo() const override;
virtual void SetFractionalPointSize(double pointSize) override;
virtual void SetPixelSize(const wxSize& pixelSize) override;
virtual void SetFamily(wxFontFamily family) override;
virtual void SetStyle(wxFontStyle style) override;
virtual void SetNumericWeight(int weight) override;
virtual bool SetFaceName(const wxString& faceName) override;
virtual void SetUnderlined(bool underlined) override;
virtual void SetStrikethrough(bool strikethrough) override;
virtual void SetEncoding(wxFontEncoding encoding) override;
wxDECLARE_COMMON_FONT_METHODS();
virtual bool IsFixedWidth() const override;
// MSW needs to modify the font object when the DPI of the window it
// is used with changes, this function can be used to do it.
//
// This method is not considered to be part of wxWidgets public API.
void WXAdjustToPPI(const wxSize& ppi);
wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants ie: wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD")
wxFont(int size,
int family,
int style,
int weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
(void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
}
wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants ie: wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD")
wxFont(const wxSize& pixelSize,
int family,
int style,
int weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
(void)Create(pixelSize, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight,
underlined, face, encoding);
}
// implementation only from now on
// -------------------------------
virtual bool IsFree() const override;
virtual bool RealizeResource() override;
virtual WXHANDLE GetResourceHandle() const override;
virtual bool FreeResource(bool force = false) override;
// for consistency with other wxMSW classes
WXHFONT GetHFONT() const;
protected:
// Common helper of overloaded Create() methods.
bool DoCreate(const wxFontInfo& info);
virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info) override;
virtual wxFontFamily DoGetFamily() const override;
// implement wxObject virtuals which are used by AllocExclusive()
virtual wxGDIRefData *CreateGDIRefData() const override;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const override;
private:
wxDECLARE_DYNAMIC_CLASS(wxFont);
};
#endif // _WX_FONT_H_

View File

@@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/fontdlg.h
// Purpose: wxFontDialog class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_FONTDLG_H_
#define _WX_MSW_FONTDLG_H_
// ----------------------------------------------------------------------------
// wxFontDialog
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFontDialog : public wxFontDialogBase
{
public:
wxFontDialog() : wxFontDialogBase() { /* must be Create()d later */ }
wxFontDialog(wxWindow *parent)
: wxFontDialogBase(parent) { Create(parent); }
wxFontDialog(wxWindow *parent, const wxFontData& data)
: wxFontDialogBase(parent, data) { Create(parent, data); }
virtual int ShowModal() override;
virtual void SetTitle(const wxString& title) override;
virtual wxString GetTitle() const override;
protected:
wxString m_title;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog);
};
#endif
// _WX_MSW_FONTDLG_H_

View File

@@ -0,0 +1,192 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/frame.h
// Purpose: wxFrame class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FRAME_H_
#define _WX_FRAME_H_
#if wxUSE_TASKBARBUTTON
class WXDLLIMPEXP_FWD_CORE wxTaskBarButton;
#endif
class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase
{
public:
// construction
wxFrame() { Init(); }
wxFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
Init();
Create(parent, id, title, pos, size, style, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxASCII_STR(wxFrameNameStr));
virtual ~wxFrame();
// implement base class pure virtuals
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) override;
// implementation only from now on
// -------------------------------
// event handlers
void OnSysColourChanged(wxSysColourChangedEvent& event);
// Toolbar
#if wxUSE_TOOLBAR
virtual wxToolBar* CreateToolBar(long style = -1,
wxWindowID id = wxID_ANY,
const wxString& name = wxASCII_STR(wxToolBarNameStr)) override;
#endif // wxUSE_TOOLBAR
// Status bar
#if wxUSE_STATUSBAR
virtual wxStatusBar* OnCreateStatusBar(int number = 1,
long style = wxSTB_DEFAULT_STYLE,
wxWindowID id = 0,
const wxString& name = wxASCII_STR(wxStatusLineNameStr)) override;
// Hint to tell framework which status bar to use: the default is to use
// native one for the platforms which support it (Win32), the generic one
// otherwise
// TODO: should this go into a wxFrameworkSettings class perhaps?
static void UseNativeStatusBar(bool useNative)
{ m_useNativeStatusBar = useNative; }
static bool UsesNativeStatusBar()
{ return m_useNativeStatusBar; }
#endif // wxUSE_STATUSBAR
// event handlers
bool HandleSize(int x, int y, WXUINT flag);
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
// tooltip management
#if wxUSE_TOOLTIPS
WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
#endif // tooltips
// override the base class function to handle iconized/maximized frames
virtual void SendSizeEvent(int flags = 0) override;
virtual wxPoint GetClientAreaOrigin() const override;
// override base class version to add menu bar accel processing
virtual bool MSWTranslateMessage(WXMSG *msg) override
{
return MSWDoTranslateMessage(this, msg);
}
// window proc for the frames
virtual WXLRESULT MSWWindowProc(WXUINT message,
WXWPARAM wParam,
WXLPARAM lParam) override;
#if wxUSE_MENUS
// get the currently active menu: this is the same as the frame menu for
// normal frames but is overridden by wxMDIParentFrame
virtual WXHMENU MSWGetActiveMenu() const { return m_hMenu; }
virtual bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu) override;
virtual bool DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu) override;
// Look up the menu in the menu bar.
virtual wxMenu* MSWFindMenuFromHMENU(WXHMENU hMenu) override;
#endif // wxUSE_MENUS
#if wxUSE_TASKBARBUTTON
// Return the taskbar button of the window.
//
// The pointer returned by this method belongs to the window and will be
// deleted when the window itself is, do not delete it yourself. May return
// nullptr if the initialization of taskbar button failed.
wxTaskBarButton* MSWGetTaskBarButton();
#endif // wxUSE_TASKBARBUTTON
protected:
// common part of all ctors
void Init();
// override base class virtuals
virtual void DoGetClientSize(int *width, int *height) const override;
virtual void DoSetClientSize(int width, int height) override;
virtual void MSWBeforeDPIChangedEvent(const wxDPIChangedEvent& event) override;
#if wxUSE_MENUS_NATIVE
// perform MSW-specific action when menubar is changed
virtual void AttachMenuBar(wxMenuBar *menubar) override;
// a plug in for MDI frame classes which need to do something special when
// the menubar is set
virtual void InternalSetMenuBar();
#endif // wxUSE_MENUS_NATIVE
// propagate our state change to all child frames
void IconizeChildFrames(bool bIconize);
// the real implementation of MSWTranslateMessage(), also used by
// wxMDIChildFrame
bool MSWDoTranslateMessage(wxFrame *frame, WXMSG *msg);
virtual bool IsMDIChild() const { return false; }
// get default (wxWidgets) icon for the frame
virtual WXHICON GetDefaultIcon() const;
#if wxUSE_TOOLBAR
virtual void PositionToolBar() override;
#endif // wxUSE_TOOLBAR
#if wxUSE_STATUSBAR
virtual void PositionStatusBar() override;
static bool m_useNativeStatusBar;
#endif // wxUSE_STATUSBAR
#if wxUSE_MENUS
// frame menu, nullptr if none
WXHMENU m_hMenu;
// The number of currently opened menus: 0 initially, 1 when a top level
// menu is opened, 2 when its submenu is opened and so on.
int m_menuDepth;
#endif // wxUSE_MENUS
private:
#if wxUSE_TOOLTIPS
WXHWND m_hwndToolTip;
#endif // tooltips
// used by IconizeChildFrames(), see comments there
bool m_wasMinimized;
#if wxUSE_TASKBARBUTTON
wxTaskBarButton* m_taskBarButton;
#endif
wxDECLARE_EVENT_TABLE();
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxFrame);
};
#endif
// _WX_FRAME_H_

View File

@@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/fswatcher.h
// Purpose: wxMSWFileSystemWatcher
// Author: Bartosz Bekier
// Created: 2009-05-26
// Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FSWATCHER_MSW_H_
#define _WX_FSWATCHER_MSW_H_
#include "wx/defs.h"
#if wxUSE_FSWATCHER
class WXDLLIMPEXP_BASE wxMSWFileSystemWatcher : public wxFileSystemWatcherBase
{
public:
wxMSWFileSystemWatcher();
wxMSWFileSystemWatcher(const wxFileName& path,
int events = wxFSW_EVENT_ALL);
// Override the base class function to provide a much more efficient
// implementation for it using the platform native support for watching the
// entire directory trees.
virtual bool AddTree(const wxFileName& path, int events = wxFSW_EVENT_ALL,
const wxString& filter = wxEmptyString) override;
protected:
bool Init();
};
#endif // wxUSE_FSWATCHER
#endif /* _WX_FSWATCHER_MSW_H_ */

View File

@@ -0,0 +1,78 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/gauge.h
// Purpose: wxGauge implementation for MSW
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_GAUGE_H_
#define _WX_MSW_GAUGE_H_
#if wxUSE_GAUGE
extern WXDLLIMPEXP_DATA_CORE(const char) wxGaugeNameStr[];
// Group box
class WXDLLIMPEXP_CORE wxGauge : public wxGaugeBase
{
public:
wxGauge() = default;
wxGauge(wxWindow *parent,
wxWindowID id,
int range,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxGaugeNameStr))
{
(void)Create(parent, id, range, pos, size, style, validator, name);
}
virtual ~wxGauge();
bool Create(wxWindow *parent,
wxWindowID id,
int range,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxGaugeNameStr));
// set gauge range/value
virtual void SetRange(int range) override;
virtual void SetValue(int pos) override;
// overridden base class virtuals
virtual bool SetForegroundColour(const wxColour& col) override;
virtual bool SetBackgroundColour(const wxColour& col) override;
virtual void Pulse() override;
WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const override;
// returns true if the platform should explicitly apply a theme border
virtual bool CanApplyThemeBorder() const override { return false; }
protected:
virtual wxSize DoGetBestSize() const override;
private:
// returns true if the control is currently in indeterminate (a.k.a.
// "marquee") mode
bool IsInIndeterminateMode() const;
// switch to/from indeterminate mode
void SetIndeterminateMode();
void SetDeterminateMode();
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGauge);
};
#endif // wxUSE_GAUGE
#endif // _WX_MSW_GAUGE_H_

View File

@@ -0,0 +1,137 @@
/*
Name: wx/msw/gccpriv.h
Purpose: MinGW/Cygwin definitions
Author: Vadim Zeitlin
Modified by:
Created:
Copyright: (c) Vadim Zeitlin
Licence: wxWindows Licence
*/
/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
#ifndef _WX_MSW_GCCPRIV_H_
#define _WX_MSW_GCCPRIV_H_
#if defined(__MINGW32__) && !defined(__GNUWIN32__)
#define __GNUWIN32__
#endif
#if defined(__MINGW32__)
/*
Include the header defining __MINGW32_{MAJ,MIN}OR_VERSION but check
that UNICODE or _UNICODE is already defined, as _mingw.h relies on them
being set and we'd get weird compilation errors later if it is included
without them being defined, better give a clearer error right now.
*/
#if !defined(UNICODE)
#error "UNICODE must be defined before including this header."
#endif
/*
MinGW 5.3.0 (and presumably later) predefines _WIN32_WINNT and WINVER
in sdkddkver.h included from _mingw.h to very low (Windows 2000!)
values. We really want to predefine them ourselves instead, so do it
before including _mingw.h.
*/
#include "wx/msw/winver.h"
#include <_mingw.h>
/*
MinGW-w64 project provides compilers for both Win32 and Win64 but only
defines the same __MINGW32__ symbol for the former as MinGW32 toolchain
which is quite different (notably doesn't provide many SDK headers that
MinGW-w64 does include). So we define a separate symbol which, unlike
the predefined __MINGW64__, can be used to detect this toolchain in
both 32 and 64 bit builds.
And define __MINGW32_TOOLCHAIN__ for consistency and also because it's
convenient as we often want to have some workarounds only for the (old)
MinGW32 but not (newer) MinGW-w64, which still predefines __MINGW32__.
*/
#ifdef __MINGW64_VERSION_MAJOR
#ifndef __MINGW64_TOOLCHAIN__
#define __MINGW64_TOOLCHAIN__
#endif
#else
#ifndef __MINGW32_TOOLCHAIN__
#define __MINGW32_TOOLCHAIN__
#endif
#endif
#define wxCHECK_MINGW32_VERSION( major, minor ) \
( ( ( __MINGW32_MAJOR_VERSION > (major) ) \
|| ( __MINGW32_MAJOR_VERSION == (major) && __MINGW32_MINOR_VERSION >= (minor) ) ) )
#else
#define wxCHECK_MINGW32_VERSION( major, minor ) (0)
#endif
/* check for MinGW/Cygwin w32api version ( releases >= 0.5, only ) */
#include <w32api.h>
#if defined(__W32API_MAJOR_VERSION) && defined(__W32API_MINOR_VERSION)
#define wxCHECK_W32API_VERSION( major, minor ) \
( ( ( __W32API_MAJOR_VERSION > (major) ) \
|| ( __W32API_MAJOR_VERSION == (major) && __W32API_MINOR_VERSION >= (minor) ) ) )
#else
#define wxCHECK_W32API_VERSION( major, minor ) (0)
#endif
/* Cygwin 1.0 */
#if defined(__CYGWIN__) && ((__GNUC__==2) && (__GNUC_MINOR__==9))
#define __CYGWIN10__
#endif
/*
Traditional MinGW (but not MinGW-w64 nor TDM-GCC) omits many POSIX
functions from their headers when compiled with __STRICT_ANSI__ defined.
Unfortunately this means that they are not available when using -std=c++98
(not very common) or -std=c++11 (much more so), but we still need them even
in this case. As the intention behind using -std=c++11 is probably to get
the new C++11 features and not disable the use of POSIX functions, we just
manually declare the functions we need in this case if necessary.
*/
#ifdef __MINGW32_TOOLCHAIN__
/*
The macro below is used in wx/wxcrtbase.h included from C regex library
code, so make sure it compiles in non-C++ code too.
*/
#ifdef __cplusplus
#define wxEXTERNC extern "C"
#else
#define wxEXTERNC
#endif
/*
This macro is somewhat unusual as it takes the list of parameters
inside parentheses and includes semicolon inside it as putting the
semicolon outside wouldn't do the right thing when this macro is empty.
*/
#define wxDECL_FOR_MINGW32_ALWAYS(rettype, func, params) \
wxEXTERNC _CRTIMP rettype __cdecl __MINGW_NOTHROW func params ;
#ifdef __STRICT_ANSI__
#define wxNEEDS_STRICT_ANSI_WORKAROUNDS
#define wxDECL_FOR_STRICT_MINGW32(rettype, func, params) \
wxDECL_FOR_MINGW32_ALWAYS(rettype, func, params)
/*
There is a bug resulting in a compilation error in MinGW standard
math.h header, see https://sourceforge.net/p/mingw/bugs/2250/, work
around it here because math.h is also included from several other
standard headers (e.g. <algorithm>) and we don't want to duplicate this
hack everywhere this happens.
*/
wxDECL_FOR_STRICT_MINGW32(double, _hypot, (double, double))
#else
#define wxDECL_FOR_STRICT_MINGW32(rettype, func, params)
#endif
#else
#define wxDECL_FOR_MINGW32_ALWAYS(rettype, func, params)
#define wxDECL_FOR_STRICT_MINGW32(rettype, func, params)
#endif
#endif
/* _WX_MSW_GCCPRIV_H_ */

View File

@@ -0,0 +1,214 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/gdiimage.h
// Purpose: wxGDIImage class: base class for wxBitmap, wxIcon, wxCursor
// under MSW
// Author: Vadim Zeitlin
// Created: 20.11.99
// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// NB: this is a private header, it is not intended to be directly included by
// user code (but may be included from other, public, wxWin headers
#ifndef _WX_MSW_GDIIMAGE_H_
#define _WX_MSW_GDIIMAGE_H_
#include "wx/gdiobj.h" // base class
#include "wx/gdicmn.h" // wxBITMAP_TYPE_INVALID
#include "wx/list.h"
class WXDLLIMPEXP_FWD_CORE wxGDIImageRefData;
class WXDLLIMPEXP_FWD_CORE wxGDIImageHandler;
class WXDLLIMPEXP_FWD_CORE wxGDIImage;
WX_DECLARE_EXPORTED_LIST(wxGDIImageHandler, wxGDIImageHandlerList);
// ----------------------------------------------------------------------------
// wxGDIImageRefData: common data fields for all derived classes
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGDIImageRefData : public wxGDIRefData
{
public:
wxGDIImageRefData()
{
m_width = m_height = m_depth = 0;
m_scaleFactor = 1.0;
m_handle = nullptr;
}
wxGDIImageRefData(const wxGDIImageRefData& data) : wxGDIRefData()
{
m_width = data.m_width;
m_height = data.m_height;
m_depth = data.m_depth;
m_scaleFactor = data.m_scaleFactor;
// can't copy handles like this, derived class copy ctor must do it!
m_handle = nullptr;
}
// accessors
virtual bool IsOk() const override { return m_handle != nullptr; }
void SetSize(int w, int h) { m_width = w; m_height = h; }
// free the resources we allocated
virtual void Free() = 0;
// for compatibility, the member fields are public
// the size of the image
int m_width, m_height;
// the depth of the image
int m_depth;
// scale factor of the image
double m_scaleFactor;
// the handle to it
union
{
WXHANDLE m_handle; // for untyped access
WXHBITMAP m_hBitmap;
WXHICON m_hIcon;
WXHCURSOR m_hCursor;
};
};
// ----------------------------------------------------------------------------
// wxGDIImage: this class supports GDI image handlers which may be registered
// dynamically and will be used for loading/saving the images in the specified
// format. It also falls back to wxImage if no appropriate image is found.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGDIImage : public wxGDIObject
{
public:
// handlers list interface
static wxGDIImageHandlerList& GetHandlers() { return ms_handlers; }
static void AddHandler(wxGDIImageHandler *handler);
static void InsertHandler(wxGDIImageHandler *handler);
static bool RemoveHandler(const wxString& name);
static wxGDIImageHandler *FindHandler(const wxString& name);
static wxGDIImageHandler *FindHandler(const wxString& extension, long type);
static wxGDIImageHandler *FindHandler(long type);
static void InitStandardHandlers();
static void CleanUpHandlers();
// access to the ref data casted to the right type
wxGDIImageRefData *GetGDIImageData() const
{ return (wxGDIImageRefData *)m_refData; }
// accessors
WXHANDLE GetHandle() const
{ return IsNull() ? nullptr : GetGDIImageData()->m_handle; }
void SetHandle(WXHANDLE handle)
{ AllocExclusive(); GetGDIImageData()->m_handle = handle; }
int GetWidth() const { return IsNull() ? 0 : GetGDIImageData()->m_width; }
int GetHeight() const { return IsNull() ? 0 : GetGDIImageData()->m_height; }
int GetDepth() const { return IsNull() ? 0 : GetGDIImageData()->m_depth; }
// allow setting and storing the scale factor
void SetScaleFactor(double scale);
double GetScaleFactor() const;
// return the size divided by scale factor
wxSize GetDIPSize() const;
// logical metrics accessors return the same thing as physical ones, just
// as in all the other ports without wxHAS_DPI_INDEPENDENT_PIXELS.
double GetLogicalWidth() const;
double GetLogicalHeight() const;
wxSize GetLogicalSize() const;
wxSize GetSize() const
{
return IsNull() ? wxSize(0,0) :
wxSize(GetGDIImageData()->m_width, GetGDIImageData()->m_height);
}
#if WXWIN_COMPATIBILITY_3_0
wxDEPRECATED_INLINE(void SetWidth(int w), AllocExclusive(); GetGDIImageData()->m_width = w; )
wxDEPRECATED_INLINE(void SetHeight(int h), AllocExclusive(); GetGDIImageData()->m_height = h; )
wxDEPRECATED_INLINE(void SetDepth(int d), AllocExclusive(); GetGDIImageData()->m_depth = d; )
wxDEPRECATED_INLINE(void SetSize(int w, int h), AllocExclusive(); GetGDIImageData()->SetSize(w, h); )
wxDEPRECATED_INLINE(void SetSize(const wxSize& size), AllocExclusive(); GetGDIImageData()->SetSize(size.x, size.y); )
#endif // WXWIN_COMPATIBILITY_3_0
// forward some of base class virtuals to wxGDIImageRefData
bool FreeResource(bool force = false) override;
virtual WXHANDLE GetResourceHandle() const override;
protected:
// create the data for the derived class here
virtual wxGDIImageRefData *CreateData() const = 0;
// implement the wxGDIObject method in terms of our, more specific, one
virtual wxGDIRefData *CreateGDIRefData() const override { return CreateData(); }
// we can't [efficiently] clone objects of this class
virtual wxGDIRefData *
CloneGDIRefData(const wxGDIRefData *WXUNUSED(data)) const override
{
wxFAIL_MSG( wxT("must be implemented if used") );
return nullptr;
}
static wxGDIImageHandlerList ms_handlers;
};
// ----------------------------------------------------------------------------
// wxGDIImageHandler: a class which knows how to load/save wxGDIImages.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGDIImageHandler : public wxObject
{
public:
// ctor
wxGDIImageHandler() { m_type = wxBITMAP_TYPE_INVALID; }
wxGDIImageHandler(const wxString& name,
const wxString& ext,
wxBitmapType type)
: m_name(name), m_extension(ext), m_type(type) { }
// accessors
void SetName(const wxString& name) { m_name = name; }
void SetExtension(const wxString& ext) { m_extension = ext; }
void SetType(wxBitmapType type) { m_type = type; }
const wxString& GetName() const { return m_name; }
const wxString& GetExtension() const { return m_extension; }
wxBitmapType GetType() const { return m_type; }
// real handler operations: to implement in derived classes
virtual bool Create(wxGDIImage *image,
const void* data,
wxBitmapType flags,
int width, int height, int depth = 1) = 0;
virtual bool Load(wxGDIImage *image,
const wxString& name,
wxBitmapType flags,
int desiredWidth, int desiredHeight) = 0;
virtual bool Save(const wxGDIImage *image,
const wxString& name,
wxBitmapType type) const = 0;
protected:
wxString m_name;
wxString m_extension;
wxBitmapType m_type;
};
#endif // _WX_MSW_GDIIMAGE_H_

View File

@@ -0,0 +1,50 @@
/*
* Name: wx/msw/genrcdefs.h
* Purpose: Emit preprocessor symbols into rcdefs.h for resource compiler
* Author: Mike Wetherell
* Copyright: (c) 2005 Mike Wetherell
* Licence: wxWindows licence
*/
#define EMIT(line) line
EMIT(#ifndef _WX_RCDEFS_H)
EMIT(#define _WX_RCDEFS_H)
#ifdef _MSC_FULL_VER
#if _MSC_FULL_VER < 140040130
EMIT(#define wxUSE_RC_MANIFEST 1)
#endif
#else
EMIT(#define wxUSE_RC_MANIFEST 1)
#endif
#if defined _M_AMD64 || defined __x86_64__
EMIT(#define WX_CPU_AMD64)
#endif
#if defined _M_ARM || defined __arm__
EMIT(#define WX_CPU_ARM)
#endif
#if defined _M_ARM64 || defined __aarch64__
EMIT(#define WX_CPU_ARM64)
#endif
#if defined _M_IA64 || defined __ia64__
EMIT(#define WX_CPU_IA64)
#endif
#if defined _M_IX86 || defined _X86_
EMIT(#define WX_CPU_X86)
#endif
#ifdef _M_PPC
EMIT(#define WX_CPU_PPC)
#endif
#ifdef _M_SH
EMIT(#define WX_CPU_SH)
#endif
EMIT(#endif)

View File

@@ -0,0 +1,141 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/glcanvas.h
// Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Windows
// Author: Julian Smart
// Created: 04/01/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GLCANVAS_H_
#define _WX_GLCANVAS_H_
#include "wx/palette.h"
#include "wx/msw/wrapwin.h"
#include <GL/gl.h>
// ----------------------------------------------------------------------------
// wxGLContext: OpenGL rendering context
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase
{
public:
wxGLContext(wxGLCanvas *win,
const wxGLContext *other = nullptr,
const wxGLContextAttrs *ctxAttrs = nullptr);
virtual ~wxGLContext();
virtual bool SetCurrent(const wxGLCanvas& win) const override;
HGLRC GetGLRC() const { return m_glContext; }
protected:
HGLRC m_glContext;
private:
wxDECLARE_CLASS(wxGLContext);
};
// ----------------------------------------------------------------------------
// wxGLCanvas: OpenGL output window
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase
{
public:
wxGLCanvas() = default;
explicit // avoid implicitly converting a wxWindow* to wxGLCanvas
wxGLCanvas(wxWindow *parent,
const wxGLAttributes& dispAttrs,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxGLCanvasName,
const wxPalette& palette = wxNullPalette);
explicit
wxGLCanvas(wxWindow *parent,
wxWindowID id = wxID_ANY,
const int *attribList = nullptr,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxGLCanvasName,
const wxPalette& palette = wxNullPalette);
bool Create(wxWindow *parent,
const wxGLAttributes& dispAttrs,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxGLCanvasName,
const wxPalette& palette = wxNullPalette);
bool Create(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxGLCanvasName,
const int *attribList = nullptr,
const wxPalette& palette = wxNullPalette);
virtual ~wxGLCanvas();
// implement wxGLCanvasBase methods
virtual bool SwapBuffers() override;
// MSW-specific helpers
// --------------------
// get the HDC used for OpenGL rendering
HDC GetHDC() const { return m_hDC; }
// Try to find pixel format matching the given attributes list for the
// specified HDC, return 0 on error, otherwise ppfd is filled in with the
// information from dispAttrs
static int FindMatchingPixelFormat(const wxGLAttributes& dispAttrs,
PIXELFORMATDESCRIPTOR* ppfd = nullptr);
// Same as FindMatchingPixelFormat
static int ChooseMatchingPixelFormat(HDC hdc, const int *attribList,
PIXELFORMATDESCRIPTOR *pfd = nullptr);
#if wxUSE_PALETTE
// palette stuff
bool SetupPalette(const wxPalette& palette);
virtual wxPalette CreateDefaultPalette() override;
void OnQueryNewPalette(wxQueryNewPaletteEvent& event);
void OnPaletteChanged(wxPaletteChangedEvent& event);
#endif // wxUSE_PALETTE
protected:
// the real window creation function, Create() may reuse it twice as we may
// need to create an OpenGL window to query the available extensions and
// then potentially delete and recreate it with another pixel format
bool CreateWindow(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxGLCanvasName);
// set up the pixel format using the given attributes and palette
int DoSetup(PIXELFORMATDESCRIPTOR &pfd, const int *attribList);
// HDC for this window, we keep it all the time
HDC m_hDC = nullptr;
private:
wxDECLARE_EVENT_TABLE();
wxDECLARE_CLASS(wxGLCanvas);
};
#endif // _WX_GLCANVAS_H_

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

View File

@@ -0,0 +1,83 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/headerctrl.h
// Purpose: wxMSW native wxHeaderCtrl
// Author: Vadim Zeitlin
// Created: 2008-12-01
// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_HEADERCTRL_H_
#define _WX_MSW_HEADERCTRL_H_
#include "wx/compositewin.h"
class wxMSWHeaderCtrl;
// ----------------------------------------------------------------------------
// wxHeaderCtrl
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxHeaderCtrl : public wxCompositeWindow<wxHeaderCtrlBase>
{
public:
wxHeaderCtrl()
{
Init();
}
wxHeaderCtrl(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxHD_DEFAULT_STYLE,
const wxString& name = wxASCII_STR(wxHeaderCtrlNameStr))
{
Init();
Create(parent, id, pos, size, style, name);
}
bool Create(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxHD_DEFAULT_STYLE,
const wxString& name = wxASCII_STR(wxHeaderCtrlNameStr));
// Window style handling.
virtual void SetWindowStyleFlag(long style) override;
protected:
// Override wxWindow methods which must be implemented by a new control.
virtual wxSize DoGetBestSize() const override;
private:
// Implement base class pure virtuals.
virtual void DoSetCount(unsigned int count) override;
virtual unsigned int DoGetCount() const override;
virtual void DoUpdate(unsigned int idx) override;
virtual void DoScrollHorz(int dx) override;
virtual void DoSetColumnsOrder(const wxArrayInt& order) override;
virtual wxArrayInt DoGetColumnsOrder() const override;
// Pure virtual method inherited from wxCompositeWindow.
virtual wxWindowList GetCompositeWindowParts() const override;
// Common part of all ctors.
void Init();
// Events.
void OnSize(wxSizeEvent& event);
// The native header control.
wxMSWHeaderCtrl* m_nativeControl;
friend class wxMSWHeaderCtrl;
wxDECLARE_NO_COPY_CLASS(wxHeaderCtrl);
};
#endif // _WX_MSW_HEADERCTRL_H_

View File

@@ -0,0 +1,127 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/helpbest.h
// Purpose: Tries to load MS HTML Help, falls back to wxHTML upon failure
// Author: Mattia Barbon
// Created: 02/04/2001
// Copyright: (c) Mattia Barbon
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_HELPBEST_H_
#define _WX_HELPBEST_H_
#if wxUSE_HELP && wxUSE_MS_HTML_HELP \
&& wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
#include "wx/helpbase.h"
#include "wx/html/helpfrm.h" // for wxHF_DEFAULT_STYLE
class WXDLLIMPEXP_HTML wxBestHelpController: public wxHelpControllerBase
{
public:
wxBestHelpController(wxWindow* parentWindow = nullptr,
int style = wxHF_DEFAULT_STYLE)
: wxHelpControllerBase(parentWindow),
m_helpControllerType(wxUseNone),
m_helpController(nullptr),
m_style(style)
{
}
virtual ~wxBestHelpController() { delete m_helpController; }
// Must call this to set the filename
virtual bool Initialize(const wxString& file) override;
virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) override { return Initialize( file ); }
// If file is "", reloads file given in Initialize
virtual bool LoadFile(const wxString& file = wxEmptyString) override
{
return m_helpController->LoadFile( GetValidFilename( file ) );
}
virtual bool DisplayContents() override
{
return m_helpController->DisplayContents();
}
virtual bool DisplaySection(int sectionNo) override
{
return m_helpController->DisplaySection( sectionNo );
}
virtual bool DisplaySection(const wxString& section) override
{
return m_helpController->DisplaySection( section );
}
virtual bool DisplayBlock(long blockNo) override
{
return m_helpController->DisplayBlock( blockNo );
}
virtual bool DisplayContextPopup(int contextId) override
{
return m_helpController->DisplayContextPopup( contextId );
}
virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos) override
{
return m_helpController->DisplayTextPopup( text, pos );
}
virtual bool KeywordSearch(const wxString& k,
wxHelpSearchMode mode = wxHELP_SEARCH_ALL) override
{
return m_helpController->KeywordSearch( k, mode );
}
virtual bool Quit() override
{
return m_helpController->Quit();
}
// Allows one to override the default settings for the help frame.
virtual void SetFrameParameters(const wxString& title,
const wxSize& size,
const wxPoint& pos = wxDefaultPosition,
bool newFrameEachTime = false) override
{
m_helpController->SetFrameParameters( title, size, pos,
newFrameEachTime );
}
// Obtains the latest settings used by the help frame and the help frame.
virtual wxFrame *GetFrameParameters(wxSize *size = nullptr,
wxPoint *pos = nullptr,
bool *newFrameEachTime = nullptr) override
{
return m_helpController->GetFrameParameters( size, pos,
newFrameEachTime );
}
/// Set the window that can optionally be used for the help window's parent.
virtual void SetParentWindow(wxWindow* win) override { m_helpController->SetParentWindow(win); }
/// Get the window that can optionally be used for the help window's parent.
virtual wxWindow* GetParentWindow() const override { return m_helpController->GetParentWindow(); }
protected:
// Append/change extension if necessary.
wxString GetValidFilename(const wxString& file) const;
protected:
enum HelpControllerType { wxUseNone, wxUseHtmlHelp, wxUseChmHelp };
HelpControllerType m_helpControllerType;
wxHelpControllerBase* m_helpController;
int m_style;
wxDECLARE_DYNAMIC_CLASS(wxBestHelpController);
wxDECLARE_NO_COPY_CLASS(wxBestHelpController);
};
#endif // wxUSE_HELP && wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP
#endif
// _WX_HELPBEST_H_

View File

@@ -0,0 +1,88 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/helpchm.h
// Purpose: Help system: MS HTML Help implementation
// Author: Julian Smart
// Created: 16/04/2000
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_HELPCHM_H_
#define _WX_MSW_HELPCHM_H_
#if wxUSE_MS_HTML_HELP
#include "wx/helpbase.h"
class WXDLLIMPEXP_CORE wxCHMHelpController : public wxHelpControllerBase
{
public:
wxCHMHelpController(wxWindow* parentWindow = nullptr): wxHelpControllerBase(parentWindow) { }
// Must call this to set the filename
virtual bool Initialize(const wxString& file) override;
virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) override { return Initialize( file ); }
// If file is "", reloads file given in Initialize
virtual bool LoadFile(const wxString& file = wxEmptyString) override;
virtual bool DisplayContents() override;
virtual bool DisplaySection(int sectionNo) override;
virtual bool DisplaySection(const wxString& section) override;
virtual bool DisplayBlock(long blockNo) override;
virtual bool DisplayContextPopup(int contextId) override;
virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos) override;
virtual bool KeywordSearch(const wxString& k,
wxHelpSearchMode mode = wxHELP_SEARCH_ALL) override;
virtual bool Quit() override;
wxString GetHelpFile() const { return m_helpFile; }
// helper of DisplayTextPopup(), also used in wxSimpleHelpProvider::ShowHelp
static bool ShowContextHelpPopup(const wxString& text,
const wxPoint& pos,
wxWindow *window);
protected:
// get the name of the CHM file we use from our m_helpFile
wxString GetValidFilename() const;
// Call HtmlHelp() with the provided parameters (both overloads do the same
// thing but allow to avoid casts in the calling code) and return false
// (but don't crash) if HTML help is unavailable
static bool CallHtmlHelp(wxWindow *win, const wxChar *str,
unsigned cmd, WXWPARAM param);
static bool CallHtmlHelp(wxWindow *win, const wxChar *str,
unsigned cmd, const void *param = nullptr)
{
return CallHtmlHelp(win, str, cmd, reinterpret_cast<WXWPARAM>(param));
}
// even simpler wrappers using GetParentWindow() and GetValidFilename() as
// the first 2 HtmlHelp() parameters
bool CallHtmlHelp(unsigned cmd, WXWPARAM param)
{
return CallHtmlHelp(GetParentWindow(), GetValidFilename().t_str(),
cmd, param);
}
bool CallHtmlHelp(unsigned cmd, const void *param = nullptr)
{
return CallHtmlHelp(cmd, reinterpret_cast<WXWPARAM>(param));
}
// wrapper around CallHtmlHelp(HH_DISPLAY_TEXT_POPUP): only one of text and
// contextId parameters can be non-null/non-zero
static bool DoDisplayTextPopup(const wxChar *text,
const wxPoint& pos,
int contextId,
wxWindow *window);
wxString m_helpFile;
wxDECLARE_DYNAMIC_CLASS(wxCHMHelpController);
};
#endif // wxUSE_MS_HTML_HELP
#endif // _WX_MSW_HELPCHM_H_

View File

@@ -0,0 +1,54 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/helpwin.h
// Purpose: Help system: WinHelp implementation
// Author: Julian Smart
// Created: 04/01/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_HELPWIN_H_
#define _WX_HELPWIN_H_
#include "wx/wx.h"
#if wxUSE_HELP
#include "wx/helpbase.h"
class WXDLLIMPEXP_CORE wxWinHelpController: public wxHelpControllerBase
{
wxDECLARE_DYNAMIC_CLASS(wxWinHelpController);
public:
wxWinHelpController(wxWindow* parentWindow = nullptr): wxHelpControllerBase(parentWindow) {}
virtual ~wxWinHelpController() = default;
// Must call this to set the filename
virtual bool Initialize(const wxString& file) override;
virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) override { return Initialize( file ); }
// If file is "", reloads file given in Initialize
virtual bool LoadFile(const wxString& file = wxEmptyString) override;
virtual bool DisplayContents() override;
virtual bool DisplaySection(int sectionNo) override;
virtual bool DisplaySection(const wxString& section) override { return KeywordSearch(section); }
virtual bool DisplayBlock(long blockNo) override;
virtual bool DisplayContextPopup(int contextId) override;
virtual bool KeywordSearch(const wxString& k,
wxHelpSearchMode mode = wxHELP_SEARCH_ALL) override;
virtual bool Quit() override;
inline wxString GetHelpFile() const { return m_helpFile; }
protected:
// Append extension if necessary.
wxString GetValidFilename(const wxString& file) const;
private:
wxString m_helpFile;
};
#endif // wxUSE_HELP
#endif
// _WX_HELPWIN_H_

View File

@@ -0,0 +1,444 @@
/*
* wx/msw/htmlhelp.h
* Copyright 2004 Jacek Caban
*
* Originally written for the Wine project, and issued under
* the wxWindows licence by kind permission of the author.
*
* Licence: wxWindows licence
*/
#ifndef __HTMLHELP_H__
#define __HTMLHELP_H__
#define HH_DISPLAY_TOPIC 0x00
#define HH_HELP_FINDER 0x00
#define HH_DISPLAY_TOC 0x01
#define HH_DISPLAY_INDEX 0x02
#define HH_DISPLAY_SEARCH 0x03
#define HH_SET_WIN_TYPE 0x04
#define HH_GET_WIN_TYPE 0x05
#define HH_GET_WIN_HANDLE 0x06
#define HH_ENUM_INFO_TYPE 0x07
#define HH_SET_INFO_TYPE 0x08
#define HH_SYNC 0x09
#define HH_RESERVED1 0x0A
#define HH_RESERVED2 0x0B
#define HH_RESERVED3 0x0C
#define HH_KEYWORD_LOOKUP 0x0D
#define HH_DISPLAY_TEXT_POPUP 0x0E
#define HH_HELP_CONTEXT 0x0F
#define HH_TP_HELP_CONTEXTMENU 0x10
#define HH_TP_HELP_WM_HELP 0x11
#define HH_CLOSE_ALL 0x12
#define HH_ALINK_LOOKUP 0x13
#define HH_GET_LAST_ERROR 0x14
#define HH_ENUM_CATEGORY 0x15
#define HH_ENUM_CATEGORY_IT 0x16
#define HH_RESET_IT_FILTER 0x17
#define HH_SET_INCLUSIVE_FILTER 0x18
#define HH_SET_EXCLUSIVE_FILTER 0x19
#define HH_INITIALIZE 0x1C
#define HH_UNINITIALIZE 0x1D
#define HH_PRETRANSLATEMESSAGE 0xFD
#define HH_SET_GLOBAL_PROPERTY 0xFC
#define HHWIN_PROP_TAB_AUTOHIDESHOW 0x00000001
#define HHWIN_PROP_ONTOP 0x00000002
#define HHWIN_PROP_NOTITLEBAR 0x00000004
#define HHWIN_PROP_NODEF_STYLES 0x00000008
#define HHWIN_PROP_NODEF_EXSTYLES 0x00000010
#define HHWIN_PROP_TRI_PANE 0x00000020
#define HHWIN_PROP_NOTB_TEXT 0x00000040
#define HHWIN_PROP_POST_QUIT 0x00000080
#define HHWIN_PROP_AUTO_SYNC 0x00000100
#define HHWIN_PROP_TRACKING 0x00000200
#define HHWIN_PROP_TAB_SEARCH 0x00000400
#define HHWIN_PROP_TAB_HISTORY 0x00000800
#define HHWIN_PROP_TAB_FAVORITES 0x00001000
#define HHWIN_PROP_CHANGE_TITLE 0x00002000
#define HHWIN_PROP_NAV_ONLY_WIN 0x00004000
#define HHWIN_PROP_NO_TOOLBAR 0x00008000
#define HHWIN_PROP_MENU 0x00010000
#define HHWIN_PROP_TAB_ADVSEARCH 0x00020000
#define HHWIN_PROP_USER_POS 0x00040000
#define HHWIN_PROP_TAB_CUSTOM1 0x00080000
#define HHWIN_PROP_TAB_CUSTOM2 0x00100000
#define HHWIN_PROP_TAB_CUSTOM3 0x00200000
#define HHWIN_PROP_TAB_CUSTOM4 0x00400000
#define HHWIN_PROP_TAB_CUSTOM5 0x00800000
#define HHWIN_PROP_TAB_CUSTOM6 0x01000000
#define HHWIN_PROP_TAB_CUSTOM7 0x02000000
#define HHWIN_PROP_TAB_CUSTOM8 0x04000000
#define HHWIN_PROP_TAB_CUSTOM9 0x08000000
#define HHWIN_TB_MARGIN 0x10000000
#define HHWIN_PARAM_PROPERTIES 0x00000002
#define HHWIN_PARAM_STYLES 0x00000004
#define HHWIN_PARAM_EXSTYLES 0x00000008
#define HHWIN_PARAM_RECT 0x00000010
#define HHWIN_PARAM_NAV_WIDTH 0x00000020
#define HHWIN_PARAM_SHOWSTATE 0x00000040
#define HHWIN_PARAM_INFOTYPES 0x00000080
#define HHWIN_PARAM_TB_FLAGS 0x00000100
#define HHWIN_PARAM_EXPANSION 0x00000200
#define HHWIN_PARAM_TABPOS 0x00000400
#define HHWIN_PARAM_TABORDER 0x00000800
#define HHWIN_PARAM_HISTORY_COUNT 0x00001000
#define HHWIN_PARAM_CUR_TAB 0x00002000
#define HHWIN_BUTTON_EXPAND 0x00000002
#define HHWIN_BUTTON_BACK 0x00000004
#define HHWIN_BUTTON_FORWARD 0x00000008
#define HHWIN_BUTTON_STOP 0x00000010
#define HHWIN_BUTTON_REFRESH 0x00000020
#define HHWIN_BUTTON_HOME 0x00000040
#define HHWIN_BUTTON_BROWSE_FWD 0x00000080
#define HHWIN_BUTTON_BROWSE_BCK 0x00000100
#define HHWIN_BUTTON_NOTES 0x00000200
#define HHWIN_BUTTON_CONTENTS 0x00000400
#define HHWIN_BUTTON_SYNC 0x00000800
#define HHWIN_BUTTON_OPTIONS 0x00001000
#define HHWIN_BUTTON_PRINT 0x00002000
#define HHWIN_BUTTON_INDEX 0x00004000
#define HHWIN_BUTTON_SEARCH 0x00008000
#define HHWIN_BUTTON_HISTORY 0x00010000
#define HHWIN_BUTTON_FAVORITES 0x00020000
#define HHWIN_BUTTON_JUMP1 0x00040000
#define HHWIN_BUTTON_JUMP2 0x00080000
#define HHWIN_BUTTON_ZOOM 0x00100000
#define HHWIN_BUTTON_TOC_NEXT 0x00200000
#define HHWIN_BUTTON_TOC_PREV 0x00400000
#define HHWIN_DEF_BUTTONS \
(HHWIN_BUTTON_EXPAND | HHWIN_BUTTON_BACK | HHWIN_BUTTON_OPTIONS | HHWIN_BUTTON_PRINT)
#define IDTB_EXPAND 200
#define IDTB_CONTRACT 201
#define IDTB_STOP 202
#define IDTB_REFRESH 203
#define IDTB_BACK 204
#define IDTB_HOME 205
#define IDTB_SYNC 206
#define IDTB_PRINT 207
#define IDTB_OPTIONS 208
#define IDTB_FORWARD 209
#define IDTB_NOTES 210
#define IDTB_BROWSE_FWD 211
#define IDTB_BROWSE_BACK 212
#define IDTB_CONTENTS 213
#define IDTB_INDEX 214
#define IDTB_SEARCH 215
#define IDTB_HISTORY 216
#define IDTB_FAVORITES 217
#define IDTB_JUMP1 218
#define IDTB_JUMP2 219
#define IDTB_CUSTOMIZE 221
#define IDTB_ZOOM 222
#define IDTB_TOC_NEXT 223
#define IDTB_TOC_PREV 224
#define HHN_FIRST (0U-860U)
#define HHN_LAST (0U-879U)
#define HHN_NAVCOMPLETE HHN_FIRST
#define HHN_TRACK (HHN_FIRST-1)
#define HHN_WINDOW_CREATE (HHN_FIRST-2)
#ifdef __cplusplus
extern "C" {
#endif
typedef struct tagHH_NOTIFY {
NMHDR hdr;
PCSTR pszurl;
} HH_NOTIFY;
typedef struct tagHH_POPUPA {
int cbStruct;
HINSTANCE hinst;
UINT idString;
LPCSTR pszText;
POINT pt;
COLORREF clrForeground;
COLORREF clrBackground;
RECT rcMargins;
LPCSTR pszFont;
} HH_POPUPA;
typedef struct tagHH_POPUPW {
int cbStruct;
HINSTANCE hinst;
UINT idString;
LPCWSTR pszText;
POINT pt;
COLORREF clrForeground;
COLORREF clrBackground;
RECT rcMargins;
LPCWSTR pszFont;
} HH_POPUPW;
typedef HH_POPUPW HH_POPUP;
typedef struct tagHH_ALINKA {
int cbStruct;
BOOL fReserved;
LPCSTR pszKeywords;
LPCSTR pszUrl;
LPCSTR pszMsgText;
LPCSTR pszMsgTitle;
LPCSTR pszWindow;
BOOL fIndexOnFail;
} HH_ALINKA;
typedef struct tagHH_ALINKW {
int cbStruct;
BOOL fReserved;
LPCWSTR pszKeywords;
LPCWSTR pszUrl;
LPCWSTR pszMsgText;
LPCWSTR pszMsgTitle;
LPCWSTR pszWindow;
BOOL fIndexOnFail;
} HH_ALINKW;
typedef HH_ALINKW HH_ALINK;
typedef HH_ALINKW HH_AKLINK;
enum {
HHWIN_NAVTYPE_TOC,
HHWIN_NAVTYPE_INDEX,
HHWIN_NAVTYPE_SEARCH,
HHWIN_NAVTYPE_FAVORITES,
HHWIN_NAVTYPE_HISTORY,
HHWIN_NAVTYPE_AUTHOR,
HHWIN_NAVTYPE_CUSTOM_FIRST = 11
};
enum {
IT_INCLUSIVE,
IT_EXCLUSIVE,
IT_HIDDEN
};
typedef struct tagHH_ENUM_IT {
int cbStruct;
int iType;
LPCSTR pszCatName;
LPCSTR pszITName;
LPCSTR pszITDescription;
} HH_ENUM_IT, *PHH_ENUM_IT;
typedef struct tagHH_ENUM_CAT {
int cbStruct;
LPCSTR pszCatName;
LPCSTR pszCatDescription;
} HH_ENUM_CAT, *PHH_ENUM_CAT;
typedef struct tagHH_SET_INFOTYPE {
int cbStruct;
LPCSTR pszCatName;
LPCSTR pszInfoTypeName;
} HH_SET_INFOTYPE;
typedef DWORD HH_INFOTYPE, *PHH_INFOTYPE;
enum {
HHWIN_NAVTAB_TOP,
HHWIN_NAVTAB_LEFT,
HHWIN_NAVTAB_BOTTOM
};
#define HH_MAX_TABS 19
enum {
HH_TAB_CONTENTS,
HH_TAB_INDEX,
HH_TAB_SEARCH,
HH_TAB_FAVORITES,
HH_TAB_HISTORY,
HH_TAB_AUTHOR,
HH_TAB_CUSTOM_FIRST = 11,
HH_TAB_CUSTOM_LAST = HH_MAX_TABS
};
#define HH_MAX_TABS_CUSTOM (HH_TAB_CUSTOM_LAST-HH_TAB_CUSTOM_FIRST+1)
#define HH_FTS_DEFAULT_PROXIMITY -1
typedef struct tagHH_FTS_QUERYA {
int cbStruct;
BOOL fUniCodeStrings;
LPCSTR pszSearchQuery;
LONG iProximity;
BOOL fStemmedSearch;
BOOL fTitleOnly;
BOOL fExecute;
LPCSTR pszWindow;
} HH_FTS_QUERYA;
typedef struct tagHH_FTS_QUERYW {
int cbStruct;
BOOL fUniCodeStrings;
LPCWSTR pszSearchQuery;
LONG iProximity;
BOOL fStemmedSearch;
BOOL fTitleOnly;
BOOL fExecute;
LPCWSTR pszWindow;
} HH_FTS_QUERYW;
typedef HH_FTS_QUERYW HH_FTS_QUERY;
typedef struct tagHH_WINTYPEA {
int cbStruct;
BOOL fUniCodeStrings;
LPCSTR pszType;
DWORD fsValidMembers;
DWORD fsWinProperties;
LPCSTR pszCaption;
DWORD dwStyles;
DWORD dwExStyles;
RECT rcWindowPos;
int nShowState;
HWND hwndHelp;
HWND hwndCaller;
PHH_INFOTYPE paInfoTypes;
HWND hwndToolBar;
HWND hwndNavigation;
HWND hwndHTML;
int iNavWidth;
RECT rcHTML;
LPCSTR pszToc;
LPCSTR pszIndex;
LPCSTR pszFile;
LPCSTR pszHome;
DWORD fsToolBarFlags;
BOOL fNotExpanded;
int curNavType;
int tabpos;
int idNotify;
BYTE tabOrder[HH_MAX_TABS+1];
int cHistory;
LPCSTR pszJump1;
LPCSTR pszJump2;
LPCSTR pszUrlJump1;
LPCSTR pszUrlJump2;
RECT rcMinSize;
int cbInfoTypes;
LPCSTR pszCustomTabs;
} HH_WINTYPEA, *PHH_WINTYPEA;
typedef struct tagHH_WINTYPEW {
int cbStruct;
BOOL fUniCodeStrings;
LPCWSTR pszType;
DWORD fsValidMembers;
DWORD fsWinProperties;
LPCWSTR pszCaption;
DWORD dwStyles;
DWORD dwExStyles;
RECT rcWindowPos;
int nShowState;
HWND hwndHelp;
HWND hwndCaller;
PHH_INFOTYPE paInfoTypes;
HWND hwndToolBar;
HWND hwndNavigation;
HWND hwndHTML;
int iNavWidth;
RECT rcHTML;
LPCWSTR pszToc;
LPCWSTR pszIndex;
LPCWSTR pszFile;
LPCWSTR pszHome;
DWORD fsToolBarFlags;
BOOL fNotExpanded;
int curNavType;
int tabpos;
int idNotify;
BYTE tabOrder[HH_MAX_TABS+1];
int cHistory;
LPCWSTR pszJump1;
LPCWSTR pszJump2;
LPCWSTR pszUrlJump1;
LPCWSTR pszUrlJump2;
RECT rcMinSize;
int cbInfoTypes;
LPCWSTR pszCustomTabs;
} HH_WINTYPEW, *PHH_WINTYPEW;
typedef HH_WINTYPEW HH_WINTYPE;
enum {
HHACT_TAB_CONTENTS,
HHACT_TAB_INDEX,
HHACT_TAB_SEARCH,
HHACT_TAB_HISTORY,
HHACT_TAB_FAVORITES,
HHACT_EXPAND,
HHACT_CONTRACT,
HHACT_BACK,
HHACT_FORWARD,
HHACT_STOP,
HHACT_REFRESH,
HHACT_HOME,
HHACT_SYNC,
HHACT_OPTIONS,
HHACT_PRINT,
HHACT_HIGHLIGHT,
HHACT_CUSTOMIZE,
HHACT_JUMP1,
HHACT_JUMP2,
HHACT_ZOOM,
HHACT_TOC_NEXT,
HHACT_TOC_PREV,
HHACT_NOTES,
HHACT_LAST_ENUM
};
typedef struct tagHH_NTRACKA {
NMHDR hdr;
PCSTR pszCurUrl;
int idAction;
PHH_WINTYPEA phhWinType;
} HH_NTRACKA;
typedef struct tagHH_NTRACKW {
NMHDR hdr;
PCSTR pszCurUrl;
int idAction;
PHH_WINTYPEW phhWinType;
} HH_NTRACKW;
typedef HH_NTRACKW HH_NTRACK;
HWND WINAPI HtmlHelpA(HWND,LPCSTR,UINT,DWORD);
HWND WINAPI HtmlHelpA(HWND,LPCSTR,UINT,DWORD);
#define HtmlHelp WINELIB_NAME_AW(HtmlHelp)
#define ATOM_HTMLHELP_API_ANSI (LPTSTR)14
#define ATOM_HTMLHELP_API_UNICODE (LPTSTR)15
typedef enum tagHH_GPROPID {
HH_GPROPID_SINGLETHREAD = 1,
HH_GPROPID_TOOLBAR_MARGIN = 2,
HH_GPROPID_UI_LANGUAGE = 3,
HH_GPROPID_CURRENT_SUBSET = 4,
HH_GPROPID_CONTENT_LANGUAGE = 5
} HH_GPROPID;
#ifdef __WIDL_OAIDL_H
typedef struct tagHH_GLOBAL_PROPERTY
{
HH_GPROPID id;
VARIANT var;
} HH_GLOBAL_PROPERTY ;
#endif /* __WIDL_OAIDL_H */
#ifdef __cplusplus
}
#endif
#endif /* __HTMLHELP_H__ */

View File

@@ -0,0 +1,90 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/hyperlink.h
// Purpose: Hyperlink control
// Author: Rickard Westerlund
// Created: 2010-08-04
// Copyright: (c) 2010 wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_HYPERLINK_H_
#define _WX_MSW_HYPERLINK_H_
#include "wx/generic/hyperlink.h"
// ----------------------------------------------------------------------------
// wxHyperlinkCtrl
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxHyperlinkCtrl : public wxGenericHyperlinkCtrl
{
public:
// Default constructor (for two-step construction).
wxHyperlinkCtrl() = default;
// Constructor.
wxHyperlinkCtrl(wxWindow *parent,
wxWindowID id,
const wxString& label, const wxString& url,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxHL_DEFAULT_STYLE,
const wxString& name = wxASCII_STR(wxHyperlinkCtrlNameStr))
{
(void)Create(parent, id, label, url, pos, size, style, name);
}
// Creation function (for two-step construction).
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& label, const wxString& url,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxHL_DEFAULT_STYLE,
const wxString& name = wxASCII_STR(wxHyperlinkCtrlNameStr));
virtual ~wxHyperlinkCtrl();
// overridden base class methods
// -----------------------------
virtual void SetURL(const wxString &url) override;
virtual void SetLabel(const wxString &label) override;
// Native control doesn't change appearance on hover, so we don't support
// changing hover colour.
virtual wxColour GetHoverColour() const override;
virtual wxColour GetNormalColour() const override;
virtual void SetNormalColour(const wxColour &colour) override;
virtual wxColour GetVisitedColour() const override;
virtual void SetVisitedColour(const wxColour &colour) override;
// overridden/inherited wxWindow methods
virtual bool Enable(bool enable = true) override;
virtual bool SetForegroundColour(const wxColour& colour) override;
virtual wxVisualAttributes GetDefaultAttributes() const override;
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
protected:
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const override;
virtual wxSize DoGetBestClientSize() const override;
private:
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) override;
bool MSWAreCustomColoursEnabled() const;
void MSWEnableCustomColours();
// This is set to the previously used colour when the control is disabled,
// to be able to restore it later when the control is enabled again.
wxColour m_savedEnabledColour;
wxDECLARE_DYNAMIC_CLASS( wxHyperlinkCtrl );
};
#endif // _WX_MSW_HYPERLINK_H_

View File

@@ -0,0 +1,96 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/icon.h
// Purpose: wxIcon class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ICON_H_
#define _WX_ICON_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/msw/gdiimage.h"
// ---------------------------------------------------------------------------
// icon data
// ---------------------------------------------------------------------------
// notice that although wxIconRefData inherits from wxBitmapRefData, it is not
// a valid wxBitmapRefData
class WXDLLIMPEXP_CORE wxIconRefData : public wxGDIImageRefData
{
public:
wxIconRefData() = default;
virtual ~wxIconRefData() { Free(); }
virtual void Free() override;
};
// ---------------------------------------------------------------------------
// Icon
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxIcon : public wxGDIImage
{
public:
// ctors
// default
wxIcon() = default;
// from raw data
wxIcon(const char bits[], int width, int height);
// from XPM data
wxIcon(const char* const* data) { CreateIconFromXpm(data); }
// from resource/file
wxIcon(const wxString& name,
wxBitmapType type = wxICON_DEFAULT_TYPE,
int desiredWidth = -1, int desiredHeight = -1);
wxIcon(const wxIconLocation& loc);
virtual bool LoadFile(const wxString& name,
wxBitmapType type = wxICON_DEFAULT_TYPE,
int desiredWidth = -1, int desiredHeight = -1);
bool CreateFromHICON(WXHICON icon);
// implementation only from now on
wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; }
#if WXWIN_COMPATIBILITY_3_0
wxDEPRECATED_INLINE(void SetHICON(WXHICON icon), SetHandle((WXHANDLE)icon); )
#endif // WXWIN_COMPATIBILITY_3_0
WXHICON GetHICON() const { return (WXHICON)GetHandle(); }
bool InitFromHICON(WXHICON icon, int width, int height, double scale = 1.0);
// create from bitmap (which should have a mask unless it's monochrome):
// there shouldn't be any implicit bitmap -> icon conversion (i.e. no
// ctors, assignment operators...), but it's ok to have such function
void CopyFromBitmap(const wxBitmap& bmp);
wxDECLARE_VARIANT_OBJECT_EXPORTED(wxIcon, WXDLLIMPEXP_CORE);
protected:
virtual wxGDIImageRefData *CreateData() const override
{
return new wxIconRefData;
}
wxNODISCARD virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const override;
// create from XPM data
void CreateIconFromXpm(const char* const* data);
private:
wxDECLARE_DYNAMIC_CLASS(wxIcon);
};
#endif
// _WX_ICON_H_

View File

@@ -0,0 +1,209 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/imaglist.h
// Purpose: wxImageList class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_IMAGLIST_H_
#define _WX_IMAGLIST_H_
class WXDLLIMPEXP_CORE wxImageList : public wxImageListBase
{
public:
/*
* Public interface
*/
wxImageList() = default;
// Creates an image list.
// Specify the width and height of the images in the list,
// whether there are masks associated with them (e.g. if creating images
// from icons), and the initial size of the list.
wxImageList(int width, int height, bool mask = true, int initialCount = 1)
{
Create(width, height, mask, initialCount);
}
virtual ~wxImageList();
// Attributes
////////////////////////////////////////////////////////////////////////////
// Returns the number of images in the image list.
virtual int GetImageCount() const override;
// Returns the size (same for all images) of the images in the list
virtual bool GetSize(int index, int &width, int &height) const override;
using wxImageListBase::GetSize;
// Operations
////////////////////////////////////////////////////////////////////////////
// Creates an image list
// width, height specify the size of the images in the list (all the same).
// mask specifies whether the images have masks or not.
// initialNumber is the initial number of images to reserve.
bool Create(int width, int height, bool mask = true, int initialNumber = 1);
// Destroys the image list, Create() may then be called again later.
virtual void Destroy() override;
// Adds a bitmap, and optionally a mask bitmap.
// Note that wxImageList creates *new* bitmaps, so you may delete
// 'bitmap' and 'mask' after calling Add.
virtual int Add(const wxBitmap& bitmap, const wxBitmap& mask) override;
virtual int Add(const wxBitmap& bitmap) override
{
return Add(bitmap, wxNullBitmap);
}
// Adds a bitmap, using the specified colour to create the mask bitmap
// Note that wxImageList creates *new* bitmaps, so you may delete
// 'bitmap' after calling Add.
virtual int Add(const wxBitmap& bitmap, const wxColour& maskColour) override;
// Adds a bitmap and mask from an icon.
int Add(const wxIcon& icon);
// Replaces a bitmap, optionally passing a mask bitmap.
// Note that wxImageList creates new bitmaps, so you may delete
// 'bitmap' and 'mask' after calling Replace.
virtual bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap) override;
// Replaces a bitmap and mask from an icon.
// You can delete 'icon' after calling Replace.
bool Replace(int index, const wxIcon& icon);
// Removes the image at the given index.
virtual bool Remove(int index) override;
// Remove all images
virtual bool RemoveAll() override;
// Draws the given image on a dc at the specified position.
// If 'solidBackground' is true, Draw sets the image list background
// colour to the background colour of the wxDC, to speed up
// drawing by eliminating masked drawing where possible.
virtual bool Draw(int index, wxDC& dc, int x, int y,
int flags = wxIMAGELIST_DRAW_NORMAL,
bool solidBackground = false) override;
// Get a bitmap
virtual wxBitmap GetBitmap(int index) const override;
// Get an icon
virtual wxIcon GetIcon(int index) const override;
// TODO: miscellaneous functionality
/*
wxIcon *MakeIcon(int index);
bool SetOverlayImage(int index, int overlayMask);
*/
// TODO: Drag-and-drop related functionality.
#if 0
// Creates a new drag image by combining the given image (typically a mouse cursor image)
// with the current drag image.
bool SetDragCursorImage(int index, const wxPoint& hotSpot);
// If successful, returns a pointer to the temporary image list that is used for dragging;
// otherwise, nullptr.
// dragPos: receives the current drag position.
// hotSpot: receives the offset of the drag image relative to the drag position.
static wxImageList *GetDragImageList(wxPoint& dragPos, wxPoint& hotSpot);
// Call this function to begin dragging an image. This function creates a temporary image list
// that is used for dragging. The image combines the specified image and its mask with the
// current cursor. In response to subsequent mouse move messages, you can move the drag image
// by using the DragMove member function. To end the drag operation, you can use the EndDrag
// member function.
bool BeginDrag(int index, const wxPoint& hotSpot);
// Ends a drag operation.
bool EndDrag();
// Call this function to move the image that is being dragged during a drag-and-drop operation.
// This function is typically called in response to a mouse move message. To begin a drag
// operation, use the BeginDrag member function.
static bool DragMove(const wxPoint& point);
// During a drag operation, locks updates to the window specified by lockWindow and displays
// the drag image at the position specified by point.
// The coordinates are relative to the window's upper left corner, so you must compensate
// for the widths of window elements, such as the border, title bar, and menu bar, when
// specifying the coordinates.
// If lockWindow is null, this function draws the image in the display context associated
// with the desktop window, and coordinates are relative to the upper left corner of the screen.
// This function locks all other updates to the given window during the drag operation.
// If you need to do any drawing during a drag operation, such as highlighting the target
// of a drag-and-drop operation, you can temporarily hide the dragged image by using the
// wxImageList::DragLeave function.
// lockWindow: pointer to the window that owns the drag image.
// point: position at which to display the drag image. Coordinates are relative to the
// upper left corner of the window (not the client area).
static bool DragEnter( wxWindow *lockWindow, const wxPoint& point );
// Unlocks the window specified by pWndLock and hides the drag image, allowing the
// window to be updated.
static bool DragLeave( wxWindow *lockWindow );
/* Here's roughly how you'd use these functions:
1) Starting to drag:
wxImageList *dragImageList = new wxImageList(16, 16, true);
dragImageList->Add(myDragImage); // Provide an image to combine with the current cursor
dragImageList->BeginDrag(0, wxPoint(0, 0));
wxShowCursor(false); // wxShowCursor not yet implemented in wxWin
myWindow->CaptureMouse();
2) Dragging:
// Called within mouse move event. Could also use dragImageList instead of assuming
// these are static functions.
// These two functions could possibly be combined into one, since DragEnter is
// a bit obscure.
wxImageList::DragMove(wxPoint(x, y)); // x, y are current cursor position
wxImageList::DragEnter(nullptr, wxPoint(x, y)); // nullptr assumes dragging across whole screen
3) Finishing dragging:
dragImageList->EndDrag();
myWindow->ReleaseMouse();
wxShowCursor(true);
*/
#endif
// Implementation
////////////////////////////////////////////////////////////////////////////
// Returns the native image list handle
WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; }
protected:
WXHIMAGELIST m_hImageList = nullptr;
private:
// Private helper used by GetImageListBitmaps().
class wxMSWBitmaps;
// Fills the provided output "bitmaps" object with the actual bitmaps we need
// to use with the native control.
void GetImageListBitmaps(wxMSWBitmaps& bitmaps,
const wxBitmap& bitmap, const wxBitmap& mask);
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxImageList);
};
#endif
// _WX_IMAGLIST_H_

View File

@@ -0,0 +1,108 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/iniconf.h
// Purpose: INI-file based wxConfigBase implementation
// Author: Vadim Zeitlin
// Created: 27.07.98
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_INICONF_H_
#define _WX_MSW_INICONF_H_
#include "wx/defs.h"
#if wxUSE_CONFIG && wxUSE_INICONF
// ----------------------------------------------------------------------------
// wxIniConfig is a wxConfig implementation which uses MS Windows INI files to
// store the data. Because INI files don't really support arbitrary nesting of
// groups, we do the following:
// (1) in win.ini file we store all entries in the [vendor] section and
// the value group1/group2/key is mapped to the value group1_group2_key
// in this section, i.e. all path separators are replaced with underscore
// (2) in appname.ini file we map group1/group2/group3/key to the entry
// group2_group3_key in [group1]
//
// Of course, it might lead to indesirable results if '_' is also used in key
// names (i.e. group/key is the same as group_key) and also GetPath() result
// may be not what you would expect it to be.
//
// Another limitation: the keys and section names are never case-sensitive
// which might differ from wxFileConfig it it was compiled with
// wxCONFIG_CASE_SENSITIVE option.
// ----------------------------------------------------------------------------
// for this class, "local" file is the file appname.ini and the global file
// is the [vendor] subsection of win.ini (default for "vendor" is to be the
// same as appname). The file name (strAppName parameter) may, in fact,
// contain the full path to the file. If it doesn't, the file is searched for
// in the Windows directory.
class WXDLLIMPEXP_CORE wxIniConfig : public wxConfigBase
{
public:
// ctor & dtor
// if strAppName doesn't contain the extension and is not an absolute path,
// ".ini" is appended to it. if strVendor is empty, it's taken to be the
// same as strAppName.
wxIniConfig(const wxString& strAppName = wxEmptyString, const wxString& strVendor = wxEmptyString,
const wxString& localFilename = wxEmptyString, const wxString& globalFilename = wxEmptyString, long style = wxCONFIG_USE_LOCAL_FILE);
virtual ~wxIniConfig();
// implement inherited pure virtual functions
virtual void SetPath(const wxString& strPath) override;
virtual const wxString& GetPath() const override;
virtual bool GetFirstGroup(wxString& str, long& lIndex) const override;
virtual bool GetNextGroup (wxString& str, long& lIndex) const override;
virtual bool GetFirstEntry(wxString& str, long& lIndex) const override;
virtual bool GetNextEntry (wxString& str, long& lIndex) const override;
virtual size_t GetNumberOfEntries(bool bRecursive = false) const override;
virtual size_t GetNumberOfGroups(bool bRecursive = false) const override;
virtual bool HasGroup(const wxString& strName) const override;
virtual bool HasEntry(const wxString& strName) const override;
// return true if the current group is empty
bool IsEmpty() const;
virtual bool Flush(bool bCurrentOnly = false) override;
virtual bool RenameEntry(const wxString& oldName, const wxString& newName) override;
virtual bool RenameGroup(const wxString& oldName, const wxString& newName) override;
virtual bool DeleteEntry(const wxString& Key, bool bGroupIfEmptyAlso = true) override;
virtual bool DeleteGroup(const wxString& szKey) override;
virtual bool DeleteAll() override;
protected:
// read/write
bool DoReadString(const wxString& key, wxString *pStr) const override;
bool DoReadLong(const wxString& key, long *plResult) const override;
#if wxUSE_BASE64
bool DoReadBinary(const wxString& key, wxMemoryBuffer *buf) const override;
#endif // wxUSE_BASE64
bool DoWriteString(const wxString& key, const wxString& szValue) override;
bool DoWriteLong(const wxString& key, long lValue) override;
#if wxUSE_BASE64
bool DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf) override;
#endif // wxUSE_BASE64
private:
// helpers
wxString GetPrivateKeyName(const wxString& szKey) const;
wxString GetKeyName(const wxString& szKey) const;
wxString m_strLocalFilename; // name of the private INI file
wxString m_strGroup, // current group in appname.ini file
m_strPath; // the rest of the path (no trailing '_'!)
wxDECLARE_NO_COPY_CLASS(wxIniConfig);
wxDECLARE_ABSTRACT_CLASS(wxIniConfig);
};
#endif // wxUSE_CONFIG && wxUSE_INICONF
#endif // _WX_MSW_INICONF_H_

View File

@@ -0,0 +1,62 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/init.h
// Purpose: Windows-specific wxEntry() overload
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_INIT_H_
#define _WX_MSW_INIT_H_
// ----------------------------------------------------------------------------
// Windows-specific wxEntry() overload and wxIMPLEMENT_WXWIN_MAIN definition
// ----------------------------------------------------------------------------
// wxEntry() overload using the command line for the current process, instead
// of argc/argv provided by the CRT. This is only really useful when using
// Unicode with a compiler not providing wmain() or similar entry point, but is
// always provided for consistency.
extern int WXDLLIMPEXP_BASE wxEntry();
#if wxUSE_GUI
// we need HINSTANCE declaration to define WinMain()
#include "wx/msw/wrapwin.h"
#ifndef SW_SHOWNORMAL
#define SW_SHOWNORMAL 1
#endif
// WinMain() is always ANSI, even in Unicode build.
typedef char *wxCmdLineArgType;
// Windows-only overloads of wxEntry() and wxEntryStart() which take the
// parameters passed to WinMain() instead of those passed to main()
extern WXDLLIMPEXP_CORE bool
wxEntryStart(HINSTANCE hInstance,
HINSTANCE hPrevInstance = nullptr,
wxCmdLineArgType pCmdLine = nullptr,
int nCmdShow = SW_SHOWNORMAL);
extern WXDLLIMPEXP_CORE int
wxEntry(HINSTANCE hInstance,
HINSTANCE hPrevInstance = nullptr,
wxCmdLineArgType pCmdLine = nullptr,
int nCmdShow = SW_SHOWNORMAL);
#define wxIMPLEMENT_WXWIN_MAIN \
extern "C" int WINAPI WinMain(HINSTANCE hInstance, \
HINSTANCE hPrevInstance, \
wxCmdLineArgType lpCmdLine, \
int nCmdShow) \
{ \
wxDISABLE_DEBUG_SUPPORT(); \
\
return wxEntry(hInstance, hPrevInstance, lpCmdLine, nCmdShow); \
}
#endif // wxUSE_GUI
#endif // _WX_MSW_INIT_H_

View File

@@ -0,0 +1,94 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/joystick.h
// Purpose: wxJoystick class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_JOYSTICK_H_
#define _WX_JOYSTICK_H_
#include "wx/event.h"
class wxJoystickThread;
class WXDLLIMPEXP_ADV wxJoystick: public wxObject
{
wxDECLARE_DYNAMIC_CLASS(wxJoystick);
public:
/*
* Public interface
*/
wxJoystick(int joystick = wxJOYSTICK1);
virtual ~wxJoystick();
// Attributes
////////////////////////////////////////////////////////////////////////////
wxPoint GetPosition() const;
int GetPosition(unsigned axis) const;
bool GetButtonState(unsigned button) const;
int GetZPosition() const;
int GetButtonState() const;
int GetPOVPosition() const;
int GetPOVCTSPosition() const;
int GetRudderPosition() const;
int GetUPosition() const;
int GetVPosition() const;
int GetMovementThreshold() const;
void SetMovementThreshold(int threshold) ;
// Capabilities
////////////////////////////////////////////////////////////////////////////
static int GetNumberJoysticks();
bool IsOk() const; // Checks that the joystick is functioning
int GetManufacturerId() const ;
int GetProductId() const ;
wxString GetProductName() const ;
int GetXMin() const;
int GetYMin() const;
int GetZMin() const;
int GetXMax() const;
int GetYMax() const;
int GetZMax() const;
int GetNumberButtons() const;
int GetNumberAxes() const;
int GetMaxButtons() const;
int GetMaxAxes() const;
int GetPollingMin() const;
int GetPollingMax() const;
int GetRudderMin() const;
int GetRudderMax() const;
int GetUMin() const;
int GetUMax() const;
int GetVMin() const;
int GetVMax() const;
bool HasRudder() const;
bool HasZ() const;
bool HasU() const;
bool HasV() const;
bool HasPOV() const;
bool HasPOV4Dir() const;
bool HasPOVCTS() const;
// Operations
////////////////////////////////////////////////////////////////////////////
// pollingFreq = 0 means that movement events are sent when above the threshold.
// If pollingFreq > 0, events are received every this many milliseconds.
bool SetCapture(wxWindow* win, int pollingFreq = 0);
bool ReleaseCapture();
protected:
int m_joystick;
wxJoystickThread* m_thread;
};
#endif
// _WX_JOYSTICK_H_

View File

@@ -0,0 +1,30 @@
/*
* Name: wx/msw/libraries.h
* Purpose: Pragmas for linking libs conditionally
* Author: Michael Wetherell
* Modified by:
* Copyright: (c) 2005 Michael Wetherell
* Licence: wxWindows licence
*/
#ifndef _WX_MSW_LIBRARIES_H_
#define _WX_MSW_LIBRARIES_H_
/*
* Notes:
*
* In general the preferred place to add libs is in the bakefiles. This file
* can be used where libs must be added conditionally, for those compilers that
* support a way to do that.
*/
#if defined __VISUALC__ && wxUSE_ACCESSIBILITY
#pragma comment(lib, "oleacc")
#endif
#if defined __VISUALC__ && wxUSE_UXTHEME
#pragma comment(lib, "uxtheme")
#endif
#endif /* _WX_MSW_LIBRARIES_H_ */

View File

@@ -0,0 +1,218 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/listbox.h
// Purpose: wxListBox class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_LISTBOX_H_
#define _WX_LISTBOX_H_
#if wxUSE_LISTBOX
// ----------------------------------------------------------------------------
// simple types
// ----------------------------------------------------------------------------
#if wxUSE_OWNER_DRAWN
class WXDLLIMPEXP_FWD_CORE wxOwnerDrawn;
// define the array of list box items
#include "wx/dynarray.h"
WX_DEFINE_EXPORTED_ARRAY_PTR(wxOwnerDrawn *, wxListBoxItemsArray);
#endif // wxUSE_OWNER_DRAWN
// forward declaration for GetSelections()
class WXDLLIMPEXP_FWD_BASE wxArrayInt;
// ----------------------------------------------------------------------------
// List box control
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase
{
public:
// ctors and such
wxListBox() { Init(); }
wxListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr))
{
Init();
Create(parent, id, pos, size, n, choices, style, validator, name);
}
wxListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr))
{
Init();
Create(parent, id, pos, size, choices, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
virtual ~wxListBox();
virtual unsigned int GetCount() const override;
virtual wxString GetString(unsigned int n) const override;
virtual void SetString(unsigned int n, const wxString& s) override;
virtual int FindString(const wxString& s, bool bCase = false) const override;
virtual bool IsSelected(int n) const override;
virtual int GetSelection() const override;
virtual int GetSelections(wxArrayInt& aSelections) const override;
// return the index of the item at this position or wxNOT_FOUND
int HitTest(const wxPoint& pt) const { return DoHitTestList(pt); }
int HitTest(wxCoord x, wxCoord y) const { return DoHitTestList(wxPoint(x, y)); }
virtual void EnsureVisible(int n) override;
virtual int GetTopItem() const override;
virtual int GetCountPerPage() const override;
// ownerdrawn wxListBox and wxCheckListBox support
#if wxUSE_OWNER_DRAWN
// override base class virtuals
virtual bool SetFont(const wxFont &font) override;
bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item) override;
bool MSWOnDraw(WXDRAWITEMSTRUCT *item) override;
// plug-in for derived classes
virtual wxOwnerDrawn *CreateLboxItem(size_t n);
// allows to get the item and use SetXXX functions to set it's appearance
wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; }
// get the index of the given item
int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); }
// get rect of the given item index
bool GetItemRect(size_t n, wxRect& rect) const;
// redraw the given item
bool RefreshItem(size_t n);
#endif // wxUSE_OWNER_DRAWN
// Windows-specific code to update the horizontal extent of the listbox, if
// necessary. If s is non-empty, the horizontal extent is increased to the
// length of this string if it's currently too short, otherwise the maximum
// extent of all strings is used. In any case calls InvalidateBestSize()
virtual void SetHorizontalExtent(const wxString& s = wxEmptyString);
// This is a wrapper for LB_SETTABSTOPS message and takes tab stops in
// dialog units, with the same conventions as LB_SETTABSTOPS uses.
virtual bool MSWSetTabStops(const wxVector<int>& tabStops);
// Windows callbacks
bool MSWCommand(WXUINT param, WXWORD id) override;
WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const override;
// under XP when using "transition effect for menus and tooltips" if we
// return true for WM_PRINTCLIENT here then it causes noticeable slowdown
virtual bool MSWShouldPropagatePrintChild() override
{
return false;
}
virtual wxVisualAttributes GetDefaultAttributes() const override
{
return GetClassDefaultAttributes(GetWindowVariant());
}
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL)
{
return GetCompositeControlsDefaultAttributes(variant);
}
// returns true if the platform should explicitly apply a theme border
virtual bool CanApplyThemeBorder() const override { return false; }
virtual void OnInternalIdle() override;
protected:
virtual wxSize DoGetBestClientSize() const override;
virtual void DoClear() override;
virtual void DoDeleteOneItem(unsigned int n) override;
virtual void DoSetSelection(int n, bool select) override;
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
unsigned int pos,
void **clientData, wxClientDataType type) override;
virtual void DoSetFirstItem(int n) override;
virtual void DoSetItemClientData(unsigned int n, void* clientData) override;
virtual void* DoGetItemClientData(unsigned int n) const override;
// this can't be called DoHitTest() because wxWindow already has this method
virtual int DoHitTestList(const wxPoint& point) const;
// This is a hook for wxCheckListBox, which uses it to add the checkbox
// width to the item width and to make it at least as tall as the checkbox.
virtual wxSize MSWGetFullItemSize(int w, int h) const
{
return wxSize(w, h);
}
virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) override;
// free memory (common part of Clear() and dtor)
void Free();
unsigned int m_noItems;
#if wxUSE_OWNER_DRAWN
// control items
wxListBoxItemsArray m_aItems;
#endif
private:
// common part of all ctors
void Init();
// call this when items are added to or deleted from the listbox or an
// items text changes
void MSWOnItemsChanged();
// flag indicating whether the max horizontal extent should be updated,
// i.e. if we need to call SetHorizontalExtent() from OnInternalIdle()
bool m_updateHorizontalExtent;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxListBox);
};
#endif // wxUSE_LISTBOX
#endif
// _WX_LISTBOX_H_

View File

@@ -0,0 +1,473 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/listctrl.h
// Purpose: wxListCtrl class
// Author: Julian Smart
// Modified by: Agron Selimaj
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_LISTCTRL_H_
#define _WX_LISTCTRL_H_
#include "wx/textctrl.h"
#include "wx/dynarray.h"
#include "wx/vector.h"
class wxMSWListItemData;
class wxMSWHeaderCtrlCustomDraw;
// define this symbol to indicate the availability of SetColumnsOrder() and
// related functions
#define wxHAS_LISTCTRL_COLUMN_ORDER
/*
The wxListCtrl can show lists of items in four different modes:
wxLC_LIST: multicolumn list view, with optional small icons (icons could be
optional for some platforms). Columns are computed automatically,
i.e. you don't set columns as in wxLC_REPORT. In other words,
the list wraps, unlike a wxListBox.
wxLC_REPORT: single or multicolumn report view (with optional header)
wxLC_ICON: large icon view, with optional labels
wxLC_SMALL_ICON: small icon view, with optional labels
You can change the style dynamically, either with SetSingleStyle or
SetWindowStyleFlag.
Further window styles:
wxLC_ALIGN_TOP icons align to the top (default)
wxLC_ALIGN_LEFT icons align to the left
wxLC_AUTOARRANGE icons arrange themselves
wxLC_USER_TEXT the app provides label text on demand, except for column headers
wxLC_EDIT_LABELS labels are editable: app will be notified.
wxLC_NO_HEADER no header in report mode
wxLC_NO_SORT_HEADER can't click on header
wxLC_SINGLE_SEL single selection
wxLC_SORT_ASCENDING sort ascending (must still supply a comparison callback in SortItems)
wxLC_SORT_DESCENDING sort descending (ditto)
Items are referred to by their index (position in the list starting from zero).
Label text is supplied via insertion/setting functions and is stored by the
control, unless the wxLC_USER_TEXT style has been specified, in which case
the app will be notified when text is required (see sample).
Images are dealt with by (optionally) associating 3 image lists with the control.
Zero-based indexes into these image lists indicate which image is to be used for
which item. Each image in an image list can contain a mask, and can be made out
of either a bitmap, two bitmaps or an icon. See ImagList.h for more details.
Notifications are passed via the event system.
See the sample wxListCtrl app for API usage.
TODO:
- addition of further convenience functions
to avoid use of wxListItem in some functions
- state/overlay images: probably not needed.
- testing of whole API, extending current sample.
*/
class WXDLLIMPEXP_CORE wxListCtrl: public wxListCtrlBase
{
public:
/*
* Public interface
*/
wxListCtrl() { Init(); }
wxListCtrl(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxLC_ICON,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListCtrlNameStr))
{
Init();
Create(parent, id, pos, size, style, validator, name);
}
virtual ~wxListCtrl();
bool Create(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxLC_ICON,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListCtrlNameStr));
// Attributes
////////////////////////////////////////////////////////////////////////////
// Set the control colours
bool SetForegroundColour(const wxColour& col) override;
bool SetBackgroundColour(const wxColour& col) override;
// Header attributes
virtual bool SetHeaderAttr(const wxItemAttr& attr) override;
// Gets information about this column
bool GetColumn(int col, wxListItem& item) const override;
// Sets information about this column
bool SetColumn(int col, const wxListItem& item) override;
// Gets the column width
int GetColumnWidth(int col) const override;
// Sets the column width
bool SetColumnWidth(int col, int width) override;
// Gets the column order from its index or index from its order
int GetColumnOrder(int col) const override;
int GetColumnIndexFromOrder(int order) const override;
// Gets the column order for all columns
wxArrayInt GetColumnsOrder() const override;
// Sets the column order for all columns
bool SetColumnsOrder(const wxArrayInt& orders) override;
// Gets the number of items that can fit vertically in the
// visible area of the list control (list or report view)
// or the total number of items in the list control (icon
// or small icon view)
int GetCountPerPage() const;
// return the total area occupied by all the items (icon/small icon only)
wxRect GetViewRect() const;
// Gets the edit control for editing labels.
wxTextCtrl* GetEditControl() const;
// Gets information about the item
bool GetItem(wxListItem& info) const;
// Check if the item is visible
bool IsVisible(long item) const override;
// Sets information about the item
bool SetItem(wxListItem& info);
// Sets a string field at a particular column
bool SetItem(long index, int col, const wxString& label, int imageId = -1);
// Gets the item state
int GetItemState(long item, long stateMask) const;
// Sets the item state
bool SetItemState(long item, long state, long stateMask);
// Sets the item image
bool SetItemImage(long item, int image, int selImage = -1);
bool SetItemColumnImage(long item, long column, int image);
// Gets the item text
wxString GetItemText(long item, int col = 0) const;
// Sets the item text
void SetItemText(long item, const wxString& str);
// Gets the item data
wxUIntPtr GetItemData(long item) const;
// Sets the item data
bool SetItemPtrData(long item, wxUIntPtr data);
bool SetItemData(long item, long data) { return SetItemPtrData(item, data); }
// Gets the item rectangle
bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const;
// Gets the subitem rectangle in report mode
bool GetSubItemRect(long item, long subItem, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const;
// Gets the item position
bool GetItemPosition(long item, wxPoint& pos) const;
// Sets the item position
bool SetItemPosition(long item, const wxPoint& pos);
// Gets the number of items in the list control
int GetItemCount() const override;
// Gets the number of columns in the list control
int GetColumnCount() const override { return m_colCount; }
// get the horizontal and vertical components of the item spacing
wxSize GetItemSpacing() const;
// Foreground colour of an item.
void SetItemTextColour( long item, const wxColour& col);
wxColour GetItemTextColour( long item ) const;
// Background colour of an item.
void SetItemBackgroundColour( long item, const wxColour &col);
wxColour GetItemBackgroundColour( long item ) const;
// Font of an item.
void SetItemFont( long item, const wxFont &f);
wxFont GetItemFont( long item ) const;
// Checkbox state of an item
bool HasCheckBoxes() const override;
bool EnableCheckBoxes(bool enable = true) override;
bool IsItemChecked(long item) const override;
void CheckItem(long item, bool check) override;
// Sort indicator in header
void ShowSortIndicator(int idx, bool ascending = true) override;
int GetSortIndicator() const override;
bool IsAscendingSortIndicator() const override;
// Gets the number of selected items in the list control
int GetSelectedItemCount() const;
// Gets the text colour of the listview
wxColour GetTextColour() const;
// Sets the text colour of the listview
void SetTextColour(const wxColour& col);
// Gets the index of the topmost visible item when in
// list or report view
long GetTopItem() const;
// Add or remove a single window style
void SetSingleStyle(long style, bool add = true);
// Set the whole window style
void SetWindowStyleFlag(long style) override;
// Searches for an item, starting from 'item'.
// item can be -1 to find the first item that matches the
// specified flags.
// Returns the item or -1 if unsuccessful.
long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const;
// refresh items selectively (only useful for virtual list controls)
void RefreshItem(long item);
void RefreshItems(long itemFrom, long itemTo);
// Operations
////////////////////////////////////////////////////////////////////////////
// Arranges the items
bool Arrange(int flag = wxLIST_ALIGN_DEFAULT);
// Deletes an item
bool DeleteItem(long item);
// Deletes all items
bool DeleteAllItems();
// Deletes a column
bool DeleteColumn(int col) override;
// Deletes all columns
bool DeleteAllColumns() override;
// Clears items, and columns if there are any.
void ClearAll();
// Edit the label
wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl));
// End label editing, optionally cancelling the edit
bool EndEditLabel(bool cancel);
// Ensures this item is visible
bool EnsureVisible(long item);
// Find an item whose label matches this string, starting from the item after 'start'
// or the beginning if 'start' is -1.
long FindItem(long start, const wxString& str, bool partial = false);
// Find an item whose data matches this data, starting from the item after 'start'
// or the beginning if 'start' is -1.
long FindItem(long start, wxUIntPtr data);
// Find an item nearest this position in the specified direction, starting from
// the item after 'start' or the beginning if 'start' is -1.
long FindItem(long start, const wxPoint& pt, int direction);
// Determines which item (if any) is at the specified point,
// giving details in 'flags' (see wxLIST_HITTEST_... flags above)
// Request the subitem number as well at the given coordinate.
long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = nullptr) const;
// Inserts an item, returning the index of the new item if successful,
// -1 otherwise.
long InsertItem(const wxListItem& info);
// Insert a string item
long InsertItem(long index, const wxString& label);
// Insert an image item
long InsertItem(long index, int imageIndex);
// Insert an image/string item
long InsertItem(long index, const wxString& label, int imageIndex);
// set the number of items in a virtual list control
void SetItemCount(long count);
// Scrolls the list control. If in icon, small icon or report view mode,
// x specifies the number of pixels to scroll. If in list view mode, x
// specifies the number of columns to scroll.
// If in icon, small icon or list view mode, y specifies the number of pixels
// to scroll. If in report view mode, y specifies the number of lines to scroll.
bool ScrollList(int dx, int dy);
// Sort items.
// fn is a function which takes 3 long arguments: item1, item2, data.
// item1 is the long data associated with a first item (NOT the index).
// item2 is the long data associated with a second item (NOT the index).
// data is the same value as passed to SortItems.
// The return value is a negative number if the first item should precede the second
// item, a positive number of the second item should precede the first,
// or zero if the two items are equivalent.
// data is arbitrary data to be passed to the sort function.
bool SortItems(wxListCtrlCompare fn, wxIntPtr data);
// IMPLEMENTATION
virtual bool MSWCommand(WXUINT param, WXWORD id) override;
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) override;
virtual bool MSWShouldPreProcessMessage(WXMSG* msg) override;
#if WXWIN_COMPATIBILITY_3_0
// bring the control in sync with current m_windowStyle value
wxDEPRECATED_MSG("useless and will be removed in the future, use SetWindowStyleFlag() instead")
void UpdateStyle();
#endif // WXWIN_COMPATIBILITY_3_0
// Event handlers
////////////////////////////////////////////////////////////////////////////
// Necessary for drawing hrules and vrules, if specified
void OnPaint(wxPaintEvent& event);
// Override SetDoubleBuffered() to do nothing, its implementation in the
// base class is incompatible with the double buffering done by this native
// control.
virtual bool IsDoubleBuffered() const override;
virtual void SetDoubleBuffered(bool on) override;
virtual bool ShouldInheritColours() const override { return false; }
virtual wxVisualAttributes GetDefaultAttributes() const override;
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
// convert our styles to Windows
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const override;
// special Windows message handling
virtual WXLRESULT MSWWindowProc(WXUINT nMsg,
WXWPARAM wParam,
WXLPARAM lParam) override;
protected:
// common part of all ctors
void Init();
virtual bool MSWShouldSetDefaultFont() const override { return false; }
// Implement constrained best size calculation.
virtual int DoGetBestClientHeight(int width) const override
{ return MSWGetBestViewRect(width, -1).y; }
virtual int DoGetBestClientWidth(int height) const override
{ return MSWGetBestViewRect(-1, height).x; }
#if wxUSE_TOOLTIPS
virtual void DoSetToolTip(wxToolTip *tip) override;
#endif // wxUSE_TOOLTIPS
virtual void MSWUpdateFontOnDPIChange(const wxSize& newDPI) override;
virtual bool MSWGetDarkModeSupport(MSWDarkModeSupport& support) const override;
virtual int MSWGetToolTipMessage() const override;
void OnDPIChanged(wxDPIChangedEvent& event);
wxSize MSWGetBestViewRect(int x, int y) const;
// Implement base class pure virtual methods.
long DoInsertColumn(long col, const wxListItem& info) override;
void DoUpdateImages(int which) override;
// free memory taken by all internal data
void FreeAllInternalData();
// get the internal data object for this item (may return nullptr)
wxMSWListItemData *MSWGetItemData(long item) const;
// get the item attribute, either by querying it for virtual control, or by
// returning the one previously set using setter methods for a normal one
wxItemAttr *DoGetItemColumnAttr(long item, long column) const;
wxTextCtrl* m_textCtrl; // The control used for editing a label
int m_colCount; // Windows doesn't have GetColumnCount so must
// keep track of inserted/deleted columns
// all wxMSWListItemData objects we use
wxVector<wxMSWListItemData *> m_internalData;
// true if we have any items with custom attributes
bool m_hasAnyAttr;
// m_sortAsc is only used if m_sortCol != -1
bool m_sortAsc;
int m_sortCol;
private:
// process NM_CUSTOMDRAW notification message
WXLPARAM OnCustomDraw(WXLPARAM lParam);
// set the extended styles for the control (used by Create() and
// UpdateStyle()), only should be called if InReportView()
void MSWSetExListStyles();
// Initialize the header control if it exists.
void MSWInitHeader();
// initialize the (already created) m_textCtrl with the associated HWND
void InitEditControl(WXHWND hWnd);
// destroy m_textCtrl if it's currently valid and reset it to nullptr
void DeleteEditControl();
// Update all image lists that we have.
void UpdateAllImageLists();
// Intercept Escape and Enter keys to avoid them being stolen from our
// in-place editor control.
void OnCharHook(wxKeyEvent& event);
// Draw the sort arrow in the header.
void DrawSortArrow();
// Object using for header custom drawing if necessary, may be null.
wxMSWHeaderCtrlCustomDraw* m_headerCustomDraw;
wxDECLARE_DYNAMIC_CLASS(wxListCtrl);
wxDECLARE_EVENT_TABLE();
wxDECLARE_NO_COPY_CLASS(wxListCtrl);
};
#endif // _WX_LISTCTRL_H_

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

View File

@@ -0,0 +1,280 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/mdi.h
// Purpose: MDI (Multiple Document Interface) classes
// Author: Julian Smart
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
// Created: 01/02/97
// Copyright: (c) 1997 Julian Smart
// (c) 2008 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_MDI_H_
#define _WX_MSW_MDI_H_
#include "wx/frame.h"
class WXDLLIMPEXP_FWD_CORE wxAcceleratorTable;
// ---------------------------------------------------------------------------
// wxMDIParentFrame
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
{
public:
wxMDIParentFrame() { Init(); }
wxMDIParentFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
Init();
Create(parent, id, title, pos, size, style, name);
}
virtual ~wxMDIParentFrame();
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxASCII_STR(wxFrameNameStr));
// override/implement base class [pure] virtual methods
// ----------------------------------------------------
static bool IsTDI() { return false; }
// we don't store the active child in m_currentChild so override this
// function to find it dynamically
virtual wxMDIChildFrame *GetActiveChild() const override;
virtual void Cascade() override;
virtual void Tile(wxOrientation orient = wxHORIZONTAL) override;
virtual void ArrangeIcons() override;
virtual void ActivateNext() override;
virtual void ActivatePrevious() override;
#if wxUSE_MENUS
virtual void SetWindowMenu(wxMenu* menu) override;
virtual void DoMenuUpdates(wxMenu* menu = nullptr) override;
// return the active child menu, if any
virtual WXHMENU MSWGetActiveMenu() const override;
#endif // wxUSE_MENUS
// implementation only from now on
// MDI helpers
// -----------
#if wxUSE_MENUS
// called by wxMDIChildFrame after it was successfully created
virtual void AddMDIChild(wxMDIChildFrame *child);
// called by wxMDIChildFrame just before it is destroyed
virtual void RemoveMDIChild(wxMDIChildFrame *child);
#endif // wxUSE_MENUS
// Retrieve the current window menu label: it can be different from
// "Window" when using non-English translations and can also be different
// from wxGetTranslation("Window") if the locale has changed since the
// "Window" menu was added.
const wxString& MSWGetCurrentWindowMenuLabel() const
{ return m_currentWindowMenuLabel; }
// handlers
// --------
// Responds to colour changes
void OnSysColourChanged(wxSysColourChangedEvent& event);
void OnActivate(wxActivateEvent& event);
void OnSize(wxSizeEvent& event);
void OnIconized(wxIconizeEvent& event);
bool HandleActivate(int state, bool minimized, WXHWND activate);
// override window proc for MDI-specific message processing
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) override;
virtual WXLRESULT MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM) override;
virtual bool MSWTranslateMessage(WXMSG* msg) override;
#if wxUSE_MENUS
// override the menu-relayed methods to also look in the active child menu
// bar and the "Window" menu
virtual wxMenuItem *FindItemInMenuBar(int menuId) const override;
virtual wxMenu* MSWFindMenuFromHMENU(WXHMENU hMenu) override;
#endif // wxUSE_MENUS
protected:
#if wxUSE_MENUS_NATIVE
virtual void InternalSetMenuBar() override;
#endif // wxUSE_MENUS_NATIVE
virtual WXHICON GetDefaultIcon() const override;
// set the size of the MDI client window to match the frame size
void UpdateClientSize();
private:
// common part of all ctors
void Init();
#if wxUSE_MENUS
// "Window" menu commands event handlers
void OnMDICommand(wxCommandEvent& event);
void OnMDIChild(wxCommandEvent& event);
// add/remove window menu if we have it (i.e. m_windowMenu != nullptr)
void AddWindowMenu();
void RemoveWindowMenu();
// update the window menu (if we have it) to enable or disable the commands
// which only make sense when we have more than one child
void UpdateWindowMenu(bool enable);
#if wxUSE_ACCEL
wxAcceleratorTable *m_accelWindowMenu;
#endif // wxUSE_ACCEL
#endif // wxUSE_MENUS
// return the number of child frames we currently have (maybe 0)
int GetChildFramesCount() const;
// if true, indicates whether the event wasn't really processed even though
// it was "handled", see OnActivate() and HandleActivate()
bool m_activationNotHandled;
// holds the current translation for the window menu label
wxString m_currentWindowMenuLabel;
friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
wxDECLARE_EVENT_TABLE();
wxDECLARE_DYNAMIC_CLASS(wxMDIParentFrame);
wxDECLARE_NO_COPY_CLASS(wxMDIParentFrame);
};
// ---------------------------------------------------------------------------
// wxMDIChildFrame
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxMDIChildFrameBase
{
public:
wxMDIChildFrame() { Init(); }
wxMDIChildFrame(wxMDIParentFrame *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
Init();
Create(parent, id, title, pos, size, style, name);
}
bool Create(wxMDIParentFrame *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxASCII_STR(wxFrameNameStr));
virtual ~wxMDIChildFrame();
// implement MDI operations
virtual void Activate() override;
// Override some frame operations too
virtual void Maximize(bool maximize = true) override;
virtual void Restore() override;
virtual bool Show(bool show = true) override;
// Implementation only from now on
// -------------------------------
// Handlers
bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
bool HandleWindowPosChanging(void *lpPos);
bool HandleGetMinMaxInfo(void *mmInfo);
virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) override;
virtual WXLRESULT MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) override;
virtual bool MSWTranslateMessage(WXMSG *msg) override;
virtual void MSWDestroyWindow() override;
bool ResetWindowStyle(void *vrect);
void OnIdle(wxIdleEvent& event);
protected:
virtual void DoGetScreenPosition(int *x, int *y) const override;
virtual void DoGetPosition(int *x, int *y) const override;
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags) override;
virtual void DoSetClientSize(int width, int height) override;
virtual void InternalSetMenuBar() override;
virtual bool IsMDIChild() const override { return true; }
virtual void DetachMenuBar() override;
virtual WXHICON GetDefaultIcon() const override;
// common part of all ctors
void Init();
private:
bool m_needsResize; // flag which tells us to artificially resize the frame
wxDECLARE_EVENT_TABLE();
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame);
};
// ---------------------------------------------------------------------------
// wxMDIClientWindow
// ---------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
{
public:
wxMDIClientWindow() { Init(); }
// Note: this is virtual, to allow overridden behaviour.
virtual bool CreateClient(wxMDIParentFrame *parent,
long style = wxVSCROLL | wxHSCROLL) override;
// Explicitly call default scroll behaviour
void OnScroll(wxScrollEvent& event);
protected:
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO) override;
void Init() { m_scrollX = m_scrollY = 0; }
int m_scrollX, m_scrollY;
private:
wxDECLARE_EVENT_TABLE();
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow);
};
#endif // _WX_MSW_MDI_H_

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,235 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/menu.h
// Purpose: wxMenu, wxMenuBar classes
// Author: Julian Smart
// Modified by: Vadim Zeitlin (wxMenuItem is now in separate file)
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MENU_H_
#define _WX_MENU_H_
#if wxUSE_ACCEL
#include "wx/accel.h"
#include "wx/dynarray.h"
WX_DEFINE_EXPORTED_ARRAY_PTR(wxAcceleratorEntry *, wxAcceleratorArray);
#endif // wxUSE_ACCEL
class WXDLLIMPEXP_FWD_CORE wxFrame;
class wxMenuRadioItemsData;
#include "wx/arrstr.h"
// ----------------------------------------------------------------------------
// Menu
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase
{
public:
// ctors & dtor
wxMenu(const wxString& title, long style = 0)
: wxMenuBase(title, style) { Init(); }
wxMenu(long style = 0) : wxMenuBase(style) { Init(); }
virtual ~wxMenu();
virtual void Break() override;
virtual void SetTitle(const wxString& title) override;
// MSW-only methods
// ----------------
// Create a new menu from the given native HMENU. Takes ownership of the
// menu handle and will delete it when this object is destroyed.
static wxMenu *MSWNewFromHMENU(WXHMENU hMenu) { return new wxMenu(hMenu); }
// Detaches HMENU so that it isn't deleted when this object is destroyed.
// Don't use this object after calling this method.
WXHMENU MSWDetachHMENU() { WXHMENU m = m_hMenu; m_hMenu = nullptr; return m; }
// Process WM_COMMAND.
virtual bool MSWCommand(WXUINT param, WXWORD id);
// implementation only from now on
// -------------------------------
// get the native menu handle
WXHMENU GetHMenu() const { return m_hMenu; }
// Return the start and end position of the radio group to which the item
// at the given position belongs. Returns false if there is no radio group
// containing this position.
bool MSWGetRadioGroupRange(int pos, int *start, int *end) const;
void SetupBitmaps();
#if wxUSE_ACCEL
// called by wxMenuBar to build its accel table from the accels of all menus
bool HasAccels() const { return !m_accels.empty(); }
size_t GetAccelCount() const { return m_accels.size(); }
size_t CopyAccels(wxAcceleratorEntry *accels) const;
// called by wxMenuItem when its accels changes
void UpdateAccel(wxMenuItem *item);
void RemoveAccel(wxMenuItem *item);
// helper used by wxMenu itself (returns the index in m_accels)
int FindAccel(int id) const;
// used only by wxMDIParentFrame currently but could be useful elsewhere:
// returns a new accelerator table with accelerators for just this menu
// (shouldn't be called if we don't have any accelerators)
wxAcceleratorTable *CreateAccelTable() const;
#endif // wxUSE_ACCEL
// get the menu with given handle (recursively)
wxMenu* MSWGetMenu(WXHMENU hMenu);
#if wxUSE_OWNER_DRAWN
int GetMaxAccelWidth()
{
if (m_maxAccelWidth == -1)
CalculateMaxAccelWidth();
return m_maxAccelWidth;
}
void ResetMaxAccelWidth()
{
m_maxAccelWidth = -1;
}
private:
void CalculateMaxAccelWidth();
#endif // wxUSE_OWNER_DRAWN
protected:
virtual wxMenuItem* DoAppend(wxMenuItem *item) override;
virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item) override;
virtual wxMenuItem* DoRemove(wxMenuItem *item) override;
private:
// This constructor is private, use MSWNewFromHMENU() to use it.
wxMenu(WXHMENU hMenu);
// Common part of all ctors, it doesn't create a new HMENU.
void InitNoCreate();
// Common part of all ctors except of the one above taking a native menu
// handler: calls InitNoCreate() and also creates a new menu.
void Init();
// common part of Append/Insert (behaves as Append is pos == (size_t)-1)
bool DoInsertOrAppend(wxMenuItem *item, size_t pos = (size_t)-1);
// This variable contains the description of the radio item groups and
// allows to find whether an item at the given position is part of the
// group and also where its group starts and ends.
//
// It is initially nullptr and only allocated if we have any radio items.
wxMenuRadioItemsData *m_radioData;
// if true, insert a break before appending the next item
bool m_doBreak;
// the menu handle of this menu
WXHMENU m_hMenu;
#if wxUSE_ACCEL
// the accelerators for our menu items
wxAcceleratorArray m_accels;
#endif // wxUSE_ACCEL
#if wxUSE_OWNER_DRAWN
// true if the menu has any ownerdrawn items
bool m_ownerDrawn;
// the max width of menu items bitmaps
int m_maxBitmapWidth;
// the max width of menu items accels
int m_maxAccelWidth;
#endif // wxUSE_OWNER_DRAWN
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMenu);
};
// ----------------------------------------------------------------------------
// Menu Bar (a la Windows)
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMenuBar : public wxMenuBarBase
{
public:
// ctors & dtor
// default constructor
wxMenuBar();
// unused under MSW
wxMenuBar(long style);
// menubar takes ownership of the menus arrays but copies the titles
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
virtual ~wxMenuBar();
// menubar construction
virtual bool Append( wxMenu *menu, const wxString &title ) override;
virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title) override;
virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title) override;
virtual wxMenu *Remove(size_t pos) override;
virtual void EnableTop( size_t pos, bool flag ) override;
virtual bool IsEnabledTop(size_t pos) const override;
virtual void SetMenuLabel( size_t pos, const wxString& label ) override;
virtual wxString GetMenuLabel( size_t pos ) const override;
// implementation from now on
WXHMENU Create();
virtual void Detach() override;
virtual void Attach(wxFrame *frame) override;
#if wxUSE_ACCEL
// update the accel table (must be called after adding/deleting a menu)
void RebuildAccelTable();
#endif // wxUSE_ACCEL
// get the menu handle
WXHMENU GetHMenu() const { return m_hMenu; }
// if the menubar is modified, the display is not updated automatically,
// call this function to update it (m_menuBarFrame should be non-null)
void Refresh();
// To avoid compile warning
void Refresh( bool eraseBackground,
const wxRect *rect = nullptr ) override { wxWindow::Refresh(eraseBackground, rect); }
// Get a top level menu position or wxNOT_FOUND from its handle.
int MSWGetTopMenuPos(WXHMENU hMenu) const;
// Get a top level or sub menu with given handle (recursively).
wxMenu* MSWGetMenu(WXHMENU hMenu) const;
protected:
// common part of all ctors
void Init();
WXHMENU m_hMenu;
// Return the MSW position for a wxMenu which is sometimes different from
// the wxWidgets position.
int MSWPositionForWxMenu(wxMenu *menu, int wxpos);
private:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuBar);
};
#endif // _WX_MENU_H_

View File

@@ -0,0 +1,160 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/menuitem.h
// Purpose: wxMenuItem class
// Author: Vadim Zeitlin
// Created: 11.11.97
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _MENUITEM_H
#define _MENUITEM_H
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#if wxUSE_OWNER_DRAWN
#include "wx/ownerdrw.h"
struct tagRECT;
#endif
// ----------------------------------------------------------------------------
// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase
#if wxUSE_OWNER_DRAWN
, public wxOwnerDrawn
#endif
{
public:
// ctor & dtor
wxMenuItem(wxMenu *parentMenu = nullptr,
int id = wxID_SEPARATOR,
const wxString& name = wxEmptyString,
const wxString& help = wxEmptyString,
wxItemKind kind = wxITEM_NORMAL,
wxMenu *subMenu = nullptr);
virtual ~wxMenuItem();
// override base class virtuals
virtual void SetItemLabel(const wxString& strName) override;
virtual void Enable(bool bDoEnable = true) override;
virtual void Check(bool bDoCheck = true) override;
virtual bool IsChecked() const override;
// unfortunately needed to resolve ambiguity between
// wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable()
bool IsCheckable() const { return wxMenuItemBase::IsCheckable(); }
// the id for a popup menu is really its menu handle (as required by
// ::AppendMenu() API), so this function will return either the id or the
// menu handle depending on what we are
//
// notice that it also returns the id as an unsigned int, as required by
// Win32 API
WXWPARAM GetMSWId() const;
void SetBitmaps(const wxBitmapBundle& bmpChecked,
const wxBitmapBundle& bmpUnchecked = wxNullBitmap)
{
DoSetBitmap(bmpChecked, true);
DoSetBitmap(bmpUnchecked, false);
}
virtual void SetBitmap(const wxBitmapBundle& bmp) override
{
DoSetBitmap(bmp, true);
}
virtual wxBitmap GetBitmap() const override
{
return GetBitmap(true);
}
void SetupBitmaps();
// The functions taking bChecked are wxMSW-specific.
void SetBitmap(const wxBitmapBundle& bmp, bool bChecked)
{
DoSetBitmap(bmp, bChecked);
}
wxBitmap GetBitmap(bool bChecked) const;
#if wxUSE_OWNER_DRAWN
void SetDisabledBitmap(const wxBitmapBundle& bmpDisabled)
{
m_bmpDisabled = bmpDisabled;
SetOwnerDrawn(true);
}
wxBitmap GetDisabledBitmap() const;
int MeasureAccelWidth() const;
// override wxOwnerDrawn base class virtuals
virtual wxString GetName() const override;
virtual bool OnMeasureItem(size_t *pwidth, size_t *pheight) override;
virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat) override;
protected:
virtual void GetFontToUse(wxFont& font) const override;
virtual void GetColourToUse(wxODStatus stat, wxColour& colText, wxColour& colBack) const override;
private:
// helper function for draw std menu check mark
void DrawStdCheckMark(WXHDC hdc, const tagRECT* rc, wxODStatus stat);
// helper function to determine if the item must be owner-drawn
bool MSWMustUseOwnerDrawn();
#endif // wxUSE_OWNER_DRAWN
enum BitmapKind
{
Normal,
Checked,
Unchecked
};
// helper function to get a handle for bitmap associated with item
WXHBITMAP GetHBitmapForMenu(BitmapKind kind) const;
// helper function to set/change the bitmap
void DoSetBitmap(const wxBitmapBundle& bmp, bool bChecked);
private:
// common part of all ctors
void Init();
// Return the item position in the menu containing it.
//
// Returns -1 if the item is not attached to a menu or if we can't find its
// position (which is not really supposed to ever happen).
int MSGetMenuItemPos() const;
// Get the extent of the given text using the correct font.
wxSize GetMenuTextExtent(const wxString& text) const;
// item bitmaps
wxBitmapBundle m_bmpUnchecked; // (used only for checkable items)
#if wxUSE_OWNER_DRAWN
wxBitmapBundle m_bmpDisabled;
#endif // wxUSE_OWNER_DRAWN
// Bitmaps being currently used: we must store them separately from the
// bundle itself because their HBITMAPs must remain valid as long as
// they're used by Windows.
wxBitmap m_bmpCheckedCurrent,
m_bmpUncheckedCurrent;
// Give wxMenu access to our MSWMustUseOwnerDrawn() and GetHBitmapForMenu().
friend class wxMenu;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem);
};
#endif //_MENUITEM_H

View File

@@ -0,0 +1,189 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/metafile.h
// Purpose: wxMetaFile, wxMetaFileDC and wxMetaFileDataObject classes
// Author: Julian Smart
// Modified by: VZ 07.01.00: implemented wxMetaFileDataObject
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_METAFIILE_H_
#define _WX_METAFIILE_H_
#include "wx/dc.h"
#include "wx/gdiobj.h"
#if wxUSE_DATAOBJ
#include "wx/dataobj.h"
#endif
// ----------------------------------------------------------------------------
// Metafile and metafile device context classes
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxMetafile;
class WXDLLIMPEXP_CORE wxMetafileRefData: public wxGDIRefData
{
public:
wxMetafileRefData();
virtual ~wxMetafileRefData();
virtual bool IsOk() const override { return m_metafile != 0; }
public:
WXHANDLE m_metafile;
int m_windowsMappingMode;
int m_width, m_height;
friend class WXDLLIMPEXP_FWD_CORE wxMetafile;
};
#define M_METAFILEDATA ((wxMetafileRefData *)m_refData)
class WXDLLIMPEXP_CORE wxMetafile: public wxGDIObject
{
public:
wxMetafile(const wxString& file = wxEmptyString);
virtual ~wxMetafile();
// After this is called, the metafile cannot be used for anything
// since it is now owned by the clipboard.
virtual bool SetClipboard(int width = 0, int height = 0);
virtual bool Play(wxDC *dc);
// set/get the size of metafile for clipboard operations
wxSize GetSize() const { return wxSize(GetWidth(), GetHeight()); }
int GetWidth() const { return M_METAFILEDATA->m_width; }
int GetHeight() const { return M_METAFILEDATA->m_height; }
void SetWidth(int width) { M_METAFILEDATA->m_width = width; }
void SetHeight(int height) { M_METAFILEDATA->m_height = height; }
// Implementation
WXHANDLE GetHMETAFILE() const { return M_METAFILEDATA->m_metafile; }
void SetHMETAFILE(WXHANDLE mf) ;
int GetWindowsMappingMode() const { return M_METAFILEDATA->m_windowsMappingMode; }
void SetWindowsMappingMode(int mm);
protected:
virtual wxGDIRefData *CreateGDIRefData() const override;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const override;
private:
wxDECLARE_DYNAMIC_CLASS(wxMetafile);
};
class WXDLLIMPEXP_CORE wxMetafileDCImpl: public wxMSWDCImpl
{
public:
wxMetafileDCImpl(wxDC *owner, const wxString& file = wxEmptyString);
wxMetafileDCImpl(wxDC *owner, const wxString& file,
int xext, int yext, int xorg, int yorg);
virtual ~wxMetafileDCImpl();
virtual wxMetafile *Close();
virtual void SetMapMode(wxMappingMode mode) override;
virtual void DoGetTextExtent(const wxString& string,
wxCoord *x, wxCoord *y,
wxCoord *descent = nullptr,
wxCoord *externalLeading = nullptr,
const wxFont *theFont = nullptr) const override;
// Implementation
wxMetafile *GetMetaFile() const { return m_metaFile; }
void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; }
int GetWindowsMappingMode() const { return m_windowsMappingMode; }
void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; }
protected:
virtual void DoGetSize(int *width, int *height) const override;
int m_windowsMappingMode;
wxMetafile* m_metaFile;
private:
wxDECLARE_CLASS(wxMetafileDCImpl);
wxDECLARE_NO_COPY_CLASS(wxMetafileDCImpl);
};
class WXDLLIMPEXP_CORE wxMetafileDC: public wxDC
{
public:
// Don't supply origin and extent
// Supply them to wxMakeMetaFilePlaceable instead.
wxMetafileDC(const wxString& file)
: wxDC(new wxMetafileDCImpl( this, file ))
{ }
// Supply origin and extent (recommended).
// Then don't need to supply them to wxMakeMetaFilePlaceable.
wxMetafileDC(const wxString& file, int xext, int yext, int xorg, int yorg)
: wxDC(new wxMetafileDCImpl( this, file, xext, yext, xorg, yorg ))
{ }
wxMetafile *GetMetafile() const
{ return ((wxMetafileDCImpl*)m_pimpl)->GetMetaFile(); }
wxMetafile *Close()
{ return ((wxMetafileDCImpl*)m_pimpl)->Close(); }
private:
wxDECLARE_CLASS(wxMetafileDC);
wxDECLARE_NO_COPY_CLASS(wxMetafileDC);
};
/*
* Pass filename of existing non-placeable metafile, and bounding box.
* Adds a placeable metafile header, sets the mapping mode to anisotropic,
* and sets the window origin and extent to mimic the wxMM_TEXT mapping mode.
*
*/
// No origin or extent
bool WXDLLIMPEXP_CORE wxMakeMetafilePlaceable(const wxString& filename, float scale = 1.0f);
// Optional origin and extent
bool WXDLLIMPEXP_CORE wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0f, bool useOriginAndExtent = true);
// ----------------------------------------------------------------------------
// wxMetafileDataObject is a specialization of wxDataObject for metafile data
// ----------------------------------------------------------------------------
#if wxUSE_DATAOBJ
class WXDLLIMPEXP_CORE wxMetafileDataObject : public wxDataObjectSimple
{
public:
// ctors
wxMetafileDataObject() : wxDataObjectSimple(wxDF_METAFILE)
{ }
wxMetafileDataObject(const wxMetafile& metafile)
: wxDataObjectSimple(wxDF_METAFILE), m_metafile(metafile) { }
// virtual functions which you may override if you want to provide data on
// demand only - otherwise, the trivial default versions will be used
virtual void SetMetafile(const wxMetafile& metafile)
{ m_metafile = metafile; }
virtual wxMetafile GetMetafile() const
{ return m_metafile; }
// implement base class pure virtuals
virtual size_t GetDataSize() const override;
virtual bool GetDataHere(void *buf) const override;
virtual bool SetData(size_t len, const void *buf) override;
protected:
wxMetafile m_metafile;
};
#endif // wxUSE_DATAOBJ
#endif
// _WX_METAFIILE_H_

View File

@@ -0,0 +1,196 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/mfc.h
// Purpose: Helpers for applications using both wxWidgets and MFC
// Author: Julian Smart, Vadim Zeitlin
// Created: 2017-12-01 (mostly extracted from samples/mfc)
// Copyright: (c) 2017 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_MFC_H_
#define _WX_MSW_MFC_H_
#ifndef __AFXWIN_H__
#error "MFC headers must be included before including this file."
#endif
#include "wx/app.h"
#include "wx/evtloop.h"
#include "wx/window.h"
#include "wx/msw/winundef.h"
// ----------------------------------------------------------------------------
// MFC window class wrapping a window created by wxWidgets
// ----------------------------------------------------------------------------
class wxMFCWnd : public CWnd
{
public:
// If default ctor is used, Attach() must be called later.
wxMFCWnd()
{
}
// Combines default ctor and Attach().
explicit wxMFCWnd(wxWindow* w)
{
Attach(w);
}
void Attach(wxWindow* w)
{
CWnd::Attach(w->GetHWND());
}
~wxMFCWnd()
{
// Prevent MFC from destroying the wxWindow.
Detach();
}
};
// ----------------------------------------------------------------------------
// MFC application class forwarding everything to wxApp
// ----------------------------------------------------------------------------
// The template parameter here is an existing class deriving from CWinApp or,
// if there is no such class, just CWinApp itself.
template <typename T>
class wxMFCApp : public T
{
public:
typedef T BaseApp;
BOOL InitInstance() override
{
if ( !BaseApp::InitInstance() )
return FALSE;
if ( !wxEntryStart(BaseApp::m_hInstance) )
return FALSE;
if ( !wxTheApp || !wxTheApp->CallOnInit() )
return FALSE;
if ( !InitMainWnd() )
return FALSE;
return TRUE;
}
int ExitInstance() override
{
delete BaseApp::m_pMainWnd;
BaseApp::m_pMainWnd = nullptr;
if ( wxTheApp )
wxTheApp->OnExit();
wxEntryCleanup();
return BaseApp::ExitInstance();
}
// Override this to provide messages pre-processing for wxWidgets windows.
BOOL PreTranslateMessage(MSG *msg) override
{
// As reported in issue #23574, wxGUIEventLoop::PreProcessMessage()
// is always returning true, so try BaseApp::PreTranslateMessage()
// and hope it doesn't always report true
if (BaseApp::PreTranslateMessage(msg))
return TRUE;
// Use the current event loop if there is one, or just fall back to the
// standard one otherwise, but make sure we pre-process messages in any
// case as otherwise many things would break (e.g. keyboard
// accelerators).
wxGUIEventLoop*
evtLoop = static_cast<wxGUIEventLoop *>(wxEventLoop::GetActive());
wxGUIEventLoop evtLoopStd;
if ( !evtLoop )
evtLoop = &evtLoopStd;
return evtLoop->PreProcessMessage(msg);
}
BOOL OnIdle(LONG lCount) override
{
BOOL moreIdle = BaseApp::OnIdle(lCount);
if ( wxTheApp )
{
wxTheApp->ProcessPendingEvents();
if ( wxTheApp->ProcessIdle() )
moreIdle = TRUE;
}
return moreIdle;
}
protected:
// This virtual method can be overridden to create the main window using
// MFC code. The default implementation relies on wxApp::OnInit() creating
// a top level window which is then wrapped in an MFC window and used as
// the main window.
virtual BOOL InitMainWnd()
{
wxWindow* const w = wxTheApp->GetTopWindow();
if ( !w )
return FALSE;
// We need to initialize the main window to let the program continue
// running.
BaseApp::m_pMainWnd = new wxMFCWnd(w);
// We also need to reset m_pMainWnd when this window will be destroyed
// to prevent MFC from using an invalid HWND, which is probably not
// fatal but can result in at least asserts failures.
w->Bind(wxEVT_DESTROY, &wxMFCApp::OnMainWindowDestroyed, this);
// And we need to let wxWidgets know that it should exit the
// application when this window is closed, as OnRun(), which does this
// by default, won't be called when using MFC main message loop.
wxTheApp->SetExitOnFrameDelete(true);
return TRUE;
}
private:
void OnMainWindowDestroyed(wxWindowDestroyEvent& event)
{
event.Skip();
delete BaseApp::m_pMainWnd;
BaseApp::m_pMainWnd = nullptr;
}
};
typedef wxMFCApp<CWinApp> wxMFCWinApp;
// ----------------------------------------------------------------------------
// wxWidgets application class to be used in MFC applications
// ----------------------------------------------------------------------------
class wxAppWithMFC : public wxApp
{
public:
void ExitMainLoop() override
{
// There is no wxEventLoop to exit, tell MFC to stop pumping messages
// instead.
::PostQuitMessage(0);
}
void WakeUpIdle() override
{
// As above, we can't wake up any wx event loop, so try to wake up the
// MFC one instead.
CWinApp* const mfcApp = AfxGetApp();
if ( mfcApp && mfcApp->m_pMainWnd )
{
::PostMessage(mfcApp->m_pMainWnd->m_hWnd, WM_NULL, 0, 0);
}
}
};
#endif // _WX_MSW_MFC_H_

View File

@@ -0,0 +1,141 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/mimetype.h
// Purpose: classes and functions to manage MIME types
// Author: Vadim Zeitlin
// Created: 23.09.98
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWidgets licence (part of base library)
/////////////////////////////////////////////////////////////////////////////
#ifndef _MIMETYPE_IMPL_H
#define _MIMETYPE_IMPL_H
#include "wx/defs.h"
#if wxUSE_MIMETYPE
#include "wx/mimetype.h"
// ----------------------------------------------------------------------------
// wxFileTypeImpl is the MSW version of wxFileType, this is a private class
// and is never used directly by the application
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxFileTypeImpl
{
public:
// ctor
wxFileTypeImpl() = default;
// one of these Init() function must be called (ctor can't take any
// arguments because it's common)
// initialize us with our file type name and extension - in this case
// we will read all other data from the registry
void Init(const wxString& strFileType, const wxString& ext);
// implement accessor functions
bool GetExtensions(wxArrayString& extensions);
bool GetMimeType(wxString *mimeType) const;
bool GetMimeTypes(wxArrayString& mimeTypes) const;
bool GetIcon(wxIconLocation *iconLoc) const;
bool GetDescription(wxString *desc) const;
bool GetOpenCommand(wxString *openCmd,
const wxFileType::MessageParameters& params) const
{
*openCmd = GetExpandedCommand(wxS("open"), params);
return !openCmd->empty();
}
bool GetPrintCommand(wxString *printCmd,
const wxFileType::MessageParameters& params) const
{
*printCmd = GetExpandedCommand(wxS("print"), params);
return !printCmd->empty();
}
size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
const wxFileType::MessageParameters& params) const;
bool Unassociate();
// set an arbitrary command, ask confirmation if it already exists and
// overwriteprompt is true
bool SetCommand(const wxString& cmd,
const wxString& verb,
bool overwriteprompt = true);
bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0);
// this is called by Associate
bool SetDescription (const wxString& desc);
// This is called by all our own methods modifying the registry to let the
// Windows Shell know about the changes.
//
// It is also called from Associate() and Unassociate() which suppress the
// internally generated notifications using the method below, which is why
// it has to be public.
void MSWNotifyShell();
// Call before/after performing several registry changes in a row to
// temporarily suppress multiple notifications that would be generated for
// them and generate a single one at the end using MSWNotifyShell()
// explicitly.
void MSWSuppressNotifications(bool suppress);
wxString
GetExpandedCommand(const wxString& verb,
const wxFileType::MessageParameters& params) const;
private:
// helper function: reads the command corresponding to the specified verb
// from the registry (returns an empty string if not found)
wxString GetCommand(const wxString& verb) const;
// get the registry path for the given verb
wxString GetVerbPath(const wxString& verb) const;
// check that the registry key for our extension exists, create it if it
// doesn't, return false if this failed
bool EnsureExtKeyExists();
wxString m_strFileType, // may be empty
m_ext;
bool m_suppressNotify;
// these methods are not publicly accessible (as wxMimeTypesManager
// doesn't know about them), and should only be called by Unassociate
bool RemoveOpenCommand();
bool RemoveCommand(const wxString& verb);
bool RemoveMimeType();
bool RemoveDefaultIcon();
bool RemoveDescription();
};
class WXDLLIMPEXP_BASE wxMimeTypesManagerImpl
{
public:
// nothing to do here, we don't load any data but just go and fetch it from
// the registry when asked for
wxMimeTypesManagerImpl() = default;
// implement containing class functions
wxFileType *GetFileTypeFromExtension(const wxString& ext);
wxFileType *GetOrAllocateFileTypeFromExtension(const wxString& ext);
wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
size_t EnumAllFileTypes(wxArrayString& mimetypes);
// create a new filetype association
wxFileType *Associate(const wxFileTypeInfo& ftInfo);
// create a new filetype with the given name and extension
wxFileType *CreateFileType(const wxString& filetype, const wxString& ext);
};
#endif // wxUSE_MIMETYPE
#endif
//_MIMETYPE_IMPL_H

View File

@@ -0,0 +1,50 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/minifram.h
// Purpose: wxMiniFrame class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MINIFRAM_H_
#define _WX_MINIFRAM_H_
#include "wx/frame.h"
class WXDLLIMPEXP_CORE wxMiniFrame : public wxFrame
{
public:
wxMiniFrame() = default;
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER,
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
return wxFrame::Create(parent, id, title, pos, size,
style |
wxFRAME_TOOL_WINDOW |
(parent ? wxFRAME_FLOAT_ON_PARENT : 0), name);
}
wxMiniFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER,
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
Create(parent, id, title, pos, size, style, name);
}
protected:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMiniFrame);
};
#endif
// _WX_MINIFRAM_H_

View File

@@ -0,0 +1,433 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/missing.h
// Purpose: Declarations for parts of the Win32 SDK that are missing in
// the versions that come with some compilers
// Created: 2002/04/23
// Copyright: (c) 2002 Mattia Barbon
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MISSING_H_
#define _WX_MISSING_H_
#ifndef WM_CHANGEUISTATE
#define WM_CHANGEUISTATE 0x0127
#endif
#ifndef WM_UPDATEUISTATE
#define WM_UPDATEUISTATE 0x0128
#endif
#ifndef WM_QUERYUISTATE
#define WM_QUERYUISTATE 0x0129
#endif
#ifndef WM_PRINTCLIENT
#define WM_PRINTCLIENT 0x0318
#endif
#ifndef WM_DPICHANGED
#define WM_DPICHANGED 0x02E0
#endif
#ifndef DT_HIDEPREFIX
#define DT_HIDEPREFIX 0x00100000
#endif
#ifndef DSS_HIDEPREFIX
#define DSS_HIDEPREFIX 0x0200
#endif
// Needed by toplevel.cpp
#ifndef UIS_SET
#define UIS_SET 1
#define UIS_CLEAR 2
#define UIS_INITIALIZE 3
#endif
#ifndef UISF_HIDEFOCUS
#define UISF_HIDEFOCUS 1
#endif
#ifndef UISF_HIDEACCEL
#define UISF_HIDEACCEL 2
#endif
#ifndef OFN_EXPLORER
#define OFN_EXPLORER 0x00080000
#endif
#ifndef OFN_ENABLESIZING
#define OFN_ENABLESIZING 0x00800000
#endif
// Needed by window.cpp
#if wxUSE_MOUSEWHEEL
#ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0x020A
#endif
#ifndef WM_MOUSEHWHEEL
#define WM_MOUSEHWHEEL 0x020E
#endif
#ifndef WHEEL_DELTA
#define WHEEL_DELTA 120
#endif
#ifndef SPI_GETWHEELSCROLLLINES
#define SPI_GETWHEELSCROLLLINES 104
#endif
#ifndef SPI_GETWHEELSCROLLCHARS
#define SPI_GETWHEELSCROLLCHARS 108
#endif
#endif // wxUSE_MOUSEWHEEL
// Needed by window.cpp
#ifndef VK_OEM_1
#define VK_OEM_1 0xBA
#define VK_OEM_2 0xBF
#define VK_OEM_3 0xC0
#define VK_OEM_4 0xDB
#define VK_OEM_5 0xDC
#define VK_OEM_6 0xDD
#define VK_OEM_7 0xDE
#define VK_OEM_102 0xE2
#endif
#ifndef VK_OEM_COMMA
#define VK_OEM_PLUS 0xBB
#define VK_OEM_COMMA 0xBC
#define VK_OEM_MINUS 0xBD
#define VK_OEM_PERIOD 0xBE
#endif
#ifndef SM_TABLETPC
#define SM_TABLETPC 86
#endif
#ifndef INKEDIT_CLASS
# define INKEDIT_CLASSW L"INKEDIT"
# define INKEDIT_CLASS INKEDIT_CLASSW
#endif
#ifndef EM_SETINKINSERTMODE
# define EM_SETINKINSERTMODE (WM_USER + 0x0204)
#endif
#ifndef EM_SETUSEMOUSEFORINPUT
#define EM_SETUSEMOUSEFORINPUT (WM_USER + 0x224)
#endif
#ifndef TPM_RECURSE
#define TPM_RECURSE 1
#endif
#ifndef WS_EX_LAYOUTRTL
#define WS_EX_LAYOUTRTL 0x00400000
#endif
#ifndef WS_EX_COMPOSITED
#define WS_EX_COMPOSITED 0x02000000L
#endif
#ifndef WS_EX_LAYERED
#define WS_EX_LAYERED 0x00080000
#endif
#ifndef LWA_ALPHA
#define LWA_ALPHA 2
#endif
#ifndef QS_ALLPOSTMESSAGE
#define QS_ALLPOSTMESSAGE 0
#endif
// Missing from MinGW 4.8 SDK headers.
#ifndef BS_TYPEMASK
#define BS_TYPEMASK 0xf
#endif
// ----------------------------------------------------------------------------
// menu stuff
// ----------------------------------------------------------------------------
#ifndef MIIM_BITMAP
#define MIIM_STRING 0x00000040
#define MIIM_BITMAP 0x00000080
#define MIIM_FTYPE 0x00000100
#define HBMMENU_CALLBACK ((HBITMAP) -1)
typedef struct tagMENUINFO
{
DWORD cbSize;
DWORD fMask;
DWORD dwStyle;
UINT cyMax;
HBRUSH hbrBack;
DWORD dwContextHelpID;
DWORD dwMenuData;
} MENUINFO, FAR *LPMENUINFO;
#endif // MIIM_BITMAP &c
// ----------------------------------------------------------------------------
// definitions related to ListView and Header common controls, needed by
// msw/listctrl.cpp and msw/headerctrl.cpp
// ----------------------------------------------------------------------------
#ifndef I_IMAGENONE
#define I_IMAGENONE (-2)
#endif
#ifndef LVS_EX_FULLROWSELECT
#define LVS_EX_FULLROWSELECT 0x00000020
#endif
#if !defined(LVS_EX_LABELTIP)
#define LVS_EX_LABELTIP 0x00004000
#endif
#ifndef LVS_EX_SUBITEMIMAGES
#define LVS_EX_SUBITEMIMAGES 0x00000002
#endif
#ifndef LVS_EX_DOUBLEBUFFER
#define LVS_EX_DOUBLEBUFFER 0x00010000
#endif
#ifndef HDN_GETDISPINFOW
#define HDN_GETDISPINFOW (HDN_FIRST-29)
#endif
#ifndef HDS_HOTTRACK
#define HDS_HOTTRACK 4
#endif
#ifndef HDS_FLAT
#define HDS_FLAT 0x0200
#endif
#ifndef HDS_NOSIZING
#define HDS_NOSIZING 0x0800
#endif
#ifndef HDF_SORTUP
#define HDF_SORTUP 0x0400
#define HDF_SORTDOWN 0x0200
#endif
/*
* In addition to the above, the following are required for several compilers.
*/
#if !defined(CCS_VERT)
#define CCS_VERT 0x00000080L
#endif
#if !defined(CCS_RIGHT)
#define CCS_RIGHT (CCS_VERT|CCS_BOTTOM)
#endif
#if !defined(TB_SETDISABLEDIMAGELIST)
#define TB_SETDISABLEDIMAGELIST (WM_USER + 54)
#endif // !defined(TB_SETDISABLEDIMAGELIST)
#ifndef HANGUL_CHARSET
#define HANGUL_CHARSET 129
#endif
#ifndef CCM_SETUNICODEFORMAT
#define CCM_SETUNICODEFORMAT 8197
#endif
// ----------------------------------------------------------------------------
// Tree control
// ----------------------------------------------------------------------------
#ifndef TV_FIRST
#define TV_FIRST 0x1100
#endif
#ifndef TVS_EX_DOUBLEBUFFER
#define TVS_EX_DOUBLEBUFFER 0x0004
#endif
#ifndef TVS_FULLROWSELECT
#define TVS_FULLROWSELECT 0x1000
#endif
#ifndef TVM_SETBKCOLOR
#define TVM_SETBKCOLOR (TV_FIRST + 29)
#define TVM_SETTEXTCOLOR (TV_FIRST + 30)
#endif
#ifndef TVM_SETEXTENDEDSTYLE
#define TVM_SETEXTENDEDSTYLE (TV_FIRST + 44)
#define TVM_GETEXTENDEDSTYLE (TV_FIRST + 45)
#endif
// Various defines used by the webview library that are needed by mingw
#ifndef DISPID_COMMANDSTATECHANGE
#define DISPID_COMMANDSTATECHANGE 105
#endif
#ifndef DISPID_NAVIGATECOMPLETE2
#define DISPID_NAVIGATECOMPLETE2 252
#endif
#ifndef DISPID_NAVIGATEERROR
#define DISPID_NAVIGATEERROR 271
#endif
#ifndef DISPID_NEWWINDOW3
#define DISPID_NEWWINDOW3 273
#endif
#ifndef INET_E_ERROR_FIRST
#define INET_E_ERROR_FIRST ((long)0x800C0002L)
#endif
#ifndef INET_E_INVALID_URL
#define INET_E_INVALID_URL ((long)0x800C0002L)
#endif
#ifndef INET_E_NO_SESSION
#define INET_E_NO_SESSION ((long)0x800C0003L)
#endif
#ifndef INET_E_CANNOT_CONNECT
#define INET_E_CANNOT_CONNECT ((long)0x800C0004L)
#endif
#ifndef INET_E_RESOURCE_NOT_FOUND
#define INET_E_RESOURCE_NOT_FOUND ((long)0x800C0005L)
#endif
#ifndef INET_E_OBJECT_NOT_FOUND
#define INET_E_OBJECT_NOT_FOUND ((long)0x800C0006L)
#endif
#ifndef INET_E_DATA_NOT_AVAILABLE
#define INET_E_DATA_NOT_AVAILABLE ((long)0x800C0007L)
#endif
#ifndef INET_E_DOWNLOAD_FAILURE
#define INET_E_DOWNLOAD_FAILURE ((long)0x800C0008L)
#endif
#ifndef INET_E_AUTHENTICATION_REQUIRED
#define INET_E_AUTHENTICATION_REQUIRED ((long)0x800C0009L)
#endif
#ifndef INET_E_NO_VALID_MEDIA
#define INET_E_NO_VALID_MEDIA ((long)0x800C000AL)
#endif
#ifndef INET_E_CONNECTION_TIMEOUT
#define INET_E_CONNECTION_TIMEOUT ((long)0x800C000BL)
#endif
#ifndef INET_E_INVALID_REQUEST
#define INET_E_INVALID_REQUEST ((long)0x800C000CL)
#endif
#ifndef INET_E_UNKNOWN_PROTOCOL
#define INET_E_UNKNOWN_PROTOCOL ((long)0x800C000DL)
#endif
#ifndef INET_E_SECURITY_PROBLEM
#define INET_E_SECURITY_PROBLEM ((long)0x800C000EL)
#endif
#ifndef INET_E_CANNOT_LOAD_DATA
#define INET_E_CANNOT_LOAD_DATA ((long)0x800C000FL)
#endif
#ifndef INET_E_CANNOT_INSTANTIATE_OBJECT
#define INET_E_CANNOT_INSTANTIATE_OBJECT ((long)0x800C0010L)
#endif
#ifndef INET_E_QUERYOPTION_UNKNOWN
#define INET_E_QUERYOPTION_UNKNOWN ((long)0x800C0013L)
#endif
#ifndef INET_E_REDIRECT_FAILED
#define INET_E_REDIRECT_FAILED ((long)0x800C0014L)
#endif
#ifndef INET_E_REDIRECT_TO_DIR
#define INET_E_REDIRECT_TO_DIR ((long)0x800C0015L)
#endif
#ifndef INET_E_CANNOT_LOCK_REQUEST
#define INET_E_CANNOT_LOCK_REQUEST ((long)0x800C0016L)
#endif
#ifndef INET_E_USE_EXTEND_BINDING
#define INET_E_USE_EXTEND_BINDING ((long)0x800C0017L)
#endif
#ifndef INET_E_TERMINATED_BIND
#define INET_E_TERMINATED_BIND ((long)0x800C0018L)
#endif
#ifndef INET_E_INVALID_CERTIFICATE
#define INET_E_INVALID_CERTIFICATE ((long)0x800C0019L)
#endif
#ifndef INET_E_CODE_DOWNLOAD_DECLINED
#define INET_E_CODE_DOWNLOAD_DECLINED ((long)0x800C0100L)
#endif
#ifndef INET_E_RESULT_DISPATCHED
#define INET_E_RESULT_DISPATCHED ((long)0x800C0200L)
#endif
#ifndef INET_E_CANNOT_REPLACE_SFP_FILE
#define INET_E_CANNOT_REPLACE_SFP_FILE ((long)0x800C0300L)
#endif
#ifndef INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY
#define INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY ((long)0x800C0500L)
#endif
#ifndef INET_E_CODE_INSTALL_SUPPRESSED
#define INET_E_CODE_INSTALL_SUPPRESSED ((long)0x800C0400L)
#endif
#ifndef MUI_LANGUAGE_NAME
#define MUI_LANGUAGE_NAME 0x8
#endif
#ifndef WDA_NONE
#define WDA_NONE 0x0
#endif
#ifndef WDA_MONITOR
#define WDA_MONITOR 0x1
#endif
#ifndef WDA_EXCLUDEFROMCAPTURE
#define WDA_EXCLUDEFROMCAPTURE 0x11
#endif
/*
* The following are specifically required for Wine
*/
#ifdef __WINE__
#ifndef ENUM_CURRENT_SETTINGS
#define ENUM_CURRENT_SETTINGS ((DWORD)-1)
#endif
#ifndef BROADCAST_QUERY_DENY
#define BROADCAST_QUERY_DENY 1112363332
#endif
#endif // defined __WINE__
#ifndef INVALID_FILE_ATTRIBUTES
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
#endif
#ifndef OFN_FORCESHOWHIDDEN
#define OFN_FORCESHOWHIDDEN 0x10000000
#endif
#endif
// _WX_MISSING_H_

View File

@@ -0,0 +1,73 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/msgdlg.h
// Purpose: wxMessageDialog class
// Author: Julian Smart
// Created: 01/02/97
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSGBOXDLG_H_
#define _WX_MSGBOXDLG_H_
class WXDLLIMPEXP_CORE wxMessageDialog : public wxMessageDialogBase
{
public:
wxMessageDialog(wxWindow *parent,
const wxString& message,
const wxString& caption = wxASCII_STR(wxMessageBoxCaptionStr),
long style = wxOK|wxCENTRE,
const wxPoint& WXUNUSED(pos) = wxDefaultPosition)
: wxMessageDialogBase(parent, message, caption, style)
{
m_hook = nullptr;
}
virtual int ShowModal() override;
virtual long GetEffectiveIcon() const override;
// implementation-specific
// return the font used for the text in the message box
static wxFont GetMessageFont();
protected:
// Override this as task dialogs are always centered on parent.
virtual void DoCentre(int dir) override;
private:
// hook procedure used to adjust the message box beyond what the standard
// MessageBox() function can do for us
static WXLRESULT wxCALLBACK HookFunction(int code, WXWPARAM, WXLPARAM);
static const struct ButtonAccessors
{
int id;
wxString (wxMessageDialog::*getter)() const;
} ms_buttons[];
// replace the static text control with a text control in order to show
// scrollbar (and also, incidentally, allow text selection)
void ReplaceStaticWithEdit();
// adjust the button labels
//
// this is called from HookFunction() and our HWND is valid at this moment
void AdjustButtonLabels();
// offset all buttons starting from the first one given by dx to the right
void OffsetButtonsStartingFrom(int first, int dx);
// used by ShowModal() to display a message box when task dialogs
// aren't available.
int ShowMessageBox();
WXHANDLE m_hook; // HHOOK used to position the message box
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMessageDialog);
};
#endif // _WX_MSGBOXDLG_H_

View File

@@ -0,0 +1,65 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/msvcrt.h
// Purpose: macros to use some non-standard features of MS Visual C++
// C run-time library
// Author: Vadim Zeitlin
// Created: 31.01.1999
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Note that this file globally redefines "new" keyword breaking the use of
// placement new in any code parsed after it. If you run into this problem, the
// solutions are, in order of preference:
//
// 1. Don't include this header at all. Use better tools for memory debugging.
// 2. Predefine __NO_VC_CRTDBG__ before including it (basically the same as 1).
// 3. Do "#undef new" before and "#define new WXDEBUG_NEW" in your own code
// before/after using placement new or before/after including third part
// headers using it.
// the goal of this file is to define wxCrtSetDbgFlag() macro which may be
// used like this:
// wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);
// to turn on memory leak checks for programs compiled with Microsoft Visual
// C++ (5.0+). The macro will not be defined under other compilers or if it
// can't be used with MSVC for whatever reason.
#ifndef _MSW_MSVCRT_H_
#define _MSW_MSVCRT_H_
// use debug CRT functions for memory leak detections in VC++ 5.0+ in debug
// builds
#undef wxUSE_VC_CRTDBG
#if defined(_DEBUG) && defined(__VISUALC__) && !defined(__NO_VC_CRTDBG__)
#define wxUSE_VC_CRTDBG
#endif
#ifdef wxUSE_VC_CRTDBG
// Need to undef new if including crtdbg.h which may redefine new itself
#ifdef new
#undef new
#endif
#include <stdlib.h>
#include <crtdbg.h>
#undef WXDEBUG_NEW
#define WXDEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
// this define works around a bug with inline declarations of new, see
//
// http://support.microsoft.com/kb/q140858/
//
// for the details
#define new WXDEBUG_NEW
#define wxCrtSetDbgFlag(flag) \
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | (flag))
#else // !using VC CRT
#define wxCrtSetDbgFlag(flag)
#endif // wxUSE_VC_CRTDBG
#endif // _MSW_MSVCRT_H_

View File

@@ -0,0 +1,56 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/nonownedwnd.h
// Purpose: wxNonOwnedWindow declaration for wxMSW.
// Author: Vadim Zeitlin
// Created: 2011-10-09
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_NONOWNEDWND_H_
#define _WX_MSW_NONOWNEDWND_H_
class wxNonOwnedWindowShapeImpl;
// ----------------------------------------------------------------------------
// wxNonOwnedWindow
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase
{
public:
wxNonOwnedWindow();
virtual ~wxNonOwnedWindow();
virtual bool Reparent(wxWindowBase* newParent) override;
virtual bool IsThisEnabled() const override;
protected:
virtual bool DoClearShape() override;
virtual bool DoSetRegionShape(const wxRegion& region) override;
#if wxUSE_GRAPHICS_CONTEXT
virtual bool DoSetPathShape(const wxGraphicsPath& path) override;
#endif // wxUSE_GRAPHICS_CONTEXT
virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) override;
private:
bool HandleDPIChange(const wxSize& newDPI, const wxRect& newRect);
#if wxUSE_GRAPHICS_CONTEXT
wxNonOwnedWindowShapeImpl* m_shapeImpl;
#endif // wxUSE_GRAPHICS_CONTEXT
// Keep track of the DPI used in this window. So when per-monitor dpi
// awareness is enabled, both old and new DPI are known for
// wxDPIChangedEvent and wxWindow::MSWUpdateOnDPIChange.
wxSize m_activeDPI;
// This window supports handling per-monitor DPI awareness when the
// application manifest contains <dpiAwareness>PerMonitorV2</dpiAwareness>.
bool m_perMonitorDPIaware;
wxDECLARE_NO_COPY_CLASS(wxNonOwnedWindow);
};
#endif // _WX_MSW_NONOWNEDWND_H_

View File

@@ -0,0 +1,214 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/notebook.h
// Purpose: MSW/GTK compatible notebook (a.k.a. property sheet)
// Author: Robert Roebling
// Modified by: Vadim Zeitlin for Windows version
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _NOTEBOOK_H
#define _NOTEBOOK_H
#if wxUSE_NOTEBOOK
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/control.h"
// ----------------------------------------------------------------------------
// wxNotebook
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase
{
public:
// ctors
// -----
// default for dynamic class
wxNotebook();
// the same arguments as for wxControl (@@@ any special styles?)
wxNotebook(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxASCII_STR(wxNotebookNameStr));
// Create() function
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxASCII_STR(wxNotebookNameStr));
virtual ~wxNotebook();
// accessors
// ---------
// get number of pages in the dialog
virtual size_t GetPageCount() const override;
// set the currently selected page, return the index of the previously
// selected one (or wxNOT_FOUND on error)
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
int SetSelection(size_t nPage) override;
// changes selected page without sending events
int ChangeSelection(size_t nPage) override;
// set/get the title of a page
bool SetPageText(size_t nPage, const wxString& strText) override;
wxString GetPageText(size_t nPage) const override;
// sets/returns item's image index in the current image list
int GetPageImage(size_t nPage) const override;
bool SetPageImage(size_t nPage, int nImage) override;
// currently it's always 1 because wxGTK doesn't support multi-row
// tab controls
int GetRowCount() const override;
// control the appearance of the notebook pages
// set the size (the same for all pages)
void SetPageSize(const wxSize& size) override;
// set the padding between tabs (in pixels)
void SetPadding(const wxSize& padding) override;
// operations
// ----------
// remove all pages
bool DeleteAllPages() override;
// inserts a new page to the notebook (it will be deleted by the notebook,
// don't delete it yourself). If bSelect is true, this page becomes active.
bool InsertPage(size_t nPage,
wxNotebookPage *pPage,
const wxString& strText,
bool bSelect = false,
int imageId = NO_IMAGE) override;
// Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
// style.
void SetTabSize(const wxSize& sz) override;
// Return the position and size of the tab for the given page
wxRect GetTabRect(size_t page) const override;
// hit test
virtual int HitTest(const wxPoint& pt, long *flags = nullptr) const override;
// calculate the size of the notebook from the size of its page
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const override;
// callbacks
// ---------
void OnSize(wxSizeEvent& event);
void OnNavigationKey(wxNavigationKeyEvent& event);
// base class virtuals
// -------------------
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) override;
virtual bool MSWOnScroll(int orientation, WXWORD nSBCode,
WXWORD pos, WXHWND control) override;
#if wxUSE_CONSTRAINTS
virtual void SetConstraintSizes(bool recurse = true) override;
virtual bool DoPhase(int nPhase) override;
#endif // wxUSE_CONSTRAINTS
// Attempts to get colour for UX theme page background
wxColour GetThemeBackgroundColour() const override;
// implementation only
// -------------------
virtual bool SetBackgroundColour(const wxColour& colour) override;
#if wxUSE_UXTHEME
// draw child background
virtual bool MSWPrintChild(WXHDC hDC, wxWindow *win) override;
virtual bool MSWHasInheritableBackground() const override { return true; }
#endif // wxUSE_UXTHEME
// translate wxWin styles to the Windows ones
virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = nullptr) const override;
protected:
// common part of all ctors
void Init();
virtual int MSWGetToolTipMessage() const override;
// hides the currently shown page and shows the given one (if not -1) and
// updates m_selection accordingly
void UpdateSelection(int selNew);
// remove one page from the notebook, without deleting
virtual wxNotebookPage *DoRemovePage(size_t nPage) override;
// update the image list used by the native control
virtual void OnImagesChanged() override;
// get the page rectangle for the current notebook size
//
// returns empty rectangle if an error occurs, do test for it
wxRect GetPageSize() const;
// set the size of the given page to fit in the notebook
void AdjustPageSize(wxNotebookPage *page);
#if wxUSE_UXTHEME
virtual void MSWAdjustBrushOrg(int *xOrg, int* yOrg) const override
{
*xOrg -= m_bgBrushAdj.x;
*yOrg -= m_bgBrushAdj.y;
}
// return the themed brush for painting our children
virtual WXHBRUSH MSWGetCustomBgBrush() override { return m_hbrBackground; }
// gets the bitmap of notebook background and returns a brush from it and
// sets m_bgBrushAdj
WXHBRUSH QueryBgBitmap();
// creates the brush to be used for drawing the tab control background
void UpdateBgBrush();
#endif // wxUSE_UXTHEME
// these function are used for reducing flicker on notebook resize
void OnEraseBackground(wxEraseEvent& event);
void OnPaint(wxPaintEvent& event);
// Paint the notebook ourselves on the provided DC.
void MSWNotebookPaint(wxDC& dc);
// true if we have already subclassed our updown control
bool m_hasSubclassedUpdown;
#if wxUSE_UXTHEME
// background brush used to paint the tab control
WXHBRUSH m_hbrBackground;
// offset for MSWAdjustBrushOrg()
wxPoint m_bgBrushAdj;
#endif // wxUSE_UXTHEME
private:
// This function is used instead of TCM_HITTEST for implementing HitTest()
// for the notebooks with horizontal orientation.
//
// It has the same semantics as HitTest().
int MSWHitTestLeftRight(const wxPoint& pt, long *flags) const;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook);
wxDECLARE_EVENT_TABLE();
};
#endif // wxUSE_NOTEBOOK
#endif // _NOTEBOOK_H

View File

@@ -0,0 +1,67 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/ole/access.h
// Purpose: declaration of the wxAccessible class
// Author: Julian Smart
// Created: 2003-02-12
// Copyright: (c) 2003 Julian Smart
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ACCESS_H_
#define _WX_ACCESS_H_
#if wxUSE_ACCESSIBILITY
// ----------------------------------------------------------------------------
// forward declarations
// ----------------------------------------------------------------------------
struct IAccessible;
class wxIAccessible;
class WXDLLIMPEXP_FWD_CORE wxWindow;
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// wxAccessible implements accessibility behaviour.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxAccessible : public wxAccessibleBase
{
public:
wxAccessible(wxWindow *win = nullptr);
virtual ~wxAccessible();
// Overridables
// Accessors
// Returns the wxIAccessible pointer
wxIAccessible* GetIAccessible() { return m_pIAccessible; }
// Returns the IAccessible standard interface pointer
IAccessible* GetIAccessibleStd();
// Operations
// Sends an event when something changes in an accessible object.
static void NotifyEvent(int eventType, wxWindow* window, wxAccObject objectType,
int objectId);
protected:
void Init();
private:
wxIAccessible * m_pIAccessible; // the pointer to COM interface
IAccessible* m_pIAccessibleStd; // the pointer to the standard COM interface,
// for default processing
wxDECLARE_NO_COPY_CLASS(wxAccessible);
};
#endif //wxUSE_ACCESSIBILITY
#endif //_WX_ACCESS_H_

View File

@@ -0,0 +1,254 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/ole/activex.h
// Purpose: wxActiveXContainer class
// Author: Ryan Norton <wxprojects@comcast.net>
// Created: 8/18/05
// Copyright: (c) Ryan Norton
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// Definitions
// ============================================================================
#ifndef _WX_MSW_OLE_ACTIVEXCONTAINER_H_
#define _WX_MSW_OLE_ACTIVEXCONTAINER_H_
#if wxUSE_ACTIVEX
//---------------------------------------------------------------------------
// wx includes
//---------------------------------------------------------------------------
#include "wx/msw/ole/oleutils.h" // wxBasicString &c
#include "wx/msw/ole/uuid.h"
#include "wx/window.h"
#include "wx/variant.h"
class FrameSite;
//---------------------------------------------------------------------------
// MSW COM includes
//---------------------------------------------------------------------------
#include <oleidl.h>
#include <olectl.h>
#include <exdisp.h>
#include <docobj.h>
#ifndef STDMETHOD
#define STDMETHOD(funcname) virtual HRESULT wxSTDCALL funcname
#endif
//
// These defines are from another ole header - but its not in the
// latest sdk. Also the ifndef DISPID_READYSTATE is here because at
// least on my machine with the latest sdk olectl.h defines these 3
//
#ifndef DISPID_READYSTATE
#define DISPID_READYSTATE (-525)
#define DISPID_READYSTATECHANGE (-609)
#define DISPID_AMBIENT_TRANSFERPRIORITY (-728)
#endif
#define DISPID_AMBIENT_OFFLINEIFNOTCONNECTED (-5501)
#define DISPID_AMBIENT_SILENT (-5502)
#ifndef DISPID_AMBIENT_CODEPAGE
#define DISPID_AMBIENT_CODEPAGE (-725)
#define DISPID_AMBIENT_CHARSET (-727)
#endif
//---------------------------------------------------------------------------
//
// wxActiveXContainer
//
//---------------------------------------------------------------------------
template<typename I>
class wxAutoOleInterface
{
public:
typedef I Interface;
explicit wxAutoOleInterface(I *pInterface = nullptr) : m_interface(pInterface)
{}
wxAutoOleInterface(REFIID riid, IUnknown *pUnk) : m_interface(nullptr)
{ QueryInterface(riid, pUnk); }
wxAutoOleInterface(REFIID riid, IDispatch *pDispatch) : m_interface(nullptr)
{ QueryInterface(riid, pDispatch); }
wxAutoOleInterface(REFCLSID clsid, REFIID riid) : m_interface(nullptr)
{ CreateInstance(clsid, riid); }
wxAutoOleInterface(const wxAutoOleInterface& ti) : m_interface(nullptr)
{ operator=(ti); }
wxAutoOleInterface& operator=(const wxAutoOleInterface& ti)
{
if ( ti.m_interface )
ti.m_interface->AddRef();
Free();
m_interface = ti.m_interface;
return *this;
}
wxAutoOleInterface& operator=(I*& ti)
{
Free();
m_interface = ti;
return *this;
}
~wxAutoOleInterface() { Free(); }
void Free()
{
if ( m_interface )
m_interface->Release();
m_interface = nullptr;
}
HRESULT QueryInterface(REFIID riid, IUnknown *pUnk)
{
Free();
wxASSERT(pUnk != nullptr);
return pUnk->QueryInterface(riid, (void **)&m_interface);
}
HRESULT CreateInstance(REFCLSID clsid, REFIID riid)
{
Free();
return CoCreateInstance
(
clsid,
nullptr,
CLSCTX_ALL,
riid,
(void **)&m_interface
);
}
operator I*() const {return m_interface; }
I* operator->() {return m_interface; }
I** GetRef() {return &m_interface; }
bool Ok() const { return IsOk(); }
bool IsOk() const { return m_interface != nullptr; }
protected:
I *m_interface;
};
typedef wxAutoOleInterface<IDispatch> wxAutoIDispatch;
typedef wxAutoOleInterface<IOleClientSite> wxAutoIOleClientSite;
typedef wxAutoOleInterface<IUnknown> wxAutoIUnknown;
typedef wxAutoOleInterface<IOleObject> wxAutoIOleObject;
typedef wxAutoOleInterface<IOleInPlaceObject> wxAutoIOleInPlaceObject;
typedef wxAutoOleInterface<IOleInPlaceActiveObject> wxAutoIOleInPlaceActiveObject;
typedef wxAutoOleInterface<IOleDocumentView> wxAutoIOleDocumentView;
typedef wxAutoOleInterface<IViewObject> wxAutoIViewObject;
class WXDLLIMPEXP_CORE wxActiveXContainer : public wxWindow
{
public:
wxActiveXContainer(wxWindow * parent, REFIID iid, IUnknown* pUnk);
virtual ~wxActiveXContainer();
void OnSize(wxSizeEvent&);
void OnPaint(wxPaintEvent&);
void OnSetFocus(wxFocusEvent&);
void OnKillFocus(wxFocusEvent&);
virtual bool MSWTranslateMessage(WXMSG* pMsg) override;
virtual bool QueryClientSiteInterface(REFIID iid, void **_interface, const char *&desc);
protected:
friend class FrameSite;
friend class wxActiveXEvents;
FrameSite *m_frameSite;
wxAutoIDispatch m_Dispatch;
wxAutoIOleClientSite m_clientSite;
wxAutoIUnknown m_ActiveX;
wxAutoIOleObject m_oleObject;
wxAutoIOleInPlaceObject m_oleInPlaceObject;
wxAutoIOleInPlaceActiveObject m_oleInPlaceActiveObject;
wxAutoIOleDocumentView m_docView;
wxAutoIViewObject m_viewObject;
HWND m_oleObjectHWND;
bool m_bAmbientUserMode;
DWORD m_docAdviseCookie;
wxWindow* m_realparent;
void CreateActiveX(REFIID, IUnknown*);
};
///\brief Store native event parameters.
///\detail Store OLE 'Invoke' parameters for event handlers that need to access them.
/// These are the exact values for the event as they are passed to the wxActiveXContainer.
struct wxActiveXEventNativeMSW
{
DISPID dispIdMember;
REFIID riid;
LCID lcid;
WORD wFlags;
DISPPARAMS *pDispParams;
VARIANT *pVarResult;
EXCEPINFO *pExcepInfo;
unsigned int *puArgErr;
wxActiveXEventNativeMSW
(DISPID a_dispIdMember, REFIID a_riid, LCID a_lcid, WORD a_wFlags, DISPPARAMS *a_pDispParams,
VARIANT *a_pVarResult, EXCEPINFO *a_pExcepInfo, unsigned int *a_puArgErr)
:dispIdMember(a_dispIdMember), riid(a_riid), lcid(a_lcid), wFlags(a_wFlags), pDispParams(a_pDispParams),
pVarResult(a_pVarResult), pExcepInfo(a_pExcepInfo), puArgErr(a_puArgErr)
{ }
};
// Events
class WXDLLIMPEXP_CORE wxActiveXEvent : public wxCommandEvent
{
private:
friend class wxActiveXEvents;
wxVariant m_params;
DISPID m_dispid;
public:
wxNODISCARD virtual wxEvent *Clone() const override
{ return new wxActiveXEvent(*this); }
size_t ParamCount() const;
wxString ParamType(size_t idx) const
{
wxASSERT(idx < ParamCount());
return m_params[idx].GetType();
}
wxString ParamName(size_t idx) const
{
wxASSERT(idx < ParamCount());
return m_params[idx].GetName();
}
wxVariant& operator[] (size_t idx);
DISPID GetDispatchId() const
{ return m_dispid; }
wxActiveXEventNativeMSW *GetNativeParameters() const
{ return (wxActiveXEventNativeMSW*)GetClientData(); }
};
// #define wxACTIVEX_ID 14001
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_ACTIVEX, wxActiveXEvent );
typedef void (wxEvtHandler::*wxActiveXEventFunction)(wxActiveXEvent&);
#define wxActiveXEventHandler(func) \
wxEVENT_HANDLER_CAST( wxActiveXEventFunction, func )
#define EVT_ACTIVEX(id, fn) wxDECLARE_EVENT_TABLE_ENTRY(wxEVT_ACTIVEX, id, -1, wxActiveXEventHandler( fn ), nullptr ),
#endif // wxUSE_ACTIVEX
#endif // _WX_MSW_OLE_ACTIVEXCONTAINER_H_

Some files were not shown because too many files have changed in this diff Show More