This repository has been archived by the owner on Oct 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui_cntlistfilter.h
89 lines (80 loc) · 2.31 KB
/
ui_cntlistfilter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
KONNEKT UI
Filtrowanie listy kontaktów
*/
#pragma once
namespace Konnekt {
namespace UI {
namespace ACT {
const int Gfilters = IMIG_MAIN_FILTERS;
};
namespace CntList {
enum enFilterResult {
frNoApply, // filtr siê nim nie zajmuje...
frApply, // w zale¿noœci od ustawienia filtra
frHide, // ukryj i przerwij
frShow, // pokaz i przerwij
};
class cFilter {
public:
cFilter(int ico=0 , const CStdString & cfgID="" , const CStdString & name="" , bool enabled = true , bool hidden = false) {
this->enabled = enabled;
this->hidden = hidden;
this->ico = ico;
this->name = name;
static int lastID = 0;
this->id = lastID ++;
this->cfgID = cfgID;
}
virtual enFilterResult Apply(const sUICnt * cnt);
virtual ~cFilter() {}
virtual void SetEnabled(bool enabled);
void Prepare();
bool IsEnabled() {return enabled;}
protected:
unsigned enabled :1;
unsigned hidden :1;
unsigned id:4;
CStdString name;
CStdString cfgID;
int ico;
friend class cFilters;
};
class cFilter_group: public cFilter {
public:
cFilter_group():cFilter(0 , "" , "" , true , true) {}
enFilterResult Apply(const sUICnt * cnt);
};
class cFilter_enabled: public cFilter {
public:
cFilter_enabled():cFilter(IDI_CLFILTER_ON , "__ON" , "Filtruj" , false) {}
void SetEnabled(bool enabled);
enFilterResult Apply(const sUICnt * cnt);
};
class cFilter_offline: public cFilter {
public:
cFilter_offline():cFilter(UIIcon(IT_STATUS , 0 , ST_OFFLINE , 0) /*IDI_CLFILTER_OFFLINE*/ , "__OFFLINE" , "Kontakty offline",false) {}
enFilterResult Apply(const sUICnt * cnt);
};
class cFilter_net: public cFilter {
public:
cFilter_net(int net);
enFilterResult Apply(const sUICnt * cnt);
protected:
int net;
};
class cFilters: private deque<cFilter*> {
public:
cFilters();
~cFilters();
bool CheckCnt(const sUICnt * cnt); // Zwraca czy kontakt mo¿e byæ wyœwietlony, czy nie
bool ApplyToCnt(sUICnt * cnt); // Ukrywa/pokazuje kontakt
void Prepare(); // Tworzy wszystkie akcje, generuje filtry
int ActionProc(sUIActionNotify_base * anBase);
private:
int switchIndex;
};
extern cFilters filters;
}; // ns CntList
}; // ns UI
}; // ns Konnekt