~ubuntu-branches/ubuntu/trusty/ginkgocadx/trusty

« back to all changes in this revision

Viewing changes to src/cadxcore/main/gui/ginkgocloud/wxtreelistctrlcloud.h

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2013-07-21 11:58:53 UTC
  • mfrom: (7.2.1 sid)
  • Revision ID: package-import@ubuntu.com-20130721115853-44e7n1xujqglu78e
Tags: 3.4.0.928.29+dfsg-1
* New upstream release [July 2013]
  + new B-D: "libjsoncpp-dev".
  + new patch "unbundle-libjsoncpp.patch" to avoid building bundled
    "libjsoncpp-dev".
  + new patch "fix-wx.patch" to avoid FTBFS due to missing
    "-lwx_gtk2u_html-2.8".
* Removed unnecessary versioned Build-Depends.
* Removed obsolete lintian override.
* Reference get-orig-source implementation for orig.tar clean-up and
  DFSG-repackaging.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  
 
3
 *  $Id: wxtreelistctrlacquisition.h $
 
4
 *  Ginkgo CADx Project
 
5
 *
 
6
 *  Copyright 2008-12 MetaEmotion S.L. All rights reserved.
 
7
 *  http://ginkgo-cadx.com
 
8
 *
 
9
 *  This file is licensed under LGPL v3 license.
 
10
 *  See License.txt for details
 
11
 *
 
12
 *
 
13
 */
 
14
 
 
15
#pragma once
 
16
 
 
17
#include <wx/intl.h>
 
18
 
 
19
#include <wx/panel.h>
 
20
#include <wx/gdicmn.h>
 
21
#include <wx/font.h>
 
22
#include <wx/colour.h>
 
23
#include <wx/settings.h>
 
24
#include <wx/string.h>
 
25
#include <wx/stattext.h>
 
26
#include <wx/combobox.h>
 
27
#include <wx/srchctrl.h>
 
28
#include <wx/sizer.h>
 
29
#include <wx/bitmap.h>
 
30
#include <wx/image.h>
 
31
#include <wx/icon.h>
 
32
#include <wx/treelistctrl/treelistctrl.h>
 
33
#include <wx/link_additions.h>
 
34
#include <wx/radiobut.h>
 
35
#include <wx/datectrl.h>
 
36
#include <wx/dateevt.h>
 
37
#include <wx/statbox.h>
 
38
#include <wx/gbsizer.h>
 
39
#include <wx/button.h>
 
40
#include <wx/grid.h>
 
41
#include <wx/notebook.h>
 
42
#include <wx/dialog.h>
 
43
#include <wx/listbox.h>
 
44
 
 
45
 
 
46
#define DESCRIPTION_COLUMN 0
 
47
#define MODALITY_COLUMN 1
 
48
#define CREATOR_USER_NAME_COLUMN 2
 
49
#define LAST_MODIFICATOR_USER_NAME_COLUMN 3
 
50
#define DATE_COLUMN 4
 
51
#define URL_COLUMN 5
 
52
#define BUCKET_ID_COLUMN 6
 
53
 
 
54
 
 
55
class wxTreeListCtrlCloud : public wxTreeListCtrl
 
56
{
 
57
public:
 
58
        wxTreeListCtrlCloud(wxWindow *parent, wxWindowID id = -1,
 
59
               const wxPoint& pos = wxDefaultPosition,
 
60
               const wxSize& size = wxDefaultSize,
 
61
               long style = wxTR_DEFAULT_STYLE,
 
62
               const wxValidator &validator = wxDefaultValidator,
 
63
               const wxString& name = wxTreeListCtrlNameStr )
 
64
                                        : wxTreeListCtrl(parent, id, pos, size, style, validator, name)
 
65
    {
 
66
        }
 
67
        ~wxTreeListCtrlCloud() {}
 
68
 
 
69
        virtual int OnCompareItems (const wxTreeItemId& item1, const wxTreeItemId& item2) 
 
70
        {
 
71
                wxTreeItemId root = GetRootItem();
 
72
                if (item1.IsOk() && item2.IsOk()) {
 
73
                        //alphabetically no case sensitive
 
74
                        int descCompare =  GetItemText(item1).CompareTo(GetItemText(item2), wxString::ignoreCase);
 
75
                        if (descCompare !=0) {
 
76
                                return descCompare;
 
77
                        } else {
 
78
                                //date compare...
 
79
                                wxDateTime date1,date2;
 
80
                                date1.ParseFormat(GetItemText(item1, DATE_COLUMN), _("%m/%d/%Y %H:%M:%S"));
 
81
                                date2.ParseFormat(GetItemText(item2, DATE_COLUMN), _("%m/%d/%Y %H:%M:%S"));
 
82
                                if (date1.IsValid() && date2.IsValid()) {
 
83
                                        wxTimeSpan diff = date1.Subtract(date2);
 
84
                                        if (diff.IsPositive()) {
 
85
                                                return 1;
 
86
                                        } else {
 
87
                                                return -1;
 
88
                                        }
 
89
                                } else {
 
90
                                        return 0;
 
91
                                }
 
92
                        }
 
93
                }
 
94
                return wxTreeListCtrl::OnCompareItems(item1, item2);
 
95
        }
 
96
 
 
97
        virtual int OnCompareItems (const wxTreeItemId& item1, const wxTreeItemId& item2, int column) 
 
98
        {
 
99
                wxTreeItemId root = GetRootItem();
 
100
                if (item1.IsOk() && item2.IsOk() && column == DATE_COLUMN) {
 
101
                        if (GetItemParent(item1) == root && GetItemParent(item2) == root) {
 
102
                                //first case patient level:
 
103
                                //alphabetically no case sensitive
 
104
                                return wxTreeListCtrl::OnCompareItems(item1, item2, column);
 
105
                        } else {
 
106
                                //study and series level
 
107
                                //date compare...
 
108
                                wxDateTime date1,date2;
 
109
                                date1.ParseFormat(GetItemText(item1, DATE_COLUMN), _("%m/%d/%Y %H:%M:%S"));
 
110
                                date2.ParseFormat(GetItemText(item2, DATE_COLUMN), _("%m/%d/%Y %H:%M:%S"));
 
111
                                if (date1.IsValid() && date2.IsValid()) {
 
112
                                        wxTimeSpan diff = date1.Subtract(date2);
 
113
                                        if (diff.IsPositive()) {
 
114
                                                return 1;
 
115
                                        } else {
 
116
                                                return -1;
 
117
                                        }
 
118
                                } else {
 
119
                                        return 0;
 
120
                                }
 
121
                        } 
 
122
                }
 
123
                return wxTreeListCtrl::OnCompareItems(item1, item2, column);
 
124
        }
 
125
};