*** empty log message ***
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3924 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -67,11 +67,19 @@ public:
|
||||
|
||||
~wxAcceleratorTable();
|
||||
|
||||
inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) { if (*this == accel) return (*this); Ref(accel); return *this; }
|
||||
inline bool operator == (const wxAcceleratorTable& accel) { return m_refData == accel.m_refData; }
|
||||
inline bool operator != (const wxAcceleratorTable& accel) { return m_refData != accel.m_refData; }
|
||||
inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel)
|
||||
{ if (*this == accel) return (*this); Ref(accel); return *this; };
|
||||
inline bool operator == (const wxAcceleratorTable& accel)
|
||||
{ return m_refData == accel.m_refData; };
|
||||
inline bool operator != (const wxAcceleratorTable& accel)
|
||||
{ return m_refData != accel.m_refData; };
|
||||
|
||||
bool Ok() const;
|
||||
void SetHACCEL(WXHACCEL hAccel);
|
||||
WXHACCEL GetHACCEL() const;
|
||||
|
||||
// translate the accelerator, return TRUE if done
|
||||
bool Translate(wxWindow *window, WXMSG *msg) const;
|
||||
};
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable;
|
||||
|
@@ -143,6 +143,10 @@ class WXDLLEXPORT wxDC: public wxDCBase
|
||||
virtual void DoDrawSpline(wxList *points);
|
||||
#endif
|
||||
|
||||
// OS2-specific member variables
|
||||
int m_windowExtX;
|
||||
int m_windowExtY;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Other virtuals from wxDCBase that are overridden here
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@@ -1,21 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: listctrl.h
|
||||
// Purpose: wxListCtrl class
|
||||
// Author: AUTHOR
|
||||
// Author: David Webster
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// Created: 10/10/99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
// Copyright: (c) David Webster
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_LISTCTRL_H_
|
||||
#define _WX_LISTCTRL_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "listctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/control.h"
|
||||
#include "wx/event.h"
|
||||
#include "wx/imaglist.h"
|
||||
@@ -98,7 +94,7 @@ enum {
|
||||
wxLIST_NEXT_ALL, // Searches for subsequent item by index
|
||||
wxLIST_NEXT_BELOW, // Searches for an item below the specified item
|
||||
wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item
|
||||
wxLIST_NEXT_RIGHT, // Searches for an item to the right of the specified item
|
||||
wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item
|
||||
};
|
||||
|
||||
// Alignment flags for Arrange
|
||||
@@ -189,6 +185,10 @@ class WXDLLEXPORT wxListCtrl: public wxControl
|
||||
// Attributes
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Sets the background colour (GetBackgroundColour already implicit in
|
||||
// wxWindow class)
|
||||
bool SetBackgroundColour(const wxColour& col);
|
||||
|
||||
// Gets information about this column
|
||||
bool GetColumn(int col, wxListItem& item) const;
|
||||
|
||||
@@ -285,11 +285,11 @@ class WXDLLEXPORT wxListCtrl: public wxControl
|
||||
// Returns the item or -1 if unsuccessful.
|
||||
long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const ;
|
||||
|
||||
// Implementation: converts wxWindows style to MSW style.
|
||||
// Implementation: converts wxWindows style to OS2 style.
|
||||
// Can be a single style flag or a bit list.
|
||||
// oldStyle is 'normalised' so that it doesn't contain
|
||||
// conflicting styles.
|
||||
long ConvertToMSWStyle(long& oldStyle, long style) const;
|
||||
long ConvertToOS2Style(long& oldStyle, long style) const;
|
||||
|
||||
// Gets one of the three image lists
|
||||
wxImageList *GetImageList(int which) const ;
|
||||
@@ -390,15 +390,16 @@ class WXDLLEXPORT wxListCtrl: public wxControl
|
||||
// data is arbitrary data to be passed to the sort function.
|
||||
bool SortItems(wxListCtrlCompare fn, long data);
|
||||
|
||||
/* Why should we need this function? Leave for now.
|
||||
* We might need it because item data may have changed,
|
||||
* but the display needs refreshing (in string callback mode)
|
||||
// Updates an item. If the list control has the wxLI_AUTO_ARRANGE style,
|
||||
// the items will be rearranged.
|
||||
bool Update(long item);
|
||||
*/
|
||||
// IMPLEMENTATION
|
||||
virtual bool OS2Command(WXUINT param, WXWORD id);
|
||||
virtual bool OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
||||
|
||||
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
||||
// bring the control in sync with current m_windowStyle value
|
||||
void UpdateStyle();
|
||||
|
||||
// Add to pool: necessary because Windows needs to have a string
|
||||
// still exist across 3 callbacks.
|
||||
wxChar *AddPool(const wxString& str);
|
||||
|
||||
protected:
|
||||
wxTextCtrl* m_textCtrl; // The control used for editing a label
|
||||
@@ -412,40 +413,9 @@ protected:
|
||||
int m_colCount; // Windows doesn't have GetColumnCount so must
|
||||
// keep track of inserted/deleted columns
|
||||
|
||||
private:
|
||||
bool DoCreateControl(int x, int y, int w, int h);
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxListEvent: public wxCommandEvent
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxListEvent)
|
||||
|
||||
public:
|
||||
wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
|
||||
|
||||
int m_code;
|
||||
long m_itemIndex;
|
||||
long m_oldItemIndex;
|
||||
int m_col;
|
||||
bool m_cancelled;
|
||||
wxPoint m_pointDrag;
|
||||
|
||||
wxListItem m_item;
|
||||
};
|
||||
|
||||
typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&);
|
||||
|
||||
#define EVT_LIST_BEGIN_DRAG(id, fn) { wxEVT_COMMAND_LIST_BEGIN_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
|
||||
#define EVT_LIST_BEGIN_RDRAG(id, fn) { wxEVT_COMMAND_LIST_BEGIN_RDRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
|
||||
#define EVT_LIST_BEGIN_LABEL_EDIT(id, fn) { wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
|
||||
#define EVT_LIST_END_LABEL_EDIT(id, fn) { wxEVT_COMMAND_LIST_END_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
|
||||
#define EVT_LIST_DELETE_ITEM(id, fn) { wxEVT_COMMAND_LIST_DELETE_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
|
||||
#define EVT_LIST_DELETE_ALL_ITEMS(id, fn) { wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
|
||||
#define EVT_LIST_GET_INFO(id, fn) { wxEVT_COMMAND_LIST_GET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
|
||||
#define EVT_LIST_SET_INFO(id, fn) { wxEVT_COMMAND_LIST_SET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
|
||||
#define EVT_LIST_ITEM_SELECTED(id, fn) { wxEVT_COMMAND_LIST_ITEM_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
|
||||
#define EVT_LIST_ITEM_DESELECTED(id, fn) { wxEVT_COMMAND_LIST_ITEM_DESELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
|
||||
#define EVT_LIST_KEY_DOWN(id, fn) { wxEVT_COMMAND_LIST_KEY_DOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
|
||||
#define EVT_LIST_INSERT_ITEM(id, fn) { wxEVT_COMMAND_LIST_INSERT_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
|
||||
#define EVT_LIST_COL_CLICK(id, fn) { wxEVT_COMMAND_LIST_COL_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
|
||||
|
||||
#endif
|
||||
// _WX_LISTCTRL_H_
|
||||
|
@@ -3,21 +3,17 @@
|
||||
// Purpose: MDI (Multiple Document Interface) classes.
|
||||
// This doesn't have to be implemented just like Windows,
|
||||
// it could be a tabbed design as in wxGTK.
|
||||
// Author: AUTHOR
|
||||
// Author: David Webster
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// Created: 10/10/99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
// Copyright: (c) David Webster
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MDI_H_
|
||||
#define _WX_MDI_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "mdi.h"
|
||||
#endif
|
||||
|
||||
#include "wx/frame.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
|
||||
@@ -55,40 +51,60 @@ public:
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
void SetMenuBar(wxMenuBar *menu_bar);
|
||||
// Get the active MDI child window (Windows only)
|
||||
wxMDIChildFrame *GetActiveChild() const;
|
||||
|
||||
// Gets the size available for subwindows after menu size, toolbar size
|
||||
// and status bar size have been subtracted. If you want to manage your own
|
||||
// toolbar(s), don't call SetToolBar.
|
||||
void GetClientSize(int *width, int *height) const;
|
||||
// Get the client window
|
||||
wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }
|
||||
|
||||
// Get the active MDI child window (Windows only)
|
||||
wxMDIChildFrame *GetActiveChild() const ;
|
||||
// Create the client window class (don't Create the window,
|
||||
// just return a new class)
|
||||
virtual wxMDIClientWindow *OnCreateClient(void);
|
||||
|
||||
// Get the client window
|
||||
inline wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; };
|
||||
WXHMENU GetWindowMenu() const { return m_windowMenu; }
|
||||
|
||||
// Create the client window class (don't Create the window,
|
||||
// just return a new class)
|
||||
virtual wxMDIClientWindow *OnCreateClient() ;
|
||||
// MDI operations
|
||||
// --------------
|
||||
virtual void Cascade();
|
||||
virtual void Tile();
|
||||
virtual void ArrangeIcons();
|
||||
virtual void ActivateNext();
|
||||
virtual void ActivatePrevious();
|
||||
|
||||
// MDI operations
|
||||
virtual void Cascade();
|
||||
virtual void Tile();
|
||||
virtual void ArrangeIcons();
|
||||
virtual void ActivateNext();
|
||||
virtual void ActivatePrevious();
|
||||
// handlers
|
||||
// --------
|
||||
|
||||
// Responds to colour changes
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
bool HandleActivate(int state, bool minimized, WXHWND activate);
|
||||
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
||||
|
||||
// override window proc for MDI-specific message processing
|
||||
virtual MRESULT OS2WindowProc(HWND hwnd, WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
virtual MRESULT OS2DefWindowProc(HWND hwnd, WXUINT, WXWPARAM, WXLPARAM);
|
||||
virtual bool OS2TranslateMessage(WXMSG* msg);
|
||||
|
||||
protected:
|
||||
virtual void InternalSetMenuBar();
|
||||
|
||||
// TODO maybe have this member
|
||||
wxMDIClientWindow *m_clientWindow;
|
||||
wxMDIClientWindow * m_clientWindow;
|
||||
wxMDIChildFrame * m_currentChild;
|
||||
WXHMENU m_windowMenu;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
// TRUE if MDI Frame is intercepting commands, not child
|
||||
bool m_parentFrameActive;
|
||||
|
||||
private:
|
||||
friend class WXDLLEXPORT wxMDIChildFrame;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxMDIChildFrame: public wxFrame
|
||||
@@ -118,18 +134,31 @@ public:
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
// Set menu bar
|
||||
void SetMenuBar(wxMenuBar *menu_bar);
|
||||
void SetClientSize(int width, int height);
|
||||
void GetPosition(int *x, int *y) const ;
|
||||
// MDI operations
|
||||
virtual void Maximize(bool maximize = TRUE);
|
||||
virtual void Restore();
|
||||
virtual void Activate();
|
||||
|
||||
// MDI operations
|
||||
virtual void Maximize();
|
||||
virtual void Restore();
|
||||
virtual void Activate();
|
||||
private:
|
||||
// supress virtual function hiding warning
|
||||
virtual void Maximize(bool maximize) { wxFrame::Maximize(maximize); };
|
||||
// Handlers
|
||||
|
||||
bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
|
||||
bool HandleSize(int x, int y, WXUINT);
|
||||
bool HandleWindowPosChanging(void *lpPos);
|
||||
bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
||||
|
||||
virtual MRESULT OS2WindowProc(HWND hwnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
virtual MRESULT OS2DefWindowProc(HWND hwnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
virtual bool OS2TranslateMessage(WXMSG *msg);
|
||||
|
||||
virtual void OS2DestroyWindow();
|
||||
|
||||
// Implementation
|
||||
bool ResetWindowStyle(void *vrect);
|
||||
|
||||
protected:
|
||||
virtual void DoGetPosition(int *x, int *y) const;
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
virtual void InternalSetMenuBar();
|
||||
};
|
||||
|
||||
/* The client window is a child of the parent MDI frame, and itself
|
||||
@@ -142,25 +171,31 @@ private:
|
||||
class WXDLLEXPORT wxMDIClientWindow: public wxWindow
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
||||
|
||||
public:
|
||||
|
||||
wxMDIClientWindow() ;
|
||||
inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
|
||||
{
|
||||
CreateClient(parent, style);
|
||||
}
|
||||
wxMDIClientWindow() { Init(); }
|
||||
wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
|
||||
{
|
||||
Init();
|
||||
|
||||
~wxMDIClientWindow();
|
||||
CreateClient(parent, style);
|
||||
}
|
||||
|
||||
// Note: this is virtual, to allow overridden behaviour.
|
||||
virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL);
|
||||
// Note: this is virtual, to allow overridden behaviour.
|
||||
virtual bool CreateClient(wxMDIParentFrame *parent,
|
||||
long style = wxVSCROLL | wxHSCROLL);
|
||||
|
||||
// Explicitly call default scroll behaviour
|
||||
void OnScroll(wxScrollEvent& event);
|
||||
// Explicitly call default scroll behaviour
|
||||
void OnScroll(wxScrollEvent& event);
|
||||
|
||||
protected:
|
||||
void Init() { m_scrollX = m_scrollY = 0; }
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
int m_scrollX, m_scrollY;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -1,27 +1,30 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: menu.h
|
||||
// Purpose: wxMenu, wxMenuBar classes
|
||||
// Author: AUTHOR
|
||||
// Author: David Webster
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// Created: 10/10/99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
// Copyright: (c) David Webster
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MENU_H_
|
||||
#define _WX_MENU_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "menu.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/event.h"
|
||||
#include "wx/dynarray.h"
|
||||
#include "wx/string.h"
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
#include "wx/accel.h"
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
class WXDLLEXPORT wxMenuItem;
|
||||
class WXDLLEXPORT wxMenuBar;
|
||||
class WXDLLEXPORT wxMenu;
|
||||
class WXDLLEXPORT wxFrame;
|
||||
|
||||
WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
|
||||
|
||||
@@ -33,140 +36,268 @@ class WXDLLEXPORT wxMenu: public wxEvtHandler
|
||||
DECLARE_DYNAMIC_CLASS(wxMenu)
|
||||
|
||||
public:
|
||||
// ctor & dtor
|
||||
wxMenu(const wxString& title = wxEmptyString, const wxFunction func = NULL);
|
||||
~wxMenu();
|
||||
wxMenu(const wxString& title,
|
||||
const wxFunction func)
|
||||
{
|
||||
Init(title, func);
|
||||
}
|
||||
|
||||
// construct menu
|
||||
// append items to the menu
|
||||
// separator line
|
||||
void AppendSeparator();
|
||||
// normal item
|
||||
void Append(int id, const wxString& Label, const wxString& helpString = wxEmptyString,
|
||||
bool checkable = FALSE);
|
||||
// a submenu
|
||||
void Append(int id, const wxString& Label, wxMenu *SubMenu,
|
||||
const wxString& helpString = wxEmptyString);
|
||||
// the most generic form (create wxMenuItem first and use it's functions)
|
||||
void Append(wxMenuItem *pItem);
|
||||
// insert a break in the menu
|
||||
void Break();
|
||||
// delete an item
|
||||
void Delete(int id);
|
||||
wxMenu( long WXUNUSED(style) )
|
||||
{
|
||||
Init( wxEmptyString );
|
||||
}
|
||||
|
||||
// menu item control
|
||||
void Enable(int id, bool Flag);
|
||||
bool Enabled(int id) const;
|
||||
inline bool IsEnabled(int id) const { return Enabled(id); };
|
||||
void Check(int id, bool Flag);
|
||||
bool Checked(int id) const;
|
||||
inline bool IsChecked(int id) const { return IsChecked(id); };
|
||||
wxMenu(const wxString& title = wxEmptyString, long WXUNUSED(style) = 0)
|
||||
{
|
||||
Init(title);
|
||||
}
|
||||
|
||||
// Client data
|
||||
inline void SetClientData(void* clientData) { m_clientData = clientData; }
|
||||
inline void* GetClientData() const { return m_clientData; }
|
||||
virtual ~wxMenu();
|
||||
|
||||
void SetInvokingWindow(wxWindow *pWin) { m_pInvokingWindow = pWin; }
|
||||
wxWindow *GetInvokingWindow() const { return m_pInvokingWindow; }
|
||||
// construct menu
|
||||
// append a separator to the menu
|
||||
void AppendSeparator();
|
||||
// append a normal item to the menu
|
||||
void Append(int id, const wxString& label,
|
||||
const wxString& helpString = wxEmptyString,
|
||||
bool checkable = FALSE);
|
||||
// append a submenu
|
||||
void Append(int id, const wxString& label,
|
||||
wxMenu *submenu,
|
||||
const wxString& helpString = wxEmptyString);
|
||||
// append anything (create wxMenuItem first)
|
||||
void Append(wxMenuItem *pItem);
|
||||
|
||||
// item properties
|
||||
// title
|
||||
void SetTitle(const wxString& label);
|
||||
const wxString GetTitle() const;
|
||||
// label
|
||||
void SetLabel(int id, const wxString& label);
|
||||
wxString GetLabel(int id) const;
|
||||
// help string
|
||||
virtual void SetHelpString(int id, const wxString& helpString);
|
||||
virtual wxString GetHelpString(int id) const ;
|
||||
// insert a break in the menu
|
||||
void Break();
|
||||
|
||||
// find item
|
||||
// Finds the item id matching the given string, -1 if not found.
|
||||
virtual int FindItem(const wxString& itemString) const ;
|
||||
// Find wxMenuItem by ID, and item's menu too if itemMenu is !NULL.
|
||||
wxMenuItem *FindItemForId(int itemId, wxMenu **itemMenu = NULL) const;
|
||||
// delete an item
|
||||
// If it's a submenu, menu is not destroyed.
|
||||
// VZ: why? shouldn't it return "wxMenu *" then?
|
||||
void Delete(int id);
|
||||
|
||||
void ProcessCommand(wxCommandEvent& event);
|
||||
inline void Callback(const wxFunction func) { m_callback = func; }
|
||||
// client data
|
||||
inline void SetClientData(void* clientData) { m_clientData = clientData; }
|
||||
inline void* GetClientData() const { return m_clientData; }
|
||||
|
||||
// Updates the UI for a menu and all submenus recursively.
|
||||
// source is the object that has the update event handlers
|
||||
// defined for it. If NULL, the menu or associated window
|
||||
// will be used.
|
||||
void UpdateUI(wxEvtHandler* source = (wxEvtHandler*) NULL);
|
||||
// menu item control
|
||||
// enable/disable item
|
||||
void Enable(int id, bool enable);
|
||||
// TRUE if enabled
|
||||
bool IsEnabled(int id) const;
|
||||
|
||||
virtual void SetParent(wxEvtHandler *parent) { m_parent = parent; }
|
||||
inline void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; }
|
||||
inline wxEvtHandler *GetEventHandler() { return m_eventHandler; }
|
||||
// check/uncheck item - only for checkable items, of course
|
||||
void Check(int id, bool check);
|
||||
// TRUE if checked
|
||||
bool IsChecked(int id) const;
|
||||
|
||||
inline wxList& GetItems() const { return (wxList&) m_menuItems; }
|
||||
// other properties
|
||||
// the menu title
|
||||
void SetTitle(const wxString& label);
|
||||
const wxString GetTitle() const;
|
||||
// the item label
|
||||
void SetLabel(int id, const wxString& label);
|
||||
wxString GetLabel(int id) const;
|
||||
// help string
|
||||
virtual void SetHelpString(int id, const wxString& helpString);
|
||||
virtual wxString GetHelpString(int id) const;
|
||||
|
||||
public:
|
||||
wxFunction m_callback;
|
||||
// get the list of items
|
||||
inline wxList& GetItems() const { return (wxList &)m_menuItems; }
|
||||
|
||||
int m_noItems;
|
||||
wxString m_title;
|
||||
wxMenuBar * m_menuBar;
|
||||
wxList m_menuItems;
|
||||
wxEvtHandler * m_parent;
|
||||
wxEvtHandler * m_eventHandler;
|
||||
void* m_clientData;
|
||||
wxWindow* m_pInvokingWindow;
|
||||
// find item
|
||||
// returns id of the item matching the given string or wxNOT_FOUND
|
||||
virtual int FindItem(const wxString& itemString) const;
|
||||
// returns NULL if not found
|
||||
inline wxMenuItem* FindItem(int id) const { return FindItemForId(id); }
|
||||
// find wxMenuItem by ID, and item's menu too if itemMenu is !NULL
|
||||
wxMenuItem *FindItemForId(int itemId, wxMenu **itemMenu = NULL) const;
|
||||
|
||||
// Updates the UI for a menu and all submenus recursively. source is the
|
||||
// object that has the update event handlers defined for it. If NULL, the
|
||||
// menu or associated window will be used.
|
||||
void UpdateUI(wxEvtHandler* source = (wxEvtHandler*)NULL);
|
||||
|
||||
bool ProcessCommand(wxCommandEvent& event);
|
||||
|
||||
inline virtual void SetParent(wxEvtHandler *parent) { m_parent = parent; }
|
||||
inline void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; }
|
||||
inline wxEvtHandler *GetEventHandler() const { return m_eventHandler; }
|
||||
|
||||
// IMPLEMENTATION
|
||||
bool OS2Command(WXUINT param, WXWORD id);
|
||||
|
||||
inline void SetInvokingWindow(wxWindow *pWin) { m_pInvokingWindow = pWin; }
|
||||
inline wxWindow *GetInvokingWindow() const { return m_pInvokingWindow; }
|
||||
|
||||
// semi-private accessors
|
||||
// get the window which contains this menu
|
||||
wxWindow *GetWindow() const;
|
||||
// get the menu handle
|
||||
WXHMENU GetHMenu() const;
|
||||
|
||||
// only for wxMenuBar
|
||||
void Attach(wxMenuBar *menubar);
|
||||
void Detach();
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
inline size_t GetAccelCount() const { return m_accelKeyCodes.GetCount(); }
|
||||
size_t CopyAccels(wxAcceleratorEntry *accels) const;
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
inline wxFunction GetCallback() const { return m_callback; }
|
||||
inline void Callback(const wxFunction func) { m_callback = func; }
|
||||
wxFunction m_callback;
|
||||
|
||||
#ifdef WXWIN_COMPATIBILITY
|
||||
// compatibility: these functions are deprecated
|
||||
inline bool Enabled(int id) const { return IsEnabled(id); }
|
||||
inline bool Checked(int id) const { return IsChecked(id); }
|
||||
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
private:
|
||||
// common part of all ctors
|
||||
void Init(const wxString& title, const wxFunction func = NULL );
|
||||
|
||||
bool m_doBreak;
|
||||
|
||||
// This is used when m_hMenu is NULL because we don't want to
|
||||
// delete it in ~wxMenu (it's been added to a parent menu).
|
||||
// But we'll still need the handle for other purposes.
|
||||
// Might be better to have a flag saying whether it's deleteable or not.
|
||||
WXHMENU m_savehMenu ; // Used for Enable() on popup
|
||||
WXHMENU m_hMenu;
|
||||
|
||||
int m_noItems;
|
||||
wxString m_title;
|
||||
wxMenu * m_topLevelMenu;
|
||||
wxMenuBar * m_menuBar;
|
||||
wxList m_menuItems;
|
||||
wxEvtHandler * m_parent;
|
||||
wxEvtHandler * m_eventHandler;
|
||||
wxWindow *m_pInvokingWindow;
|
||||
void* m_clientData;
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
// the accelerators data
|
||||
wxArrayInt m_accelKeyCodes, m_accelFlags, m_accelIds;
|
||||
#endif // wxUSE_ACCEL
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Menu Bar (a la Windows)
|
||||
// ----------------------------------------------------------------------------
|
||||
class WXDLLEXPORT wxFrame;
|
||||
|
||||
class WXDLLEXPORT wxMenuBar: public wxEvtHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
||||
|
||||
wxMenuBar();
|
||||
wxMenuBar(int n, wxMenu *menus[], const wxString titles[]);
|
||||
~wxMenuBar();
|
||||
public:
|
||||
// ctors & dtor
|
||||
// default constructor
|
||||
wxMenuBar();
|
||||
// unused under MSW
|
||||
wxMenuBar(long style);
|
||||
// menubar takes ownership of the menus arrays but copies the titles
|
||||
wxMenuBar(int n, wxMenu *menus[], const wxString titles[]);
|
||||
virtual ~wxMenuBar();
|
||||
|
||||
void Append(wxMenu *menu, const wxString& title);
|
||||
// Must only be used AFTER menu has been attached to frame,
|
||||
// otherwise use individual menus to enable/disable items
|
||||
void Enable(int Id, bool Flag);
|
||||
bool Enabled(int Id) const ;
|
||||
inline bool IsEnabled(int Id) const { return Enabled(Id); };
|
||||
void EnableTop(int pos, bool Flag);
|
||||
void Check(int id, bool Flag);
|
||||
bool Checked(int id) const ;
|
||||
inline bool IsChecked(int Id) const { return Checked(Id); };
|
||||
void SetLabel(int id, const wxString& label) ;
|
||||
wxString GetLabel(int id) const ;
|
||||
void SetLabelTop(int pos, const wxString& label) ;
|
||||
wxString GetLabelTop(int pos) const ;
|
||||
virtual void Delete(wxMenu *menu, int index = 0); /* Menu not destroyed */
|
||||
virtual bool OnAppend(wxMenu *menu, const char *title);
|
||||
virtual bool OnDelete(wxMenu *menu, int index);
|
||||
// menubar construction
|
||||
WXHMENU Create();
|
||||
void Append(wxMenu *menu, const wxString& title);
|
||||
void Insert(int pos, wxMenu * menu, const wxString& title);
|
||||
void ReplaceMenu(int pos, wxMenu * new_menu, const wxString& title);
|
||||
int FindMenu(const wxString& title);
|
||||
void Detach();
|
||||
virtual void Delete(wxMenu *menu, int index = 0); /* Menu not destroyed */
|
||||
|
||||
virtual void SetHelpString(int Id, const wxString& helpString);
|
||||
virtual wxString GetHelpString(int Id) const ;
|
||||
// state control
|
||||
// NB: must only be used AFTER menu has been attached to frame,
|
||||
// otherwise use individual menus to enable/disable items
|
||||
// enable the item
|
||||
void Enable(int id, bool enable);
|
||||
// TRUE if item enabled
|
||||
bool IsEnabled(int id) const;
|
||||
//
|
||||
void EnableTop(int pos, bool enable);
|
||||
|
||||
virtual int FindMenuItem(const wxString& menuString, const wxString& itemString) const ;
|
||||
// works only with checkable items
|
||||
void Check(int id, bool check);
|
||||
// TRUE if checked
|
||||
bool IsChecked(int id) const;
|
||||
|
||||
// Find wxMenuItem for item ID, and return item's
|
||||
// menu too if itemMenu is non-NULL.
|
||||
wxMenuItem *FindItemForId(int itemId, wxMenu **menuForItem = NULL) const ;
|
||||
void SetLabel(int id, const wxString& label) ;
|
||||
wxString GetLabel(int id) const ;
|
||||
|
||||
inline void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; }
|
||||
inline wxEvtHandler *GetEventHandler() { return m_eventHandler; }
|
||||
virtual void SetHelpString(int id, const wxString& helpString);
|
||||
virtual wxString GetHelpString(int id) const ;
|
||||
|
||||
inline int GetMenuCount() const { return m_menuCount; }
|
||||
inline wxMenu* GetMenu(int i) const { return m_menus[i]; }
|
||||
void SetLabelTop(int pos, const wxString& label) ;
|
||||
wxString GetLabelTop(int pos) const ;
|
||||
|
||||
public:
|
||||
wxEvtHandler * m_eventHandler;
|
||||
int m_menuCount;
|
||||
wxMenu ** m_menus;
|
||||
wxString * m_titles;
|
||||
wxFrame * m_menuBarFrame;
|
||||
/* TODO: data that represents the actual menubar when created.
|
||||
*/
|
||||
// notifications: return FALSE to prevent the menu from being
|
||||
// appended/deleted
|
||||
virtual bool OnAppend(wxMenu *menu, const wxChar *title);
|
||||
virtual bool OnDelete(wxMenu *menu, int index);
|
||||
|
||||
// item search
|
||||
// by menu and item names, returns wxNOT_FOUND if not found
|
||||
virtual int FindMenuItem(const wxString& menuString,
|
||||
const wxString& itemString) const;
|
||||
// returns NULL if not found
|
||||
wxMenuItem* FindItem(int id) const { return FindItemForId(id); }
|
||||
// returns NULL if not found, fills menuForItem if !NULL
|
||||
wxMenuItem *FindItemForId(int itemId, wxMenu **menuForItem = NULL) const;
|
||||
|
||||
// submenus access
|
||||
inline int GetMenuCount() const { return m_menuCount; }
|
||||
inline wxMenu *GetMenu(int i) const { return m_menus[i]; }
|
||||
|
||||
inline void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; }
|
||||
inline wxEvtHandler *GetEventHandler() { return m_eventHandler; }
|
||||
|
||||
#ifdef WXWIN_COMPATIBILITY
|
||||
// compatibility: these functions are deprecated
|
||||
inline bool Enabled(int id) const { return IsEnabled(id); }
|
||||
inline bool Checked(int id) const { return IsChecked(id); }
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
// IMPLEMENTATION
|
||||
// returns TRUE if we're attached to a frame
|
||||
inline bool IsAttached() const { return m_menuBarFrame != NULL; }
|
||||
// get the frame we live in
|
||||
inline wxFrame *GetFrame() const { return m_menuBarFrame; }
|
||||
// attach to a frame
|
||||
void Attach(wxFrame *frame);
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
// get the accel table for the menus
|
||||
inline const wxAcceleratorTable& GetAccelTable() const { return m_accelTable; }
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
// get the menu handle
|
||||
inline 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 !NULL)
|
||||
void Refresh();
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
wxEvtHandler *m_eventHandler;
|
||||
int m_menuCount;
|
||||
wxMenu **m_menus;
|
||||
wxString *m_titles;
|
||||
wxFrame *m_menuBarFrame;
|
||||
WXHMENU m_hMenu;
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
// the accelerator table for all accelerators in all our menus
|
||||
wxAcceleratorTable m_accelTable;
|
||||
#endif // wxUSE_ACCEL
|
||||
};
|
||||
|
||||
#endif // _WX_MENU_H_
|
||||
|
@@ -2,7 +2,7 @@
|
||||
// Name: menuitem.h
|
||||
// Purpose: wxMenuItem class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Modified by:
|
||||
// Created: 11.11.97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
@@ -26,7 +26,7 @@
|
||||
// headers - only because ownerdrw.h is not always included and I don't want
|
||||
// to write #ifdef's everywhere...
|
||||
#if wxUSE_OWNER_DRAWN
|
||||
#include "wx/ownerdrw.h"
|
||||
#include "wx/ownerdrw.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -55,15 +55,20 @@ public:
|
||||
|
||||
// accessors (some more are inherited from wxOwnerDrawn or are below)
|
||||
bool IsSeparator() const { return m_idItem == ID_SEPARATOR; }
|
||||
bool IsEnabled() const { return m_bEnabled; }
|
||||
bool IsChecked() const { return m_bChecked; }
|
||||
bool IsEnabled() const { return m_bEnabled; }
|
||||
bool IsChecked() const { return m_bChecked; }
|
||||
bool IsSubMenu() const { return GetSubMenu() != NULL; }
|
||||
|
||||
int GetId() const { return m_idItem; }
|
||||
const wxString& GetHelp() const { return m_strHelp; }
|
||||
wxMenu *GetSubMenu() const { return m_pSubMenu; }
|
||||
|
||||
// the id for a popup menu is really its menu handle (as required by
|
||||
// ::AppendMenu() API)
|
||||
int GetRealId() const;
|
||||
|
||||
// operations
|
||||
void SetName(const wxString& strName) { m_strName = strName; }
|
||||
void SetName(const wxString& strName);
|
||||
void SetHelp(const wxString& strHelp) { m_strHelp = strHelp; }
|
||||
|
||||
void Enable(bool bDoEnable = TRUE);
|
||||
|
@@ -3,86 +3,126 @@
|
||||
// Purpose: wxMetaFile, wxMetaFileDC classes.
|
||||
// This probably should be restricted to Windows platforms,
|
||||
// but if there is an equivalent on your platform, great.
|
||||
// Author: AUTHOR
|
||||
// Author: David Webster
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// Created: 10/10/99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
// Copyright: (c) David Webster
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_METAFIILE_H_
|
||||
#define _WX_METAFIILE_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "metafile.h"
|
||||
#include "wx/setup.h"
|
||||
|
||||
#if wxUSE_METAFILE
|
||||
#include "wx/dc.h"
|
||||
#include "wx/gdiobj.h"
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
#include "wx/dataobj.h"
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
#include "wx/dc.h"
|
||||
|
||||
/*
|
||||
* Metafile and metafile device context classes - work in Windows 3.1 only
|
||||
* Metafile and metafile device context classes
|
||||
*
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxDC;
|
||||
class WXDLLEXPORT wxMetaFile: public wxObject
|
||||
#define wxMetaFile wxMetafile
|
||||
#define wxMetaFileDC wxMetafileDC
|
||||
|
||||
class WXDLLEXPORT wxMetafile;
|
||||
|
||||
class WXDLLEXPORT wxMetafileRefData: public wxGDIRefData
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMetaFile)
|
||||
friend class WXDLLEXPORT wxMetafile;
|
||||
public:
|
||||
wxMetafileRefData(void);
|
||||
~wxMetafileRefData(void);
|
||||
|
||||
public:
|
||||
WXHANDLE m_metafile;
|
||||
int m_windowsMappingMode;
|
||||
};
|
||||
|
||||
#define M_METAFILEDATA ((wxMetafileRefData *)m_refData)
|
||||
|
||||
class WXDLLEXPORT wxMetafile: public wxGDIObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMetafile)
|
||||
public:
|
||||
wxMetaFile(const wxString& file = "");
|
||||
~wxMetaFile();
|
||||
// Copy constructor
|
||||
inline wxMetafile(const wxMetafile& metafile)
|
||||
{ Ref(metafile); }
|
||||
|
||||
wxMetafile(const wxString& file = "");
|
||||
~wxMetafile(void);
|
||||
|
||||
// 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);
|
||||
// TODO
|
||||
inline bool Ok() { return FALSE; };
|
||||
inline bool Ok(void) const { return (M_METAFILEDATA && (M_METAFILEDATA->m_metafile != 0)); };
|
||||
|
||||
/* TODO: Implementation
|
||||
inline WXHANDLE GetHMETAFILE() { return m_metaFile; }
|
||||
inline void SetHMETAFILE(WXHANDLE mf) { m_metaFile = mf; }
|
||||
// Implementation
|
||||
inline WXHANDLE GetHMETAFILE(void) { return M_METAFILEDATA->m_metafile; }
|
||||
void SetHMETAFILE(WXHANDLE mf) ;
|
||||
inline int GetWindowsMappingMode(void) { return M_METAFILEDATA->m_windowsMappingMode; }
|
||||
void SetWindowsMappingMode(int mm);
|
||||
|
||||
// Operators
|
||||
inline wxMetafile& operator = (const wxMetafile& metafile) { if (*this == metafile) return (*this); Ref(metafile); return *this; }
|
||||
inline bool operator == (const wxMetafile& metafile) { return m_refData == metafile.m_refData; }
|
||||
inline bool operator != (const wxMetafile& metafile) { return m_refData != metafile.m_refData; }
|
||||
|
||||
protected:
|
||||
WXHANDLE m_metaFile;
|
||||
*/
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxMetaFileDC: public wxDC
|
||||
class WXDLLEXPORT wxMetafileDC: public wxDC
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMetaFileDC)
|
||||
DECLARE_DYNAMIC_CLASS(wxMetafileDC)
|
||||
|
||||
public:
|
||||
// Don't supply origin and extent
|
||||
// Supply them to wxMakeMetaFilePlaceable instead.
|
||||
wxMetaFileDC(const wxString& file = "");
|
||||
wxMetafileDC(const wxString& 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);
|
||||
wxMetafileDC(const wxString& file, int xext, int yext, int xorg, int yorg);
|
||||
|
||||
~wxMetaFileDC();
|
||||
~wxMetafileDC(void);
|
||||
|
||||
// Should be called at end of drawing
|
||||
virtual wxMetaFile *Close();
|
||||
virtual wxMetafile *Close(void);
|
||||
virtual void SetMapMode(int mode);
|
||||
virtual void GetTextExtent(const wxString& string, float *x, float *y,
|
||||
float *descent = NULL, float *externalLeading = NULL,
|
||||
wxFont *theFont = NULL, bool use16bit = FALSE);
|
||||
virtual void GetTextExtent(const wxString& string, long *x, long *y,
|
||||
long *descent = NULL, long *externalLeading = NULL,
|
||||
wxFont *theFont = NULL, bool use16bit = FALSE) const;
|
||||
|
||||
// Implementation
|
||||
inline wxMetaFile *GetMetaFile() { return m_metaFile; }
|
||||
inline void SetMetaFile(wxMetaFile *mf) { m_metaFile = mf; }
|
||||
inline int GetWindowsMappingMode() { return m_windowsMappingMode; }
|
||||
inline wxMetafile *GetMetaFile(void) const { return m_metaFile; }
|
||||
inline void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; }
|
||||
inline int GetWindowsMappingMode(void) const { return m_windowsMappingMode; }
|
||||
inline void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; }
|
||||
|
||||
protected:
|
||||
int m_windowsMappingMode;
|
||||
wxMetaFile *m_metaFile;
|
||||
int m_windowsMappingMode;
|
||||
wxMetafile* m_metaFile;
|
||||
|
||||
private:
|
||||
// function hiding warning supression
|
||||
inline virtual void GetTextExtent( const wxString& string
|
||||
,long* width
|
||||
,long* height
|
||||
,long* descent = NULL
|
||||
,long* externalLeading = NULL
|
||||
,wxFont* theFont = NULL
|
||||
) const
|
||||
{ GetTextExtent( string, width, height, descent, externalLeading, theFont, FALSE);};
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -93,10 +133,56 @@ protected:
|
||||
*/
|
||||
|
||||
// No origin or extent
|
||||
bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, float scale = 1.0);
|
||||
#define wxMakeMetaFilePlaceable wxMakeMetafilePlaceable
|
||||
bool WXDLLEXPORT wxMakeMetafilePlaceable(const wxString& filename, float scale = 1.0);
|
||||
|
||||
// Optional origin and extent
|
||||
bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = TRUE);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMetafileDataObject is a specialization of wxDataObject for metafile data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// TODO: implement OLE side of things. At present, it's just for clipboard
|
||||
// use.
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
class WXDLLEXPORT wxMetafileDataObject : public wxDataObject
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
wxMetafileDataObject() { m_width = 0; m_height = 0; };
|
||||
wxMetafileDataObject(const wxMetafile& metafile, int width = 0, int height = 0):
|
||||
m_metafile(metafile), m_width(width), m_height(height) { }
|
||||
|
||||
void SetMetafile(const wxMetafile& metafile, int w = 0, int h = 0)
|
||||
{ m_metafile = metafile; m_width = w; m_height = h; }
|
||||
wxMetafile GetMetafile() const { return m_metafile; }
|
||||
int GetWidth() const { return m_width; }
|
||||
int GetHeight() const { return m_height; }
|
||||
|
||||
virtual wxDataFormat GetFormat() const { return wxDF_METAFILE; }
|
||||
|
||||
/* ??
|
||||
// implement base class pure virtuals
|
||||
virtual wxDataFormat GetPreferredFormat() const
|
||||
{ return (wxDataFormat) wxDataObject::Text; }
|
||||
virtual bool IsSupportedFormat(wxDataFormat format) const
|
||||
{ return format == wxDataObject::Text || format == wxDataObject::Locale; }
|
||||
virtual size_t GetDataSize() const
|
||||
{ return m_strText.Len() + 1; } // +1 for trailing '\0'of course
|
||||
virtual void GetDataHere(void *pBuf) const
|
||||
{ memcpy(pBuf, m_strText.c_str(), GetDataSize()); }
|
||||
*/
|
||||
|
||||
private:
|
||||
wxMetafile m_metafile;
|
||||
int m_width;
|
||||
int m_height;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_METAFILE
|
||||
#endif
|
||||
// _WX_METAFIILE_H_
|
||||
|
||||
|
@@ -3,21 +3,17 @@
|
||||
// Purpose: wxMiniFrame class. A small frame for e.g. floating toolbars.
|
||||
// If there is no equivalent on your platform, just make it a
|
||||
// normal frame.
|
||||
// Author: AUTHOR
|
||||
// Author: David Webster
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// Created: 10/10/99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
// Copyright: (c) David Webster
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MINIFRAM_H_
|
||||
#define _WX_MINIFRAM_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "minifram.h"
|
||||
#endif
|
||||
|
||||
#include "wx/frame.h"
|
||||
|
||||
class WXDLLEXPORT wxMiniFrame: public wxFrame {
|
||||
@@ -25,22 +21,21 @@ class WXDLLEXPORT wxMiniFrame: public wxFrame {
|
||||
DECLARE_DYNAMIC_CLASS(wxMiniFrame)
|
||||
|
||||
public:
|
||||
inline wxMiniFrame() {}
|
||||
inline wxMiniFrame(void) {}
|
||||
inline wxMiniFrame(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE|wxTINY_CAPTION_HORIZ,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
// Use wxFrame constructor in absence of more specific code.
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
Create(parent, id, title, pos, size, style | wxFRAME_TOOL_WINDOW | wxFRAME_FLOAT_ON_PARENT, name);
|
||||
}
|
||||
|
||||
~wxMiniFrame() {}
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_MINIFRAM_H_
|
||||
|
||||
|
Reference in New Issue
Block a user