1. some minor compilation fixes in datetime.cppm
2. implemented wxTreeCtrl::Insert(size_t index) 3. draft of wxCalendarCtrl git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5135 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -91,19 +91,21 @@ class WXDLLEXPORT wxDateSpan;
|
||||
the copy of the object with the changed sign.
|
||||
*/
|
||||
|
||||
// an invalid/default date time object which may be used as the default
|
||||
// argument for arguments of type wxDateTime; it is also returned by all
|
||||
// functions returning wxDateTime on failure (this is why it is also called
|
||||
// wxInvalidDateTime)
|
||||
class WXDLLEXPORT wxDateTime;
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxDateTime&) wxDefaultDateTime;
|
||||
#define wxInvalidDateTime wxDefaultDateTime
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDateTime represents an absolute moment in the time
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDateTime
|
||||
{
|
||||
private:
|
||||
// invalid wxDateTime object - returned by all functions which return
|
||||
// "wxDateTime &" on failure.
|
||||
// This variable has to be declared at the start of the class,
|
||||
// or some compilers (e.g. Watcom C++) won't like it being used further down.
|
||||
static wxDateTime ms_InvDateTime;
|
||||
|
||||
public:
|
||||
// types
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -617,7 +619,7 @@ public:
|
||||
// set to the next week day following this one
|
||||
wxDateTime& SetToNextWeekDay(WeekDay weekday);
|
||||
|
||||
// set to the previous week day following this one
|
||||
// set to the previous week day before this one
|
||||
wxDateTime& SetToPrevWeekDay(WeekDay weekday);
|
||||
|
||||
// set to Nth occurence of given weekday in the given month of the
|
||||
@@ -722,9 +724,8 @@ public:
|
||||
// result of timezone shift)
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// is the date valid (FALSE for uninitialized objects as well as after
|
||||
// the functions which failed to convert the date to supported range)
|
||||
inline bool IsValid() const { return this != &ms_InvDateTime; }
|
||||
// is the date valid (TRUE even for non initialized objects)?
|
||||
inline bool IsValid() const { return this != &wxInvalidDateTime; }
|
||||
|
||||
// get the broken down date/time representation in the given timezone
|
||||
//
|
||||
@@ -860,7 +861,7 @@ public:
|
||||
// default to Today() otherwise)
|
||||
const wxChar *ParseFormat(const wxChar *date,
|
||||
const wxChar *format = _T("%c"),
|
||||
const wxDateTime& dateDef = wxDateTime::ms_InvDateTime);
|
||||
const wxDateTime& dateDef = wxDefaultDateTime);
|
||||
// parse a string containing the date/time in "free" format, this
|
||||
// function will try to make an educated guess at the string contents
|
||||
const wxChar *ParseDateTime(const wxChar *datetime);
|
||||
|
101
include/wx/generic/calctrl.h
Normal file
101
include/wx/generic/calctrl.h
Normal file
@@ -0,0 +1,101 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: generic/calctrl.h
|
||||
// Purpose: generic implementation of date-picker control
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 29.12.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "calctrl.h"
|
||||
#endif
|
||||
|
||||
#ifndef _WX_GENERIC_CALCTRL_H
|
||||
#define _WX_GENERIC_CALCTRL_H
|
||||
|
||||
#include "wx/control.h" // the base class
|
||||
|
||||
#include "wx/datetime.h" // for m_date
|
||||
#include "wx/combobox.h" // for m_comboMonth
|
||||
#include "wx/spinctrl.h" // for m_spinYear
|
||||
|
||||
#define wxCalendarNameStr _T("CalendarCtrl")
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxCalendarCtrl: a control allowing the user to pick a date interactively
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxCalendarCtrl : public wxControl
|
||||
{
|
||||
public:
|
||||
// construction
|
||||
wxCalendarCtrl() { Init(); }
|
||||
wxCalendarCtrl(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxDateTime& date = wxDefaultDateTime,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxCalendarNameStr)
|
||||
: wxControl(parent, id, pos, size, style, wxDefaultValidator, name)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(parent, id, date, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxDateTime& date = wxDefaultDateTime,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxCalendarNameStr);
|
||||
|
||||
// set/get the current date
|
||||
void SetDate(const wxDateTime& date);
|
||||
const wxDateTime& GetDate() const { return m_date; }
|
||||
|
||||
// returns TRUE if the given point is on a day and fills date with its
|
||||
// value
|
||||
bool HitTest(const wxPoint& pos, wxDateTime *date);
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnClick(wxMouseEvent& event);
|
||||
|
||||
private:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// override some base class virtuals
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags);
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
// get the date from which we start drawing days
|
||||
wxDateTime GetStartDate() const;
|
||||
|
||||
// is this date shown?
|
||||
bool IsDateShown(const wxDateTime& date) const;
|
||||
|
||||
// the subcontrols
|
||||
wxComboBox *m_comboMonth;
|
||||
wxSpinCtrl *m_spinYear;
|
||||
|
||||
wxDateTime m_date;
|
||||
|
||||
// the width and height of one column/row in the calendar
|
||||
wxCoord m_widthCol,
|
||||
m_heightRow;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxCalendarCtrl)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // _WX_GENERIC_CALCTRL_H
|
@@ -337,9 +337,9 @@ public:
|
||||
int image = -1, int selectedImage = -1,
|
||||
wxTreeItemData *data = NULL);
|
||||
|
||||
// insert a new item before a given one
|
||||
// insert a new item before the one with the given index
|
||||
wxTreeItemId InsertItem(const wxTreeItemId& parent,
|
||||
size_t before,
|
||||
size_t index,
|
||||
const wxString& text,
|
||||
int image = -1, int selectedImage = -1,
|
||||
wxTreeItemData *data = NULL);
|
||||
|
@@ -319,6 +319,13 @@ public:
|
||||
int image = -1, int selectedImage = -1,
|
||||
wxTreeItemData *data = NULL);
|
||||
|
||||
// insert a new item before the one with the given index
|
||||
wxTreeItemId InsertItem(const wxTreeItemId& parent,
|
||||
size_t index,
|
||||
const wxString& text,
|
||||
int image = -1, int selectedImage = -1,
|
||||
wxTreeItemData *data = NULL);
|
||||
|
||||
// insert a new item in as the last child of the parent
|
||||
wxTreeItemId AppendItem(const wxTreeItemId& parent,
|
||||
const wxString& text,
|
||||
|
Reference in New Issue
Block a user