~ubuntu-branches/ubuntu/raring/notecase/raring

« back to all changes in this revision

Viewing changes to src/TreeView.h

  • Committer: Bazaar Package Importer
  • Author(s): Nathan Handler
  • Date: 2008-12-21 13:09:58 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20081221130958-0ri77h0x7j1dclkq
Tags: 1.9.8-0ubuntu1
New upstream release (LP: #307752)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
////////////////////////////////////////////////////////////////////////////
2
 
// NoteCase notes manager project <http://notecase.sf.net>
3
 
//
4
 
// This code is licensed under BSD license.See "license.txt" for more details.
5
 
//
6
 
// File: GTK+ TreeView wrapper class
7
 
////////////////////////////////////////////////////////////////////////////
8
 
 
9
 
#ifndef TREEVIEW_H__
10
 
#define TREEVIEW_H__
11
 
 
12
 
#if _MSC_VER > 1000
13
 
#pragma once
14
 
#endif // _MSC_VER > 1000
15
 
 
16
 
#if _MSC_VER > 1000
17
 
  #pragma warning(disable: 4786)
18
 
#endif
19
 
 
20
 
#include <gtk/gtk.h>
21
 
#include <vector>
22
 
 
23
 
#define STORE_IDX_TEXT          0
24
 
#define STORE_IDX_ICON          1
25
 
#define STORE_IDX_STRIKE        2
26
 
#define STORE_IDX_UNDERLINE 3
27
 
#define STORE_IDX_COLOR         4
28
 
 
29
 
#define SCREEN_IDX_TEXT 1
30
 
#define SCREEN_IDX_ICON 0
31
 
 
32
 
class TreeView
33
 
{
34
 
public:
35
 
        TreeView();
36
 
        virtual ~TreeView();
37
 
 
38
 
        void Create();
39
 
        void Clear();           // remove tree contents
40
 
        void EditLabel();       // enters edit mode for focused node
41
 
 
42
 
        GtkTreePath *GetFirstVisibleNode();
43
 
        bool GetNextVisibleNode(GtkTreePath **path1);
44
 
        bool GetPreviousVisibleNode(GtkTreePath **path1);
45
 
        bool IsTreePathValid(GtkTreePath *path);
46
 
        void DumpPath(GtkTreePath *path, const char *szFile);
47
 
        void EnableDragAndDrop(bool bEnable = true);
48
 
 
49
 
        //selection handlers
50
 
        void SelectionPageDown();
51
 
        void SelectionPageUp();
52
 
        void SelectionEnd();
53
 
        void SelectionHome();
54
 
        void SelectionLevelDown();
55
 
        void SelectionLevelUp();
56
 
        void SelectionUp();
57
 
        void SelectionDown();
58
 
 
59
 
        void SetFocus();
60
 
 
61
 
        void WrapTreeToSize(int nSize);
62
 
        void SetTreeLines(bool bTree);
63
 
        bool IsPathInVisbleRange(GtkTreePath *path);
64
 
 
65
 
public:
66
 
        GtkWidget *m_pWidget;
67
 
 
68
 
        // Drag and drop
69
 
        bool m_bDND;               //is DND in progress
70
 
        int  m_nFirstDroppedIdx;
71
 
        int  m_nFirstDraggedIdx;   //used for UNDO
72
 
        bool m_bCellEdited;                //is in progress
73
 
};
74
 
 
75
 
#endif // TREEVIEW_H__
 
1
////////////////////////////////////////////////////////////////////////////
 
2
// NoteCase notes manager project <http://notecase.sf.net>
 
3
//
 
4
// This code is licensed under BSD license.See "license.txt" for more details.
 
5
//
 
6
// File: GTK+ TreeView wrapper class
 
7
////////////////////////////////////////////////////////////////////////////
 
8
 
 
9
#ifndef TREEVIEW_H__
 
10
#define TREEVIEW_H__
 
11
 
 
12
#if _MSC_VER > 1000
 
13
#pragma once
 
14
#endif // _MSC_VER > 1000
 
15
 
 
16
#if _MSC_VER > 1000
 
17
  #pragma warning(disable: 4786)
 
18
#endif
 
19
 
 
20
#include <gtk/gtk.h>
 
21
#include <vector>
 
22
 
 
23
#define STORE_IDX_TEXT          0
 
24
#define STORE_IDX_ICON          1
 
25
#define STORE_IDX_STRIKE        2
 
26
#define STORE_IDX_UNDERLINE 3
 
27
#define STORE_IDX_COLOR         4
 
28
 
 
29
#define SCREEN_IDX_TEXT 1
 
30
#define SCREEN_IDX_ICON 0
 
31
 
 
32
class TreeView
 
33
{
 
34
public:
 
35
        TreeView();
 
36
        virtual ~TreeView();
 
37
 
 
38
        void Create();
 
39
        void Clear();           // remove tree contents
 
40
        void EditLabel();       // enters edit mode for focused node
 
41
 
 
42
        GtkTreePath *GetFirstVisibleNode();
 
43
        bool GetNextVisibleNode(GtkTreePath **path1);
 
44
        bool GetPreviousVisibleNode(GtkTreePath **path1);
 
45
        bool IsTreePathValid(GtkTreePath *path);
 
46
        void DumpPath(GtkTreePath *path, const char *szFile);
 
47
        void EnableDragAndDrop(bool bEnable = true);
 
48
 
 
49
        //selection handlers
 
50
        void SelectionPageDown();
 
51
        void SelectionPageUp();
 
52
        void SelectionEnd();
 
53
        void SelectionHome();
 
54
        void SelectionLevelDown();
 
55
        void SelectionLevelUp();
 
56
        void SelectionUp();
 
57
        void SelectionDown();
 
58
 
 
59
        void SetFocus();
 
60
 
 
61
        void WrapTreeToSize(int nSize);
 
62
        void SetTreeLines(bool bTree);
 
63
        bool IsPathInVisbleRange(GtkTreePath *path);
 
64
 
 
65
public:
 
66
        GtkWidget *m_pWidget;
 
67
 
 
68
        // Drag and drop
 
69
        bool m_bDND;               //is DND in progress
 
70
        int  m_nFirstDroppedIdx;
 
71
        int  m_nFirstDraggedIdx;   //used for UNDO
 
72
        bool m_bCellEdited;                //is in progress
 
73
};
 
74
 
 
75
#endif // TREEVIEW_H__