implementation of channel icons

This commit is contained in:
winsped
2026-07-21 17:25:01 +03:00
parent ffde1ca33d
commit ed98242af8
6 changed files with 16 additions and 6 deletions
+2 -2
View File
@@ -3,9 +3,9 @@
int DiscordSendMessage(const char *channelID, const char* content); int DiscordSendMessage(const char *channelID, const char* content);
int DiscordListGuildChannels(char* guildID, DiscordChannel** out); int DiscordListGuildChannels(char* guildID, DiscordChannel** out);
#define GUILD_TEXT 0 #define GUILD_TEXT 0
#define CHANNEL_TYPE_DM 1 #define DM_CHANNEL 1
#define GUILD_VOICE 2 #define GUILD_VOICE 2
#define GROUPCHAT 3 #define GROUPCHAT_CHANNEL 3
#define GUILD_CATEGORY 4 #define GUILD_CATEGORY 4
#define GUILD_ANNOUNCEMENT 5 #define GUILD_ANNOUNCEMENT 5
int DiscordGetChannelHistory(const char* channelID, unsigned int amount, DiscordMessage** msgs); int DiscordGetChannelHistory(const char* channelID, unsigned int amount, DiscordMessage** msgs);
+12 -4
View File
@@ -72,6 +72,7 @@ int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, PSTR pCmdLine,
InitSnowsControls(); InitSnowsControls();
hSidePfps = ImageList_Create(32, 32, ILC_COLOR32 | ILC_MASK, 12, 1); hSidePfps = ImageList_Create(32, 32, ILC_COLOR32 | ILC_MASK, 12, 1);
hChannelImgList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 8, 1); hChannelImgList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 8, 1);
ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_TC)),RGB(255,0,255));
ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_VC)),RGB(255,0,255)); ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_VC)),RGB(255,0,255));
ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_ANC)),RGB(255,0,255)); ImageList_AddMasked(hChannelImgList,LoadBitmap(hinstance,MAKEINTRESOURCE(IDI_CHANNEL_ANC)),RGB(255,0,255));
hInstance = hinstance; hInstance = hinstance;
@@ -272,6 +273,7 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
TVS_LINESATROOT | TVS_HASBUTTONS, TVS_LINESATROOT | TVS_HASBUTTONS,
90, 0, 128, rc.bottom - rc.top - 80, hwnd, 90, 0, 128, rc.bottom - rc.top - 80, hwnd,
(HMENU)103, hInstance, NULL); (HMENU)103, hInstance, NULL);
TreeView_SetImageList(hChTree, hChannelImgList, 0);
hDMsList = CreateWindowExA( hDMsList = CreateWindowExA(
WS_EX_CLIENTEDGE, WC_LISTVIEWA, NULL, WS_CHILD | WS_VISIBLE, 90, 0, WS_EX_CLIENTEDGE, WC_LISTVIEWA, NULL, WS_CHILD | WS_VISIBLE, 90, 0,
128, rc.bottom - rc.top - 80, hwnd, (HMENU)103, hInstance, NULL); 128, rc.bottom - rc.top - 80, hwnd, (HMENU)103, hInstance, NULL);
@@ -389,7 +391,7 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
HTREEITEM hParent = TVI_ROOT; HTREEITEM hParent = TVI_ROOT;
int pfpidx = 0; int pfpidx = 0;
for (int i = 0; i < cnt; i++) { for (int i = 0; i < cnt; i++) {
if (dms[i].type == CHANNEL_TYPE_DM) { if (dms[i].type == DM_CHANNEL) {
printf("%s\n", dms[i].receipents[0].Username); printf("%s\n", dms[i].receipents[0].Username);
if (dms[i].receipents[0].avatar) { if (dms[i].receipents[0].avatar) {
@@ -456,7 +458,7 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
channel_compare, NULL, NULL); channel_compare, NULL, NULL);
for (int i = 0; i < ChannelCount; i++) { for (int i = 0; i < ChannelCount; i++) {
char *VisualName; char *VisualName;
VisualName = malloc(strlen(Channels[i].name+1)); VisualName = malloc(strlen(Channels[i].name)+1);
strcpy(VisualName, Channels[i].name); strcpy(VisualName, Channels[i].name);
TVINSERTSTRUCT tvInsert = {0}; TVINSERTSTRUCT tvInsert = {0};
HTREEITEM hParent = TVI_ROOT; HTREEITEM hParent = TVI_ROOT;
@@ -473,12 +475,18 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
tvInsert.hParent = hParent; // Parent is the root item tvInsert.hParent = hParent; // Parent is the root item
tvInsert.hInsertAfter = TVI_LAST; tvInsert.hInsertAfter = TVI_LAST;
tvInsert.item.mask = tvInsert.item.mask =
TVIF_TEXT | TVIF_PARAM | TVIF_STATE; TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE;
tvInsert.item.pszText = (VisualName); tvInsert.item.pszText = (VisualName);
tvInsert.item.lParam = (LPARAM) & (Channels[i]); tvInsert.item.lParam = (LPARAM) & (Channels[i]);
tvInsert.item.state = TVIS_EXPANDED; tvInsert.item.state = TVIS_EXPANDED;
tvInsert.item.stateMask = TVIS_EXPANDED; tvInsert.item.stateMask = TVIS_EXPANDED;
if(Channels[i].type==GUILD_VOICE){
tvInsert.item.iImage=1;
}else if(Channels[i].type==GUILD_ANNOUNCEMENT){
tvInsert.item.iImage=2;
}else{
tvInsert.item.iImage=0;
}
HTREEITEM lres = (HTREEITEM)SendMessage( HTREEITEM lres = (HTREEITEM)SendMessage(
hChTree, TVM_INSERTITEM, 0, (LPARAM)&tvInsert); hChTree, TVM_INSERTITEM, 0, (LPARAM)&tvInsert);
if (Channels[i].type == GUILD_CATEGORY) { if (Channels[i].type == GUILD_CATEGORY) {
+1
View File
@@ -1,4 +1,5 @@
#define IDI_BACKCORDIC 101 #define IDI_BACKCORDIC 101
#define IDI_BACKCORDBANNERIC 102 #define IDI_BACKCORDBANNERIC 102
#define IDI_CHANNEL_TC 110
#define IDI_CHANNEL_VC 111 #define IDI_CHANNEL_VC 111
#define IDI_CHANNEL_ANC 112 #define IDI_CHANNEL_ANC 112
BIN
View File
Binary file not shown.
+1
View File
@@ -2,5 +2,6 @@
IDI_BACKCORDIC RCDATA "backcord_icon.png" IDI_BACKCORDIC RCDATA "backcord_icon.png"
IDI_BACKCORDBANNERIC BITMAP "backcordbanner.bmp" IDI_BACKCORDBANNERIC BITMAP "backcordbanner.bmp"
IDI_CHANNEL_TC BITMAP "tc.bmp"
IDI_CHANNEL_VC BITMAP "vc.bmp" IDI_CHANNEL_VC BITMAP "vc.bmp"
IDI_CHANNEL_ANC BITMAP "anc.bmp" IDI_CHANNEL_ANC BITMAP "anc.bmp"
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B