1 |
/* wptCommonCtl.h - Win32 Imagelist headerfile |
/* wptCommonCtl.h - Win32 Imagelist headerfile |
2 |
* Copyright (C) 2003 Andreas Jobs |
* Copyright (C) 2003 Andreas Jobs |
3 |
* Copyright (C) 2004, 2005 Timo Schulz |
* Copyright (C) 2004, 2005 Timo Schulz |
4 |
* |
* |
5 |
* This file is part of WinPT. |
* This file is part of WinPT. |
6 |
* |
* |
7 |
* WinPT is free software; you can redistribute it and/or |
* WinPT is free software; you can redistribute it and/or |
8 |
* modify it under the terms of the GNU General Public License |
* modify it under the terms of the GNU General Public License |
9 |
* as published by the Free Software Foundation; either version 2 |
* as published by the Free Software Foundation; either version 2 |
10 |
* of the License, or (at your option) any later version. |
* of the License, or (at your option) any later version. |
11 |
* |
* |
12 |
* WinPT is distributed in the hope that it will be useful, |
* WinPT is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 |
* General Public License for more details. |
* General Public License for more details. |
16 |
* |
* |
17 |
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
18 |
* along with WinPT; if not, write to the Free Software Foundation, |
* along with WinPT; if not, write to the Free Software Foundation, |
19 |
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 |
*/ |
*/ |
21 |
|
|
22 |
#ifndef WPT_COMMONCTL_H |
#ifndef WPT_COMMONCTL_H |
23 |
#define WPT_COMMONCTL_H |
#define WPT_COMMONCTL_H |
24 |
|
|
25 |
#include <commctrl.h> |
#include <commctrl.h> |
26 |
|
|
27 |
/* Symbol constants for the toolbar. */ |
/* Symbol constants for the toolbar. */ |
28 |
enum { |
enum km_sym_tid_t { |
29 |
IMI_KEY_DELETE = 0, |
IMI_KEY_DELETE = 0, |
30 |
IMI_KEY_PROPS, |
IMI_KEY_PROPS, |
31 |
IMI_KEY_SIGN, |
IMI_KEY_SIGN, |
32 |
IMI_KEY_IMPORT, |
IMI_KEY_IMPORT, |
33 |
IMI_KEY_EXPORT, |
IMI_KEY_EXPORT, |
34 |
IMI_SORT_UPARROW, |
IMI_SORT_UPARROW, |
35 |
IMI_SORT_DOWNARROW, |
IMI_SORT_DOWNARROW, |
36 |
IMI_EXIT, |
IMI_EXIT, |
37 |
IMAGELIST_NUMIMAGES |
IMAGELIST_NUMIMAGES |
38 |
}; |
}; |
39 |
|
|
40 |
/*-- List View --*/ |
/*-- List View --*/ |
41 |
#define KEYLIST_SORT_DESC 0x8000 |
#define KEYLIST_SORT_DESC 0x8000 |
42 |
|
|
43 |
typedef int (CALLBACK *listview_cmp) (LPARAM lParam1, LPARAM lParam2, |
typedef int (CALLBACK *listview_cmp) (LPARAM lParam1, LPARAM lParam2, |
44 |
LPARAM lParamSort); |
LPARAM lParamSort); |
45 |
|
|
46 |
/* Listview column. */ |
/* Listview column. */ |
47 |
struct listview_column_s { |
struct listview_column_s { |
48 |
int pos; /* position of the column. */ |
int pos; /* position of the column. */ |
49 |
int width; /* width of the column. */ |
int width; /* width of the column. */ |
50 |
char *fieldname; /* name of the column. */ |
char *fieldname; /* name of the column. */ |
51 |
}; |
}; |
52 |
typedef struct listview_column_s * listview_column_t; |
typedef struct listview_column_s * listview_column_t; |
53 |
|
|
54 |
/* Listview control context. */ |
/* Listview control context. */ |
55 |
struct listview_ctrl_s { |
struct listview_ctrl_s { |
56 |
HWND ctrl; /* the actual listview window. */ |
HWND ctrl; /* the actual listview window. */ |
57 |
int cols; /* number of columns. */ |
int cols; /* number of columns. */ |
58 |
int items; /* number of items. */ |
int items; /* number of items. */ |
59 |
}; |
}; |
60 |
typedef struct listview_ctrl_s * listview_ctrl_t; |
typedef struct listview_ctrl_s * listview_ctrl_t; |
61 |
|
|
62 |
int listview_new (listview_ctrl_t *ctx); |
int listview_new (listview_ctrl_t *ctx); |
63 |
void listview_release (listview_ctrl_t ctx); |
void listview_release (listview_ctrl_t ctx); |
64 |
int listview_add_column (listview_ctrl_t ctx, listview_column_t col); |
int listview_add_column (listview_ctrl_t ctx, listview_column_t col); |
65 |
int listview_add_item_pos (listview_ctrl_t ctx, int pos); |
int listview_add_item_pos (listview_ctrl_t ctx, int pos); |
66 |
int listview_add_item (listview_ctrl_t ctx, const char *text); |
int listview_add_item (listview_ctrl_t ctx, const char *text); |
67 |
int listview_add_item2 (listview_ctrl_t ctx, const char * text, void * magic); |
int listview_add_item2 (listview_ctrl_t ctx, const char * text, void * magic); |
68 |
void listview_add_sub_item (listview_ctrl_t ctx, int pos, int col, |
void listview_add_sub_item (listview_ctrl_t ctx, int pos, int col, |
69 |
const char *text); |
const char *text); |
70 |
int listview_count_items (listview_ctrl_t ctx, int curr_sel); |
int listview_count_items (listview_ctrl_t ctx, int curr_sel); |
71 |
int listview_del_item (listview_ctrl_t ctx, int pos); |
int listview_del_item (listview_ctrl_t ctx, int pos); |
72 |
int listview_del_all (listview_ctrl_t ctx); |
int listview_del_all (listview_ctrl_t ctx); |
73 |
int listview_get_item_state (listview_ctrl_t ctx, int pos); |
int listview_get_item_state (listview_ctrl_t ctx, int pos); |
74 |
void* listview_get_item2 (listview_ctrl_t ctx, int pos); |
void* listview_get_item2 (listview_ctrl_t ctx, int pos); |
75 |
int listview_set_item2 (listview_ctrl_t ctx, int pos, void *magic); |
int listview_set_item2 (listview_ctrl_t ctx, int pos, void *magic); |
76 |
int listview_sort_items (listview_ctrl_t ctx, int sortby, |
int listview_sort_items (listview_ctrl_t ctx, int sortby, |
77 |
listview_cmp sort_cb); |
listview_cmp sort_cb); |
78 |
int listview_get_curr_pos (listview_ctrl_t ctx); |
int listview_get_curr_pos (listview_ctrl_t ctx); |
79 |
int listview_get_item_text (listview_ctrl_t ctx, int entry, int pos, |
int listview_get_item_text (listview_ctrl_t ctx, int entry, int pos, |
80 |
char *text, int maxbytes); |
char *text, int maxbytes); |
81 |
void listview_set_ext_style (listview_ctrl_t ctx); |
void listview_set_ext_style (listview_ctrl_t ctx); |
82 |
int listview_set_column_order (listview_ctrl_t ctx, int *array); |
int listview_set_column_order (listview_ctrl_t ctx, int *array); |
83 |
int listview_del_items (listview_ctrl_t ctx); |
int listview_del_items (listview_ctrl_t ctx); |
84 |
void listview_select_all (listview_ctrl_t ctx); |
void listview_select_all (listview_ctrl_t ctx); |
85 |
void listview_select_one (listview_ctrl_t ctx, int pos); |
void listview_deselect_all (listview_ctrl_t ctx); |
86 |
int listview_find (listview_ctrl_t ctx, const char * str); |
void listview_select_one (listview_ctrl_t ctx, int pos); |
87 |
void listview_scroll (listview_ctrl_t ctx, int oldpos, int newpos); |
int listview_find (listview_ctrl_t ctx, const char * str); |
88 |
|
void listview_scroll (listview_ctrl_t ctx, int oldpos, int newpos); |
89 |
/*-- Image List --*/ |
|
90 |
extern HIMAGELIST glob_imagelist; |
/*-- Image List --*/ |
91 |
|
extern HIMAGELIST glob_imagelist; |
92 |
int imagelist_load (HWND hwnd); |
|
93 |
int imagelist_destroy (void); |
int imagelist_load (HWND hwnd); |
94 |
int imagelist_getindex (int icon); |
int imagelist_destroy (void); |
95 |
|
int imagelist_getindex (int icon); |
96 |
#endif /*WPT_COMMONCTL_H*/ |
|
97 |
|
#endif /*WPT_COMMONCTL_H*/ |