Fixes for the outstanding errors in minimal.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7184 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster
2000-04-16 21:31:58 +00:00
parent 231237044b
commit 831026c188
4 changed files with 186 additions and 96 deletions

View File

@@ -22,25 +22,34 @@
WXDLLEXPORT_DATA(extern const char*) wxMessageBoxCaptionStr;
class WXDLLEXPORT wxMessageDialog: public wxDialog
class WXDLLEXPORT wxMessageDialog : public wxDialog
{
DECLARE_DYNAMIC_CLASS(wxMessageDialog)
protected:
wxString m_caption;
wxString m_message;
long m_dialogStyle;
wxWindow * m_parent;
public:
wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxMessageBoxCaptionStr,
long style = wxOK|wxCENTRE, const wxPoint& pos = wxDefaultPosition);
wxMessageDialog( wxWindow* pParent
,const wxString& rsMessage
,const wxString& rsCaption = wxMessageBoxCaptionStr
,long lStyle = wxOK|wxCENTRE
,const wxPoint& rPos = wxDefaultPosition
);
int ShowModal();
};
int ShowModal(void);
protected:
wxString m_sCaption;
wxString m_sMessage;
long m_lDialogStyle;
wxWindow* m_pParent;
}; // end of CLASS wxMessageDialog
int WXDLLEXPORT wxMessageBox(const wxString& message, const wxString& caption = wxMessageBoxCaptionStr,
long style = wxOK|wxCENTRE,
wxWindow *parent = NULL, int x = -1, int y = -1);
int WXDLLEXPORT wxMessageBox( const wxString& rsMessage
,const wxString& rsCaption = wxMessageBoxCaptionStr
,long lStyle = wxOK|wxCENTRE
,wxWindow* pParent = NULL
,int nX = -1
,int nY = -1
);
#endif
// _WX_MSGBOXDLG_H_

View File

@@ -42,59 +42,101 @@ protected:
wxAcceleratorRefData::wxAcceleratorRefData()
{
// TODO
/*
HACCEL m_hAccel;
*/
}
m_ok = FALSE;
m_hAccel = 0;
} // end of wxAcceleratorRefData::wxAcceleratorRefData
wxAcceleratorRefData::~wxAcceleratorRefData()
{
/*
if (m_hAccel)
{
DestroyAcceleratorTable((HACCEL) m_hAccel);
}
m_hAccel = 0 ;
*/
}
if (m_hAccel)
{
WinDestroyAccelTable((HACCEL) m_hAccel);
}
m_hAccel = 0 ;
} // end of wxAcceleratorRefData::~wxAcceleratorRefData
wxAcceleratorTable::wxAcceleratorTable()
{
m_refData = NULL;
}
m_refData = NULL;
} // end of wxAcceleratorTable::wxAcceleratorTable
wxAcceleratorTable::~wxAcceleratorTable()
{
}
} // end of wxAcceleratorTable::~wxAcceleratorTable
// Load from .rc resource
wxAcceleratorTable::wxAcceleratorTable(const wxString& resource)
wxAcceleratorTable::wxAcceleratorTable(
const wxString& rResource
)
{
HACCEL hAccel;
ULONG ulId;
m_refData = new wxAcceleratorRefData;
/* TODO: load acelerator from resource, if appropriate for your platform
ulId = atol((char*)rResource.c_str());
hAccel = ::WinLoadAccelTable( vHabmain
,NULL // resources always in .exe
,(ULONG)ulId
);
M_ACCELDATA->m_hAccel = hAccel;
M_ACCELDATA->m_ok = (hAccel != 0);
*/
}
extern int wxCharCodeWXToOS2(int id, bool *isVirtual);
extern int wxCharCodeWXToOS2(
int nId
, bool* pbIsVirtual
);
// Create from an array
wxAcceleratorTable::wxAcceleratorTable(int n, wxAcceleratorEntry entries[])
wxAcceleratorTable::wxAcceleratorTable(
int n
, wxAcceleratorEntry vaEntries[]
)
{
m_refData = new wxAcceleratorRefData;
int nAccelLength = ((sizeof(ACCEL) * n) + sizeof(ACCELTABLE));
PACCELTABLE pArr;
int i;
/* TODO: create table from entries
*/
}
m_refData = new wxAcceleratorRefData;
pArr = (PACCELTABLE) new int[nAccelLength];
for (i = 0; i < n; i++)
{
USHORT uVirt = 0;
if (vaEntries[i].GetFlags() & wxACCEL_ALT)
uVirt |= AF_ALT;
if (vaEntries[i].GetFlags() & wxACCEL_SHIFT)
uVirt |= AF_SHIFT;
if (vaEntries[i].GetFlags() & wxACCEL_CTRL)
uVirt |= AF_CONTROL;
bool bIsVirtual;
USHORT uKey = wxCharCodeWXToOS2( vaEntries[i].GetKeyCode()
,&bIsVirtual
);
uVirt |= AF_VIRTUALKEY;
USHORT uCmd = vaEntries[i].GetCommand();
pArr->aaccel[i].fs = uVirt;
pArr->aaccel[i].key = uKey;
pArr->aaccel[i].cmd = uCmd;
}
pArr->codepage = 437; // default to english Fix???
pArr->cAccel = (USHORT)n;
M_ACCELDATA->m_hAccel = ::WinCreateAccelTable( vHabmain
,pArr
);
delete[] pArr;
M_ACCELDATA->m_ok = (M_ACCELDATA->m_hAccel != 0);
} // end of wxAcceleratorTable::wxAcceleratorTable
bool wxAcceleratorTable::Ok() const
{
// TODO
return FALSE;
}
return(M_ACCELDATA && (M_ACCELDATA->m_ok));
} // end of wxAcceleratorTable::Ok
void wxAcceleratorTable::SetHACCEL(WXHACCEL hAccel)
{
@@ -111,14 +153,17 @@ WXHACCEL wxAcceleratorTable::GetHACCEL() const
return (WXHACCEL) M_ACCELDATA->m_hAccel;
}
bool wxAcceleratorTable::Translate(wxWindow *window, WXMSG *wxmsg) const
bool wxAcceleratorTable::Translate(
wxWindow* pWindow
, WXMSG* pWxmsg
) const
{
// TODO:
/*
MSG *msg = (MSG *)wxmsg;
PQMSG pMsg = (PQMSG)pWxmsg;
return Ok() && ::TranslateAccelerator(GetHwndOf(window), GetHaccel(), msg);
*/
return FALSE;
}
return Ok() && ::WinTranslateAccel( vHabmain
,GetHwndOf(pWindow)
,GetHaccel()
,pMsg
);
} // end of wxAcceleratorTable::Translate

View File

@@ -35,69 +35,105 @@
IMPLEMENT_CLASS(wxMessageDialog, wxDialog)
wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption,
long style, const wxPoint& pos)
wxMessageDialog::wxMessageDialog(
wxWindow* pParent
, const wxString& rsMessage
, const wxString& rsCaption
, long lStyle
, const wxPoint& pPos
)
{
m_caption = caption;
m_message = message;
m_dialogStyle = style;
m_parent = parent;
}
m_sCaption = rsCaption;
m_sMessage = rsMessage;
m_lDialogStyle = lStyle;
m_pParent = NULL; // pParent;
} // end of wxMessageDialog::wxMessageDialog
int wxMessageDialog::ShowModal()
{
HWND hWnd = 0;
if (m_parent) hWnd = (HWND) m_parent->GetHWND();
unsigned int msStyle = MB_OK;
if (m_dialogStyle & wxYES_NO)
{
if (m_dialogStyle & wxCANCEL)
msStyle = MB_YESNOCANCEL;
else
msStyle = MB_YESNO;
HWND hWnd = 0;
ULONG ulStyle = MB_OK;
int nAns = wxOK;
if (m_dialogStyle & wxNO_DEFAULT)
msStyle |= MB_DEFBUTTON2;
if (!wxTheApp->GetTopWindow())
{
//
// when the message box is shown from wxApp::OnInit() (i.e. before the
// message loop is entered), this must be done or the next message box
// will never be shown - just try putting 2 calls to wxMessageBox() in
// OnInit() to see it
//
while (wxTheApp->Pending())
wxTheApp->Dispatch();
}
if (m_dialogStyle & wxOK)
{
if (m_dialogStyle & wxCANCEL)
msStyle = MB_OKCANCEL;
else
msStyle = MB_OK;
}
if (m_dialogStyle & wxICON_EXCLAMATION)
msStyle |= MB_ICONEXCLAMATION;
else if (m_dialogStyle & wxICON_HAND)
msStyle |= MB_ICONHAND;
else if (m_dialogStyle & wxICON_INFORMATION)
msStyle |= MB_INFORMATION;
else if (m_dialogStyle & wxICON_QUESTION)
msStyle |= MB_ICONQUESTION;
if (hWnd)
msStyle |= MB_APPLMODAL;
if (m_pParent)
hWnd = (HWND) m_pParent->GetHWND();
else
msStyle |= MB_SYSTEMMODAL;
hWnd = HWND_DESKTOP;
if (m_lDialogStyle & wxYES_NO)
{
if (m_lDialogStyle & wxCANCEL)
ulStyle = MB_YESNOCANCEL;
else
ulStyle = MB_YESNO;
int msAns = WinMessageBox(HWND_DESKTOP, hWnd, m_message.c_str(), m_caption.c_str(), 0, msStyle | MB_MOVEABLE);
int ans = wxOK;
switch (msAns)
if (m_lDialogStyle & wxNO_DEFAULT)
ulStyle |= MB_DEFBUTTON2;
}
if (m_lDialogStyle & wxOK)
{
if (m_lDialogStyle & wxCANCEL)
ulStyle = MB_OKCANCEL;
else
ulStyle = MB_OK;
}
if (m_lDialogStyle & wxICON_EXCLAMATION)
ulStyle |= MB_ICONEXCLAMATION;
else if (m_lDialogStyle & wxICON_HAND)
ulStyle |= MB_ICONHAND;
else if (m_lDialogStyle & wxICON_INFORMATION)
ulStyle |= MB_ICONEXCLAMATION;
else if (m_lDialogStyle & wxICON_QUESTION)
ulStyle |= MB_ICONQUESTION;
if (hWnd != HWND_DESKTOP)
ulStyle |= MB_APPLMODAL;
else
ulStyle |= MB_SYSTEMMODAL;
//
// This little line of code is get message boxes under OS/2 to
// behve like the other ports. In OS/2 if the parent is a window
// it displays, clipped, in the window. This centers it on the
// desktop, like the other ports but still allows control over modality
//
hWnd = HWND_DESKTOP;
ULONG ulAns = ::WinMessageBox( hWnd
,hWnd
,(PSZ)m_sMessage.c_str()
,(PSZ)m_sCaption.c_str()
,0L
,ulStyle);
switch (ulAns)
{
case MBID_CANCEL:
ans = wxID_CANCEL;
nAns = wxID_CANCEL;
break;
case MBID_OK:
ans = wxID_OK;
nAns = wxID_OK;
break;
case MBID_YES:
ans = wxID_YES;
nAns = wxID_YES;
break;
case MBID_NO:
ans = wxID_NO;
nAns = wxID_NO;
break;
default:
nAns = wxID_CANCEL;
}
return ans;
}
return nAns;
} // end of wxMessageDialog::ShowModal

View File

@@ -1813,7 +1813,7 @@ MRESULT EXPENTRY wxWndProc(
{
if (pWnd)
rc = pWnd->OS2WindowProc(ulMsg, wParam, lParam);
if(!rc)
if (!rc)
rc = ::WinDefWindowProc(hWnd, ulMsg, wParam, lParam);
}
return rc;