Develop and Download Open Source Software

Browse Subversion Repository

Contents of /old/tabs.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Wed Jan 2 22:54:43 2008 UTC (16 years, 4 months ago) by tabasa
File MIME type: text/plain
File size: 1817 byte(s)


1
2 #include "defextern.h"
3
4 #ifndef STRICT
5 #define STRICT
6 #endif
7 #include <windows.h>
8 #include <commctrl.h>
9 #include "tabs.h"
10 #include "status.h"
11
12 int tabnum=0;
13
14 /*
15 tabchar::tabchar()
16 {
17 name =
18 };*/
19
20 tabs mytab;
21 tabItem *tip[1000];
22
23 void SetCurSel(HWND hTab, int po)
24 {
25 TabCtrl_SetCurSel(hTab, po);
26 }
27
28 int GetCurSel(HWND hTab)
29 {
30 return TabCtrl_GetCurSel(hTab);
31 }
32
33 char *GetTabPath(int num)
34 {
35 return tip[num]->getPath();
36 }
37
38
39 int GetItemCount(HWND hTab)
40 {
41 return TabCtrl_GetItemCount(hTab);
42 }
43
44 void SetTab(HWND hTab, int num, char *name)
45 {
46 if( num ==-1) num =TabCtrl_GetCurSel(hTab);
47 tabItem *ti =tip[num];
48 ti->setPath(name);
49 char *p=strrchr(name,'\\');
50 if(p==NULL ||strlen(name)<5) p=name;
51 else if(strlen(p)>1) p++;
52 ti->setName(p);
53
54 TCITEM tc_item;
55 tc_item.mask = TCIF_TEXT;
56 tc_item.pszText = p;
57 TabCtrl_SetItem(hTab , num , &tc_item);
58 }
59
60
61 #include "folder.h"
62 #define _DEF_TABPATH _MAIN_FOLDER
63
64 void AddTab(HWND hTab, char *name)
65 {
66 tabItem *ti = new tabItem;
67 mytab.numplus();
68 tip[mytab.getnum()-1]=ti;
69 if(strlen(name)>0) ti->setPath(name);
70 else ti->setPath(_DEF_TABPATH);
71 char *p=strrchr(name,'\\');
72 if(p==NULL ||strlen(name)<5) p=name;
73 else if(strlen(p)>1) p++;
74 ti->setName(p);
75
76 TCITEM tc_item;
77 tc_item.mask = TCIF_TEXT;
78 tc_item.pszText = p;
79 TabCtrl_InsertItem(hTab , mytab.getnum() , &tc_item);
80 }
81
82
83 void AddTab(HWND hTab, char *name, char *dir)
84 {
85 char *path = new char[MAX_PATH*2];
86 wsprintf( path ,"%s\\%s", name, dir);
87 AddTab( hTab, path);
88 delete path;
89 }
90
91 void delAllTab(HWND hTab)
92 {
93 for (int i=0; i<mytab.getnum();i++)
94 delete tip[i];
95 mytab.init();
96 TabCtrl_DeleteAllItems(hTab);
97 }
98
99 void delTab( HWND hTab, int num )
100 {
101 if(mytab.getnum()<3) return;
102 delete tip[num];
103 for(int i=num;i<mytab.getnum()-1;i++)
104 tip[i]=tip[i+1];
105 mytab.numplus(-1);
106 TabCtrl_DeleteItem(hTab, num);
107 }

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision
svn:mime-type text/plain

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26