up a dialog, e.g. an About box. Widgets are arranged
incorrectly. Seems to be OK for non-dialog panels, once the
size has been restored after the font setting.
+ In fact it seems OK for dialogs now!!! Weird.
-- Colour setting in widgets.
+- ChangeFont should have an extra arg, to allow for not resizing
+ the window back to the original size after setting the font.
+ Also don't call SetFont from constructor, assign the font and
+ call ChangeFont so we can pass FALSE if the size has been passed
+ as the default (which means: wxWin should choose an appropriate
+ size, so Motif should expand/contract the widget as appropriate).
+
+- Colour setting in widgets (almost done).
- Implementation of OnEraseBackground. How? Call OnEraseBackground
just before OnPaint? Will duplicate Xlib's own erase of the background.
painting a tiled bitmap, then a slight flicker might be seen unless
X can be persuaded not to repaint the window background by default.
-- wxBitmapCheckBox, wxBitmapRadioButton
-
- wxSpinButton
- A generic version of wxNotebook that can be used in wxMotif and
- wxCheckBoxList
+- wxBitmapCheckBox, wxBitmapRadioButton
+
- Reimplement combobox using Lesstif's widget (avoiding GPL'ed
widget currently used).
- Could eventually alter the MDI widgets to be more Windows-like
-- currently it's half-hearted.
+
+- Accelerators
+
protected:
static wxList sm_handlers;
};
+
+// Creates a bitmap with transparent areas drawn in
+// the given colour.
+wxBitmap wxCreateMaskedBitmap(wxBitmap& bitmap, wxColour& colour);
+
#endif
// _WX_BITMAP_H_
inline int GetMarginX() { return m_marginX; }
inline int GetMarginY() { return m_marginY; }
+// Implementation
+ void DoSetBitmap();
+ virtual void ChangeBackgroundColour();
+
protected:
+ wxBitmap m_buttonBitmapFocus;
wxBitmap m_buttonBitmap;
+ wxBitmap m_buttonBitmapOriginal; // May be different from m_buttonBitmap
+ // if m_buttonBitmap has been changed
+ // to reflect button background colour
wxBitmap m_buttonBitmapSelected;
- wxBitmap m_buttonBitmapFocus;
+ wxBitmap m_buttonBitmapSelectedOriginal;
+
wxBitmap m_buttonBitmapDisabled;
+ wxBitmap m_buttonBitmapDisabledOriginal;
int m_marginX;
int m_marginY;
virtual void ChangeFont();
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
- WXWidget GetTopWidget() const { return m_formWidget; }
- WXWidget GetLabelWidget() const { return m_labelWidget; }
-
-private:
- WXWidget m_formWidget;
- WXWidget m_labelWidget;
};
// Not implemented
public:
wxWave();
wxWave(const wxString& fileName, bool isResource = FALSE);
+ wxWave(int size, const byte* data);
~wxWave();
public:
+ // Create from resource or file
bool Create(const wxString& fileName, bool isResource = FALSE);
+ // Create from data
+ bool Create(int size, const byte* data);
+
bool IsOk() const { return (m_waveData ? TRUE : FALSE); };
bool Play(bool async = TRUE, bool looped = FALSE) const;
#include "wx/icon.h"
#include "wx/log.h"
#include "wx/control.h"
+#include "wx/dcmemory.h"
#include <Xm/Xm.h>
return ipixmap;
}
+// Creates a bitmap with transparent areas drawn in
+// the given colour.
+wxBitmap wxCreateMaskedBitmap(wxBitmap& bitmap, wxColour& colour)
+{
+ wxBitmap newBitmap(bitmap.GetWidth(),
+ bitmap.GetHeight(),
+ bitmap.GetDepth());
+ wxMemoryDC destDC;
+ wxMemoryDC srcDC;
+ srcDC.SelectObject(bitmap);
+ destDC.SelectObject(newBitmap);
+
+ wxBrush brush(colour, wxSOLID);
+ destDC.SetOptimization(FALSE);
+ destDC.SetBackground(brush);
+ destDC.Clear();
+ destDC.Blit(0, 0, bitmap.GetWidth(), bitmap.GetHeight(), & srcDC, 0, 0, wxCOPY, TRUE);
+
+ return newBitmap;
+}
const wxString& name)
{
m_buttonBitmap = bitmap;
+ m_buttonBitmapOriginal = bitmap;
+ m_buttonBitmapSelected = bitmap;
+ m_buttonBitmapSelectedOriginal = bitmap;
+
SetName(name);
SetValidator(validator);
parent->AddChild(this);
m_mainWidget = (WXWidget) buttonWidget;
- if (bitmap.Ok())
- {
- Pixmap p1, p2;
-
- p1 = (Pixmap) ((wxBitmap&)bitmap).GetLabelPixmap(m_mainWidget);
- p2 = (Pixmap) ((wxBitmap&)bitmap).GetInsensPixmap(m_mainWidget);
+ ChangeBackgroundColour ();
- if(p1 == p2) // <- the Get...Pixmap()-functions return the same pixmap!
- {
- p2 =
- XCreateInsensitivePixmap(DisplayOfScreen(XtScreen(buttonWidget)), p1);
- m_insensPixmap = (WXPixmap) p2;
- }
-
- XtVaSetValues (buttonWidget,
- XmNlabelPixmap, p1,
- XmNlabelInsensitivePixmap, p2,
- XmNarmPixmap, (Pixmap) ((wxBitmap&)bitmap).GetArmPixmap (m_mainWidget),
- XmNlabelType, XmPIXMAP,
- NULL);
- }
+ DoSetBitmap();
XtAddCallback (buttonWidget, XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
(XtPointer) this);
SetFont(* parent->GetFont());
- ChangeBackgroundColour ();
-
return TRUE;
}
void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
{
+ m_buttonBitmapOriginal = bitmap;
m_buttonBitmap = bitmap;
- if (bitmap.Ok())
+ DoSetBitmap();
+}
+
+void wxBitmapButton::SetBitmapSelected(const wxBitmap& sel)
+{
+ m_buttonBitmapSelected = sel;
+ m_buttonBitmapSelectedOriginal = sel;
+
+ DoSetBitmap();
+};
+
+void wxBitmapButton::SetBitmapFocus(const wxBitmap& focus)
+{
+ m_buttonBitmapFocus = focus;
+ // Not used in Motif
+};
+
+void wxBitmapButton::SetBitmapDisabled(const wxBitmap& disabled)
+{
+ m_buttonBitmapDisabled = disabled;
+ m_buttonBitmapDisabledOriginal = disabled;
+
+ DoSetBitmap();
+};
+
+void wxBitmapButton::DoSetBitmap()
+{
+ if (m_buttonBitmapOriginal.Ok())
{
- Pixmap labelPixmap, insensPixmap, armPixmap;
+ Pixmap pixmap = 0;
+ Pixmap insensPixmap = 0;
+ Pixmap armPixmap = 0;
- labelPixmap = (Pixmap) ((wxBitmap&)bitmap).GetLabelPixmap(m_mainWidget);
+ // Must re-make the bitmap to have its transparent areas drawn
+ // in the current widget background colour.
+ if (m_buttonBitmapOriginal.GetMask())
+ {
+ int backgroundPixel;
+ XtVaGetValues((Widget) m_mainWidget, XmNbackground, &backgroundPixel,
+ NULL);
+
+ wxColour col;
+ col.SetPixel(backgroundPixel);
+
+ wxBitmap newBitmap = wxCreateMaskedBitmap(m_buttonBitmapOriginal, col);
+ m_buttonBitmap = newBitmap;
- if (m_buttonBitmapSelected.Ok())
- armPixmap = (Pixmap) m_buttonBitmapSelected.GetLabelPixmap(m_mainWidget);
+ pixmap = (Pixmap) m_buttonBitmap.GetPixmap();
+ }
else
- armPixmap = (Pixmap) ((wxBitmap&)bitmap).GetArmPixmap(m_mainWidget);
+ pixmap = (Pixmap) m_buttonBitmap.GetLabelPixmap(m_mainWidget);
- if (m_buttonBitmapDisabled.Ok())
- insensPixmap = (Pixmap) m_buttonBitmapDisabled.GetLabelPixmap(m_mainWidget);
+ if (m_buttonBitmapDisabledOriginal.Ok())
+ {
+ if (m_buttonBitmapDisabledOriginal.GetMask())
+ {
+ int backgroundPixel;
+ XtVaGetValues((Widget) m_mainWidget, XmNbackground, &backgroundPixel,
+ NULL);
+
+ wxColour col;
+ col.SetPixel(backgroundPixel);
+
+ wxBitmap newBitmap = wxCreateMaskedBitmap(m_buttonBitmapDisabledOriginal, col);
+ m_buttonBitmapDisabled = newBitmap;
+
+ insensPixmap = (Pixmap) m_buttonBitmapDisabled.GetPixmap();
+ }
+ else
+ insensPixmap = (Pixmap) m_buttonBitmap.GetInsensPixmap(m_mainWidget);
+ }
else
- insensPixmap = (Pixmap) ((wxBitmap&)bitmap).GetInsensPixmap(m_mainWidget);
+ insensPixmap = (Pixmap) m_buttonBitmap.GetInsensPixmap(m_mainWidget);
- if (!insensPixmap || (insensPixmap == labelPixmap)) // <- the Get...Pixmap()-functions return the same pixmap!
+ // Now make the bitmap representing the armed state
+ if (m_buttonBitmapSelectedOriginal.Ok())
{
- insensPixmap = XCreateInsensitivePixmap(DisplayOfScreen(XtScreen((Widget) m_mainWidget)), labelPixmap);
+ if (m_buttonBitmapSelectedOriginal.GetMask())
+ {
+ int backgroundPixel;
+ XtVaGetValues((Widget) m_mainWidget, XmNarmColor, &backgroundPixel,
+ NULL);
+
+ wxColour col;
+ col.SetPixel(backgroundPixel);
+
+ wxBitmap newBitmap = wxCreateMaskedBitmap(m_buttonBitmapSelectedOriginal, col);
+ m_buttonBitmapSelected = newBitmap;
+
+ armPixmap = (Pixmap) m_buttonBitmapSelected.GetPixmap();
+ }
+ else
+ armPixmap = (Pixmap) m_buttonBitmap.GetArmPixmap(m_mainWidget);
+ }
+ else
+ armPixmap = (Pixmap) m_buttonBitmap.GetArmPixmap(m_mainWidget);
+
+ if (insensPixmap == pixmap) // <- the Get...Pixmap()-functions return the same pixmap!
+ {
+ insensPixmap =
+ XCreateInsensitivePixmap(DisplayOfScreen(XtScreen((Widget) m_mainWidget)), pixmap);
m_insensPixmap = (WXPixmap) insensPixmap;
}
XtVaSetValues ((Widget) m_mainWidget,
- XmNlabelPixmap, labelPixmap,
- XmNlabelInsensitivePixmap, insensPixmap,
+ XmNlabelPixmap, pixmap,
+ XmNlabelInsensitivePixmap, insensPixmap,
XmNarmPixmap, armPixmap,
XmNlabelType, XmPIXMAP,
NULL);
XtVaSetValues ((Widget) m_mainWidget,
XmNlabelType, XmSTRING,
XmNlabelPixmap, XmUNSPECIFIED_PIXMAP,
- XmNlabelInsensitivePixmap, NULL,
- XmNarmPixmap, NULL,
+ XmNlabelInsensitivePixmap, XmUNSPECIFIED_PIXMAP,
+ XmNarmPixmap, XmUNSPECIFIED_PIXMAP,
NULL);
}
}
-void wxBitmapButton::SetBitmapSelected(const wxBitmap& sel)
+void wxBitmapButton::ChangeBackgroundColour()
{
- m_buttonBitmapSelected = sel;
-};
-
-void wxBitmapButton::SetBitmapFocus(const wxBitmap& focus)
-{
- m_buttonBitmapFocus = focus;
- // Not used in Motif
-};
-
-void wxBitmapButton::SetBitmapDisabled(const wxBitmap& disabled)
-{
- m_buttonBitmapDisabled = disabled;
-};
-
+ DoChangeBackgroundColour(m_mainWidget, m_backgroundColour, TRUE);
+ // Must reset the bitmaps since the colours have changed.
+ DoSetBitmap();
+}
void wxButton::ChangeFont()
{
- // TODO
+ wxWindow::ChangeFont();
}
void wxButton::ChangeBackgroundColour()
{
- // TODO
+ DoChangeBackgroundColour(m_mainWidget, m_backgroundColour, TRUE);
}
void wxButton::ChangeForegroundColour()
{
- // TODO
+ wxWindow::ChangeForegroundColour();
}
void wxCheckBox::ChangeFont()
{
- // TODO
+ wxWindow::ChangeFont();
}
void wxCheckBox::ChangeBackgroundColour()
{
- // TODO
+ wxComputeColours (XtDisplay((Widget) m_mainWidget), & m_backgroundColour,
+ (wxColour*) NULL);
+
+ XtVaSetValues ((Widget) m_mainWidget,
+ XmNbackground, g_itemColors[wxBACK_INDEX].pixel,
+ XmNtopShadowColor, g_itemColors[wxTOPS_INDEX].pixel,
+ XmNbottomShadowColor, g_itemColors[wxBOTS_INDEX].pixel,
+ XmNforeground, g_itemColors[wxFORE_INDEX].pixel,
+ NULL);
+
+ XtVaSetValues ((Widget) m_mainWidget,
+ XmNselectColor, g_itemColors[wxSELE_INDEX].pixel,
+ NULL);
}
void wxCheckBox::ChangeForegroundColour()
{
- // TODO
+ wxWindow::ChangeForegroundColour();
}
-
#endif
NULL);
+ DoChangeBackgroundColour((WXWidget) w, m_backgroundColour);
+
if (m_windowFont.Ok())
XtVaSetValues (w,
XmNfontList, (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay((Widget) m_formWidget)),
void wxChoice::ChangeFont()
{
- // TODO
+ // Note that this causes the widget to be resized back
+ // to its original size! We therefore have to set the size
+ // back again. TODO: a better way in Motif?
+ if (m_windowFont.Ok())
+ {
+ int width, height, width1, height1;
+ GetSize(& width, & height);
+
+ XmFontList fontList = (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay((Widget) m_mainWidget));
+ XtVaSetValues ((Widget) m_mainWidget, XmNfontList, fontList, NULL);
+ XtVaSetValues ((Widget) m_buttonWidget, XmNfontList, fontList, NULL);
+
+ int i;
+ for (i = 0; i < m_noStrings; i++)
+ XtVaSetValues ((Widget) m_widgetList[i], XmNfontList, fontList, NULL);
+ GetSize(& width1, & height1);
+ if (width != width1 || height != height1)
+ {
+ SetSize(-1, -1, width, height);
+ }
+ }
}
void wxChoice::ChangeBackgroundColour()
{
- // TODO
+ DoChangeBackgroundColour(m_formWidget, m_backgroundColour);
+ DoChangeBackgroundColour(m_buttonWidget, m_backgroundColour);
+ DoChangeBackgroundColour(m_menuWidget, m_backgroundColour);
+ int i;
+ for (i = 0; i < m_noStrings; i++)
+ DoChangeBackgroundColour(m_widgetList[i], m_backgroundColour);
}
void wxChoice::ChangeForegroundColour()
{
- // TODO
+ DoChangeForegroundColour(m_formWidget, m_foregroundColour);
+ DoChangeForegroundColour(m_buttonWidget, m_foregroundColour);
+ DoChangeForegroundColour(m_menuWidget, m_foregroundColour);
+ int i;
+ for (i = 0; i < m_noStrings; i++)
+ DoChangeForegroundColour(m_widgetList[i], m_foregroundColour);
}
-
void wxComboBox::ChangeFont()
{
- // TODO
+ // Don't use the base class wxChoice's ChangeFont
+ wxWindow::ChangeFont();
}
void wxComboBox::ChangeBackgroundColour()
{
- // TODO
+ wxWindow::ChangeBackgroundColour();
}
void wxComboBox::ChangeForegroundColour()
{
- // TODO
+ wxWindow::ChangeBackgroundColour();
}
#endif
(XtPointer)this);
ChangeBackgroundColour();
+ SetFont(* parent->GetFont());
return TRUE;
}
void wxGauge::ChangeFont()
{
- // TODO
+ wxWindow::ChangeFont();
}
void wxGauge::ChangeBackgroundColour()
{
- // TODO
+ wxWindow::ChangeBackgroundColour();
}
void wxGauge::ChangeForegroundColour()
{
- // TODO
+ wxWindow::ChangeForegroundColour();
}
//// PRIVATE DECLARATIONS FOR XMGAUGE
void wxListBox::ChangeFont()
{
- // TODO
+ wxWindow::ChangeFont();
}
void wxListBox::ChangeBackgroundColour()
{
- // TODO
+ wxWindow::ChangeBackgroundColour();
}
void wxListBox::ChangeForegroundColour()
{
- // TODO
+ wxWindow::ChangeForegroundColour();
}
wxRadioButton::wxRadioButton()
{
- m_labelWidget = (WXWidget) 0;
- m_formWidget = (WXWidget) 0;
}
bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
- Widget formWidget = XtVaCreateManagedWidget ((char*) (const char*) name,
- xmFormWidgetClass, parentWidget,
- XmNmarginHeight, 0,
- XmNmarginWidth, 0,
- NULL);
-
- m_formWidget = (WXWidget) formWidget;
-
- Widget labelWidget = XtVaCreateManagedWidget ((char*) (const char*) label1,
-#if wxUSE_GADGETS
- xmLabelGadgetClass,
- formWidget,
-#else
- xmLabelWidgetClass, formWidget,
-#endif
- XmNlabelString, text,
- NULL);
- m_labelWidget = (WXWidget) labelWidget;
-/* TODO
- if (labelFont)
- XtVaSetValues (labelWidget,
- XmNfontList, labelFont->GetInternalFont (XtDisplay(formWidget)),
- NULL);
-*/
-
- XmStringFree (text);
Widget radioButtonWidget = XtVaCreateManagedWidget ("toggle",
#if wxUSE_GADGETS
- xmToggleButtonGadgetClass, formWidget,
+ xmToggleButtonGadgetClass, parentWidget,
#else
- xmToggleButtonWidgetClass, formWidget,
+ xmToggleButtonWidgetClass, parentWidget,
#endif
+ XmNlabelString, text,
+ XmNfillOnSelect, True,
+ XmNindicatorType, XmONE_OF_MANY, // diamond-shape
NULL);
+ XmStringFree (text);
+
XtAddCallback (radioButtonWidget, XmNvalueChangedCallback, (XtCallbackProc) wxRadioButtonCallback,
(XtCallbackProc) this);
m_mainWidget = (WXWidget) radioButtonWidget;
-/* TODO
- if (labelFont)
- XtVaSetValues (radioButtonWidget,
- XmNfontList, labelFont->GetInternalFont (XtDisplay(formWidget)),
- NULL);
-*/
-
- if (labelWidget)
- XtVaSetValues (labelWidget,
- XmNtopAttachment, XmATTACH_FORM,
- XmNleftAttachment, XmATTACH_FORM,
- XmNbottomAttachment, XmATTACH_FORM,
- XmNalignment, XmALIGNMENT_BEGINNING,
- NULL);
- XtVaSetValues (radioButtonWidget,
- XmNleftOffset, 4,
- XmNtopAttachment, XmATTACH_FORM,
- XmNbottomAttachment, XmATTACH_FORM,
- XmNleftAttachment, (Widget) m_labelWidget ? XmATTACH_WIDGET : XmATTACH_FORM,
- XmNleftWidget, (Widget) m_labelWidget ? (Widget) m_labelWidget : formWidget,
- NULL);
-
XtManageChild (radioButtonWidget);
SetCanAddEventHandler(TRUE);
- AttachWidget (parent, m_mainWidget, m_formWidget, pos.x, pos.y, size.x, size.y);
+ AttachWidget (parent, m_mainWidget, NULL, pos.x, pos.y, size.x, size.y);
SetFont(* parent->GetFont());
ChangeBackgroundColour();
void wxRadioButton::ChangeFont()
{
- // TODO
+ wxWindow::ChangeFont();
}
void wxRadioButton::ChangeBackgroundColour()
{
- // TODO
+ wxWindow::ChangeBackgroundColour();
}
void wxRadioButton::ChangeForegroundColour()
{
- // TODO
+ wxWindow::ChangeForegroundColour();
}
void wxRadioButtonCallback (Widget w, XtPointer clientData,
void wxSlider::ChangeFont()
{
- // TODO
+ wxWindow::ChangeFont();
}
void wxSlider::ChangeBackgroundColour()
{
- // TODO
+ wxWindow::ChangeBackgroundColour();
}
void wxSlider::ChangeForegroundColour()
{
- // TODO
+ wxWindow::ChangeForegroundColour();
}
void wxSliderCallback (Widget widget, XtPointer clientData, XmScaleCallbackStruct * cbs)
void wxStaticBitmap::ChangeFont()
{
- // TODO
+ wxWindow::ChangeFont();
}
void wxStaticBitmap::ChangeBackgroundColour()
{
- // TODO
+ wxWindow::ChangeBackgroundColour();
}
void wxStaticBitmap::ChangeForegroundColour()
{
- // TODO
+ wxWindow::ChangeForegroundColour();
}
void wxStaticBox::ChangeFont()
{
- // TODO
+ wxWindow::ChangeFont();
}
void wxStaticBox::ChangeBackgroundColour()
{
- // TODO
+ wxWindow::ChangeBackgroundColour();
}
void wxStaticBox::ChangeForegroundColour()
{
- // TODO
+ wxWindow::ChangeForegroundColour();
}
void wxStaticText::ChangeFont()
{
- // TODO
+ wxWindow::ChangeFont();
}
void wxStaticText::ChangeBackgroundColour()
{
- // TODO
+ wxWindow::ChangeBackgroundColour();
}
void wxStaticText::ChangeForegroundColour()
{
- // TODO
+ wxWindow::ChangeForegroundColour();
}
void wxTextCtrl::ChangeFont()
{
- // TODO
+ wxWindow::ChangeFont();
}
void wxTextCtrl::ChangeBackgroundColour()
{
- // TODO
+ wxWindow::ChangeBackgroundColour();
}
void wxTextCtrl::ChangeForegroundColour()
{
- // TODO
+ wxWindow::ChangeForegroundColour();
}
static void wxTextWindowChangedProc (Widget w, XtPointer clientData, XtPointer ptr)
static void wxToolButtonPopupCallback (Widget w, XtPointer client_data,
XEvent *event, Boolean *continue_to_dispatch);
-wxBitmap wxCreateMaskedBitmap(wxBitmap& bitmap, wxColour& colour);
-
class wxToolBarTimer: public wxTimer
{
public:
}
-// Creates a bitmap with transparent areas drawn in
-// the given colour.
-wxBitmap wxCreateMaskedBitmap(wxBitmap& bitmap, wxColour& colour)
-{
- wxBitmap newBitmap(bitmap.GetWidth(),
- bitmap.GetHeight(),
- bitmap.GetDepth());
- wxMemoryDC destDC;
- wxMemoryDC srcDC;
- srcDC.SelectObject(bitmap);
- destDC.SelectObject(newBitmap);
-
- wxBrush brush(colour, wxSOLID);
- destDC.SetOptimization(FALSE);
- destDC.SetBackground(brush);
- destDC.Clear();
- destDC.Blit(0, 0, bitmap.GetWidth(), bitmap.GetHeight(), & srcDC, 0, 0, wxCOPY, TRUE);
-
- return newBitmap;
-}
-
static void wxToolButtonPopupCallback (Widget w, XtPointer client_data,
XEvent *event, Boolean *continue_to_dispatch)
// Change a widget's foreground and background colours.
-// TODO: make this 2 functions, ChangeForegroundColour and ChangeBackgroundColour.
-
void wxWindow::DoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour)
{
// When should we specify the foreground, if it's calculated
// Note that this causes the widget to be resized back
// to its original size! We therefore have to set the size
// back again. TODO: a better way in Motif?
- /*
Widget w = (Widget) GetLabelWidget(); // Usually the main widget
if (w && m_windowFont.Ok())
{
SetSize(-1, -1, width, height);
}
}
- */
}
void wxWindow::SetFont(const wxFont& font)
Create(sFileName, isResource);
}
+wxWave::wxWave(int size, const byte* data)
+ : m_waveLength(0), m_isResource(FALSE), m_waveData(NULL)
+{
+ Create(size, data);
+}
wxWave::~wxWave()
{
}
}
+bool wxWave::Create(int size, const byte* data)
+{
+ Free();
+ m_isResource = FALSE;
+ m_waveLength=size;
+ m_waveData = (byte*)::GlobalLock(::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, m_waveLength));
+ if (!m_waveData)
+ return FALSE;
+
+ for (int i=0; i<size; i++) m_waveData[i] = data[i];
+ return TRUE;
+}
+
bool wxWave::Play(bool async, bool looped) const
{
if (!IsOk())