From 9966985cf01613af7eb3c8540986feb053d1c875 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 23 Feb 2009 12:24:18 +0000 Subject: [PATCH] Patch level : 10.0 Files correlati : xvaga.dll Ricompilazione Demo : [ ] Commento : Corretto posizionamento pannello di selezione della data git-svn-id: svn://10.65.10.50/trunk@18324 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- xvaga/xvaga.cpp | 32 +++++++++++++++++--------------- xvaga/xvt.h | 2 +- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/xvaga/xvaga.cpp b/xvaga/xvaga.cpp index c691ae88f..baf1bdaed 100755 --- a/xvaga/xvaga.cpp +++ b/xvaga/xvaga.cpp @@ -834,7 +834,7 @@ protected: void OnCalendar(wxCalendarEvent& e); public: - TwxCalendarDlg(wxWindow* parent, const wxPoint& pnt, wxDateTime& date); + TwxCalendarDlg(wxWindow* parent, wxDateTime& date); DECLARE_EVENT_TABLE() }; @@ -853,18 +853,15 @@ bool TwxCalendarDlg::TransferDataFromWindow() { bool ok = wxDialog::TransferDataFromWindow(); if (ok) - { m_date = m_cal->GetDate(); - } return ok; } -TwxCalendarDlg::TwxCalendarDlg(wxWindow* parent, const wxPoint& pnt, wxDateTime& date) - : wxDialog(parent, wxID_ANY, "Data", pnt, wxDefaultSize, wxRAISED_BORDER), m_date(date) +TwxCalendarDlg::TwxCalendarDlg(wxWindow* parent, wxDateTime& date) + : wxDialog(parent, wxID_ANY, "Data", wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER), m_date(date) { - m_cal = new wxCalendarCtrl(this, ID_CAL, m_date, - pnt, wxDefaultSize, + m_cal = new wxCalendarCtrl(this, ID_CAL, m_date, wxDefaultPosition, wxDefaultSize, wxCAL_MONDAY_FIRST | wxCAL_SHOW_HOLIDAYS | wxCAL_SHOW_SURROUNDING_WEEKS); wxButton* button = new wxButton(this, wxID_OK, "OK"); @@ -876,7 +873,7 @@ TwxCalendarDlg::TwxCalendarDlg(wxWindow* parent, const wxPoint& pnt, wxDateTime& sizer->SetSizeHints(this); } -unsigned int xvt_dm_post_choose_date(WINDOW win, PNT pos, unsigned int ansidate) +unsigned int xvt_dm_post_choose_date(WINDOW win, const RCT* rct, unsigned int ansidate) { int d = ansidate%100; int m = (ansidate/100)%100; @@ -889,14 +886,19 @@ unsigned int xvt_dm_post_choose_date(WINDOW win, PNT pos, unsigned int ansidate) date = wxDateTime::Today(); CAST_WIN(win, w); + wxDialog* dlg = new TwxCalendarDlg(&w, date); - wxPoint pnt(pos.h, pos.v); - if (pos.h < 0 || pos.v < 0) - pnt = wxDefaultPosition; - else - pnt = w.ClientToScreen(pnt); - - wxDialog* dlg = new TwxCalendarDlg(&w, pnt, date); + if (rct != NULL) + { + const wxRect client = w.GetClientRect(); + const wxRect rect = dlg->GetRect(); + wxPoint pos(rct->right - rect.width, rct->bottom); + if (pos.x < 0) + pos.x = rct->left; + if (rct->bottom + rect.height > client.GetBottom()) + pos.y = rct->top - rect.height; + dlg->Move(w.ClientToScreen(pos)); + } if (dlg->ShowModal() == wxID_OK) { diff --git a/xvaga/xvt.h b/xvaga/xvt.h index bb4fe976f..2c37c463f 100755 --- a/xvaga/xvt.h +++ b/xvaga/xvt.h @@ -68,7 +68,7 @@ XVTDLL void xvt_debug_printf(const char* fmt, ...); XVTDLL ASK_RESPONSE xvt_dm_post_ask(const char* Btn1, const char*Btn2, const char* Btn3, const char* xin_buffer); XVTDLL COLOR xvt_dm_post_choose_color(WINDOW win, COLOR c); // Added by guy -XVTDLL unsigned int xvt_dm_post_choose_date(WINDOW win, PNT pos, unsigned int ansidate); // Added by guy +XVTDLL unsigned int xvt_dm_post_choose_date(WINDOW win, const RCT* ownrct, unsigned int ansidate); // Added by guy XVTDLL void xvt_dm_post_error(const char *fmt); XVTDLL void xvt_dm_post_fatal_exit(const char *fmt); XVTDLL FL_STATUS xvt_dm_post_file_open(FILE_SPEC *fsp, const char *msg);