Fixed various wxMSW compile problems that came down the telephone line...

plus wxTreeCtrl::EditLabel/EndEditLabel, dialog editor stuff, wxMSW header changes,
doc changes. Sorry about the quantity :-(


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@468 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-08-07 23:52:45 +00:00
parent c2d8daeb4a
commit bbcdf8bc7c
110 changed files with 1009 additions and 833 deletions

View File

@@ -672,6 +672,10 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, PrologExpr *ex
expr->AssignAttributeValue("label_colour", &labelColourHex);
expr->AssignAttributeValue("button_colour", &buttonColourHex);
long id = 0;
expr->GetAttributeValue("id", id);
dialogItem->SetId(id);
if (style)
{
windowStyle = wxParseWindowStyle(style);
@@ -1845,6 +1849,7 @@ static wxResourceBitListStruct wxResourceBitListTable[] =
/* wxTreeCtrl */
{ "wxTR_HAS_BUTTONS", wxTR_HAS_BUTTONS },
{ "wxTR_EDIT_LABELS", wxTR_EDIT_LABELS },
{ "wxTR_LINES_AT_ROOT", wxTR_LINES_AT_ROOT },
/* wxListCtrl */
{ "wxLC_ICON", wxLC_ICON },
@@ -1892,6 +1897,9 @@ static wxResourceBitListStruct wxResourceBitListTable[] =
/* wxToolBar */
{ "wxTB_3DBUTTONS", wxTB_3DBUTTONS},
{ "wxTB_HORIZONTAL", wxTB_HORIZONTAL},
{ "wxTB_VERTICAL", wxTB_VERTICAL},
{ "wxTB_FLAT", wxTB_FLAT},
/* Generic */
{ "wxVSCROLL", wxVSCROLL },
@@ -2907,6 +2915,7 @@ bool wxWindow::LoadFromResource(wxWindow *parent, const wxString& resourceName,
long modalStyle = isModal ? wxDIALOG_MODAL : 0;
if (!dialogBox->Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), theWindowStyle|modalStyle, name))
return FALSE;
dialogBox->SetClientSize(width, height);
}
else
{

View File

@@ -53,9 +53,11 @@
#endif
// use debug CRT functions for memory leak detections in VC++
/* THIS CRAPS OUT in VC++ 5.
#if defined(__WXDEBUG__) && defined(_MSC_VER)
#include <crtdbg.h>
#endif
*/
extern char *wxBuffer;
extern char *wxOsVersion;
@@ -430,12 +432,15 @@ int wxEntry(WXHINSTANCE hInstance, WXHINSTANCE WXUNUSED(hPrevInstance), char *m_
{
wxhInstance = (HINSTANCE) hInstance;
/* No, sorry, whatever this is, forget it. Doesn't work with VC++ 5.
#if defined(__WXDEBUG__) && defined(_MSC_VER)
// do check for memory leaks on program exit
// (another useful flag is _CRTDBG_DELAY_FREE_MEM_DF which doesn't free
// deallocated memory which may be used to simulate low-memory condition)
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
#endif // debug build under MS VC++
*/
#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT

View File

@@ -58,7 +58,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
if (parent) parent->AddChild(this);
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
SetForegroundColour(parent->GetDefaultForegroundColour()) ;
no_strings = n;
m_noStrings = n;
m_windowStyle = style;
@@ -121,19 +121,19 @@ void wxChoice::Append(const wxString& item)
{
SendMessage((HWND) GetHWND(), CB_ADDSTRING, 0, (LONG)(const char *)item);
no_strings ++;
m_noStrings ++;
}
void wxChoice::Delete(int n)
{
no_strings = (int)SendMessage((HWND) GetHWND(), CB_DELETESTRING, n, 0);
m_noStrings = (int)SendMessage((HWND) GetHWND(), CB_DELETESTRING, n, 0);
}
void wxChoice::Clear(void)
{
SendMessage((HWND) GetHWND(), CB_RESETCONTENT, 0, 0);
no_strings = 0;
m_noStrings = 0;
}
@@ -218,14 +218,14 @@ void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
if (width <= 0)
{
// Find the longest string
if (no_strings == 0)
if (m_noStrings == 0)
control_width = (float)100.0;
else
{
int len, ht;
float longest = (float)0.0;
int i;
for (i = 0; i < no_strings; i++)
for (i = 0; i < m_noStrings; i++)
{
wxString str(GetString(i));
GetTextExtent(str, &len, &ht, NULL, NULL,GetFont());
@@ -239,9 +239,9 @@ void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
// Choice drop-down list depends on number of items (limited to 10)
if (h1 <= 0)
{
if (no_strings == 0)
if (m_noStrings == 0)
h1 = (int)(EDIT_CONTROL_FACTOR*cy*10.0);
else h1 = (int)(EDIT_CONTROL_FACTOR*cy*(wxMin(10, no_strings) + 1));
else h1 = (int)(EDIT_CONTROL_FACTOR*cy*(wxMin(10, m_noStrings) + 1));
}
// If non-default width...

View File

@@ -59,7 +59,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
wxColourDialog::wxColourDialog(void)
{
dialogParent = NULL;
m_dialogParent = NULL;
}
wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data)
@@ -69,10 +69,10 @@ wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data)
bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
{
dialogParent = parent;
m_dialogParent = parent;
if (data)
colourData = *data;
m_colourData = *data;
return TRUE;
}
@@ -84,16 +84,16 @@ int wxColourDialog::ShowModal(void)
int i;
for (i = 0; i < 16; i++)
custColours[i] = RGB(colourData.custColours[i].Red(), colourData.custColours[i].Green(), colourData.custColours[i].Blue());
custColours[i] = RGB(m_colourData.custColours[i].Red(), m_colourData.custColours[i].Green(), m_colourData.custColours[i].Blue());
chooseColorStruct.lStructSize = sizeof(CHOOSECOLOR);
chooseColorStruct.hwndOwner = (HWND) (dialogParent ? (HWND) dialogParent->GetHWND() : NULL);
chooseColorStruct.rgbResult = RGB(colourData.dataColour.Red(), colourData.dataColour.Green(), colourData.dataColour.Blue());
chooseColorStruct.hwndOwner = (HWND) (m_dialogParent ? (HWND) m_dialogParent->GetHWND() : NULL);
chooseColorStruct.rgbResult = RGB(m_colourData.dataColour.Red(), m_colourData.dataColour.Green(), m_colourData.dataColour.Blue());
chooseColorStruct.lpCustColors = custColours;
chooseColorStruct.Flags = CC_RGBINIT;
if (!colourData.GetChooseFull())
if (!m_colourData.GetChooseFull())
chooseColorStruct.Flags |= CC_PREVENTFULLOPEN;
// Do the modal dialog
@@ -112,11 +112,11 @@ int wxColourDialog::ShowModal(void)
// Restore values
for (i = 0; i < 16; i++)
{
colourData.custColours[i].Set(GetRValue(custColours[i]), GetGValue(custColours[i]),
m_colourData.custColours[i].Set(GetRValue(custColours[i]), GetGValue(custColours[i]),
GetBValue(custColours[i]));
}
colourData.dataColour.Set(GetRValue(chooseColorStruct.rgbResult), GetGValue(chooseColorStruct.rgbResult),
m_colourData.dataColour.Set(GetRValue(chooseColorStruct.rgbResult), GetGValue(chooseColorStruct.rgbResult),
GetBValue(chooseColorStruct.rgbResult));
return success ? wxID_OK : wxID_CANCEL;

View File

@@ -71,7 +71,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
if (parent) parent->AddChild(this);
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
SetForegroundColour(parent->GetDefaultForegroundColour()) ;
no_strings = n;
m_noStrings = n;
m_windowStyle = style;

View File

@@ -59,7 +59,7 @@ END_EVENT_TABLE()
long wxDialog::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
return ::CallWindowProc((FARPROC)m_oldWndProc, (HWND) GetHWND(), (UINT) nMsg, (WPARAM) wParam, (LPARAM) lParam);
return ::CallWindowProc(CASTWNDPROC m_oldWndProc, (HWND) GetHWND(), (UINT) nMsg, (WPARAM) wParam, (LPARAM) lParam);
}
bool wxDialog::MSWProcessMessage(WXMSG* pMsg)

View File

@@ -56,7 +56,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
wxFontDialog::wxFontDialog(void)
{
dialogParent = NULL;
m_dialogParent = NULL;
}
wxFontDialog::wxFontDialog(wxWindow *parent, wxFontData *data)
@@ -66,10 +66,10 @@ wxFontDialog::wxFontDialog(wxWindow *parent, wxFontData *data)
bool wxFontDialog::Create(wxWindow *parent, wxFontData *data)
{
dialogParent = parent;
m_dialogParent = parent;
if (data)
fontData = *data;
m_fontData = *data;
return TRUE;
}
@@ -83,28 +83,28 @@ int wxFontDialog::ShowModal(void)
memset(&chooseFontStruct, 0, sizeof(CHOOSEFONT));
chooseFontStruct.lStructSize = sizeof(CHOOSEFONT);
chooseFontStruct.hwndOwner = (HWND) (dialogParent ? (HWND) dialogParent->GetHWND() : NULL);
chooseFontStruct.hwndOwner = (HWND) (m_dialogParent ? (HWND) m_dialogParent->GetHWND() : NULL);
chooseFontStruct.lpLogFont = &logFont;
if (fontData.initialFont.Ok())
if (m_fontData.initialFont.Ok())
{
flags |= CF_INITTOLOGFONTSTRUCT;
wxFillLogFont(&logFont, & fontData.initialFont);
wxFillLogFont(&logFont, & m_fontData.initialFont);
}
chooseFontStruct.iPointSize = 0;
chooseFontStruct.rgbColors = RGB((BYTE)fontData.fontColour.Red(), (BYTE)fontData.fontColour.Green(), (BYTE)fontData.fontColour.Blue());
chooseFontStruct.rgbColors = RGB((BYTE)m_fontData.fontColour.Red(), (BYTE)m_fontData.fontColour.Green(), (BYTE)m_fontData.fontColour.Blue());
if (!fontData.GetAllowSymbols())
if (!m_fontData.GetAllowSymbols())
flags |= CF_ANSIONLY;
if (fontData.GetEnableEffects())
if (m_fontData.GetEnableEffects())
flags |= CF_EFFECTS;
if (fontData.GetShowHelp())
if (m_fontData.GetShowHelp())
flags |= CF_SHOWHELP;
if (!(fontData.minSize == 0 && fontData.maxSize == 0))
if (!(m_fontData.minSize == 0 && m_fontData.maxSize == 0))
{
chooseFontStruct.nSizeMin = fontData.minSize;
chooseFontStruct.nSizeMax = fontData.maxSize;
chooseFontStruct.nSizeMin = m_fontData.minSize;
chooseFontStruct.nSizeMax = m_fontData.maxSize;
flags |= CF_LIMITSIZE;
}
@@ -115,9 +115,9 @@ int wxFontDialog::ShowModal(void)
// Restore values
if (success)
{
fontData.fontColour.Set(GetRValue(chooseFontStruct.rgbColors), GetGValue(chooseFontStruct.rgbColors),
m_fontData.fontColour.Set(GetRValue(chooseFontStruct.rgbColors), GetGValue(chooseFontStruct.rgbColors),
GetBValue(chooseFontStruct.rgbColors));
fontData.chosenFont = wxCreateFontFromLogFont(&logFont);
m_fontData.chosenFont = wxCreateFontFromLogFont(&logFont);
}
return success ? wxID_OK : wxID_CANCEL;

View File

@@ -54,6 +54,7 @@ wxListCtrl::wxListCtrl(void)
m_imageListState = NULL;
m_baseStyle = 0;
m_colCount = 0;
m_textCtrl = NULL;
}
bool wxListCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
@@ -62,6 +63,7 @@ bool wxListCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, con
m_imageListNormal = NULL;
m_imageListSmall = NULL;
m_imageListState = NULL;
m_textCtrl = NULL;
m_colCount = 0;
wxSystemSettings settings;
@@ -129,7 +131,13 @@ bool wxListCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, con
wxListCtrl::~wxListCtrl(void)
{
m_textCtrl.SetHWND((WXHWND) NULL);
if (m_textCtrl)
{
m_textCtrl->UnsubclassWin();
m_textCtrl->SetHWND(0);
delete m_textCtrl;
m_textCtrl = NULL;
}
}
// Add or remove a single window style
@@ -441,11 +449,9 @@ int wxListCtrl::GetCountPerPage(void) const
}
// Gets the edit control for editing labels.
wxTextCtrl& wxListCtrl::GetEditControl(void) const
wxTextCtrl* wxListCtrl::GetEditControl(void) const
{
HWND hWnd = (HWND) ListView_GetEditControl((HWND) GetHWND());
((wxListCtrl *)this)->m_textCtrl.SetHWND((WXHWND) hWnd);
return (wxTextCtrl&)m_textCtrl;
return m_textCtrl;
}
// Gets information about the item
@@ -806,14 +812,49 @@ void wxListCtrl::ClearAll(void)
DeleteAllColumns();
}
// Edits a label
wxTextCtrl& wxListCtrl::Edit(long item)
wxTextCtrl* wxListCtrl::EditLabel(long item, wxClassInfo* textControlClass)
{
HWND hWnd = (HWND) ListView_EditLabel((HWND) GetHWND(), (int) item);
m_textCtrl.SetHWND((WXHWND) hWnd);
return m_textCtrl;
wxASSERT( (textControlClass->IsKindOf(CLASSINFO(wxTextCtrl))) );
HWND hWnd = (HWND) ListView_EditLabel((HWND) GetHWND(), item);
if (m_textCtrl)
{
m_textCtrl->UnsubclassWin();
m_textCtrl->SetHWND(0);
delete m_textCtrl;
m_textCtrl = NULL;
}
m_textCtrl = (wxTextCtrl*) textControlClass->CreateObject();
m_textCtrl->SetHWND((WXHWND) hWnd);
m_textCtrl->SubclassWin((WXHWND) hWnd);
return m_textCtrl;
}
// End label editing, optionally cancelling the edit
bool wxListCtrl::EndEditLabel(bool cancel)
{
wxASSERT( FALSE);
/* I don't know how to implement this: there's no such macro as ListView_EndEditLabelNow.
* ???
bool success = (ListView_EndEditLabelNow((HWND) GetHWND(), cancel) != 0);
if (m_textCtrl)
{
m_textCtrl->UnsubclassWin();
m_textCtrl->SetHWND(0);
delete m_textCtrl;
m_textCtrl = NULL;
}
return success;
*/
return FALSE;
}
// Ensures this item is visible
bool wxListCtrl::EnsureVisible(long item)
{

View File

@@ -1223,7 +1223,7 @@ long wxMDIClientWindow::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPa
long wxMDIClientWindow::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
if ( MSWGetOldWndProc() != 0)
return ::CallWindowProc((FARPROC)MSWGetOldWndProc(), (HWND) GetHWND(), (UINT) nMsg, (WPARAM) wParam, (LPARAM) lParam);
return ::CallWindowProc(CASTWNDPROC MSWGetOldWndProc(), (HWND) GetHWND(), (UINT) nMsg, (WPARAM) wParam, (LPARAM) lParam);
else
return ::DefWindowProc((HWND) m_hWnd, (UINT) nMsg, (WPARAM) wParam, (LPARAM) lParam);
}

View File

@@ -45,7 +45,7 @@ long wxMiniFrame::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam
(GetWindowStyleFlag() & wxTINY_CAPTION_VERT))
return ::ibDefWindowProc((HWND) GetHWND(), nMsg, wParam, lParam);
else if ( m_oldWndProc )
return ::CallWindowProc((FARPROC)m_oldWndProc, (HWND) GetHWND(), (UINT) nMsg, (WPARAM) wParam, (LPARAM) lParam);
return ::CallWindowProc(CASTWNDPROC m_oldWndProc, (HWND) GetHWND(), (UINT) nMsg, (WPARAM) wParam, (LPARAM) lParam);
else
return ::DefWindowProc((HWND) GetHWND(), nMsg, wParam, lParam);
}

View File

@@ -53,6 +53,7 @@ wxTreeCtrl::wxTreeCtrl(void)
{
m_imageListNormal = NULL;
m_imageListState = NULL;
m_textCtrl = NULL;
}
bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
@@ -67,6 +68,7 @@ bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, con
m_imageListNormal = NULL;
m_imageListState = NULL;
m_textCtrl = NULL;
int x = pos.x;
int y = pos.y;
@@ -131,7 +133,12 @@ bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, con
wxTreeCtrl::~wxTreeCtrl(void)
{
m_textCtrl.SetHWND((WXHWND) NULL);
if (m_textCtrl)
{
m_textCtrl->UnsubclassWin();
m_textCtrl->SetHWND((WXHWND) 0);
delete m_textCtrl;
}
}
// Attributes
@@ -412,11 +419,9 @@ bool wxTreeCtrl::GetItemRect(long item, wxRectangle& rect, bool textOnly) const
return success;
}
wxTextCtrl& wxTreeCtrl::GetEditControl(void) const
wxTextCtrl* wxTreeCtrl::GetEditControl(void) const
{
HWND hWnd = (HWND) TreeView_GetEditControl((HWND) GetHWND());
((wxTreeCtrl *)this)->m_textCtrl.SetHWND((WXHWND) hWnd);
return (wxTextCtrl&) m_textCtrl;
return m_textCtrl;
}
// Operations
@@ -527,11 +532,40 @@ bool wxTreeCtrl::DeleteAllItems(void)
return (TreeView_DeleteAllItems((HWND) GetHWND()) != 0);
}
wxTextCtrl& wxTreeCtrl::Edit(long item)
wxTextCtrl* wxTreeCtrl::EditLabel(long item, wxClassInfo* textControlClass)
{
HWND hWnd = (HWND) TreeView_EditLabel((HWND) GetHWND(), item);
m_textCtrl.SetHWND((WXHWND) hWnd);
return m_textCtrl;
wxASSERT( (textControlClass->IsKindOf(CLASSINFO(wxTextCtrl))) );
HWND hWnd = (HWND) TreeView_EditLabel((HWND) GetHWND(), item);
if (m_textCtrl)
{
m_textCtrl->UnsubclassWin();
m_textCtrl->SetHWND(0);
delete m_textCtrl;
m_textCtrl = NULL;
}
m_textCtrl = (wxTextCtrl*) textControlClass->CreateObject();
m_textCtrl->SetHWND((WXHWND) hWnd);
m_textCtrl->SubclassWin((WXHWND) hWnd);
return m_textCtrl;
}
// End label editing, optionally cancelling the edit
bool wxTreeCtrl::EndEditLabel(bool cancel)
{
bool success = (TreeView_EndEditLabelNow((HWND) GetHWND(), cancel) != 0);
if (m_textCtrl)
{
m_textCtrl->UnsubclassWin();
m_textCtrl->SetHWND(0);
delete m_textCtrl;
m_textCtrl = NULL;
}
return success;
}
long wxTreeCtrl::HitTest(const wxPoint& point, int& flags)

View File

@@ -1874,7 +1874,7 @@ void wxWindow::OnSysColourChanged(wxSysColourChangedEvent& event)
long wxWindow::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
if ( m_oldWndProc )
return ::CallWindowProc((FARPROC)m_oldWndProc, (HWND) GetHWND(), (UINT) nMsg, (WPARAM) wParam, (LPARAM) lParam);
return ::CallWindowProc(CASTWNDPROC m_oldWndProc, (HWND) GetHWND(), (UINT) nMsg, (WPARAM) wParam, (LPARAM) lParam);
else
return ::DefWindowProc((HWND) GetHWND(), nMsg, wParam, lParam);
}