chatty-message-list.h 2.11 KB
Newer Older
Andrea Schaefer's avatar
Andrea Schaefer committed
1 2 3
/*
 * Copyright (C) 2018 Purism SPC
 *
4
 * SPDX-License-Identifier: GPL-3.0-or-later
Andrea Schaefer's avatar
Andrea Schaefer committed
5 6
 */

7

Andrea Schaefer's avatar
Andrea Schaefer committed
8 9 10 11 12 13
#ifndef __MSG_LIST_H_INCLUDE__
#define __MSG_LIST_H_INCLUDE__

#include <gtk/gtk.h>
#include <gtk/gtkwidget.h>

Mohammed Sadiq's avatar
Mohammed Sadiq committed
14 15
#include "chatty-chat.h"

Andrea Schaefer's avatar
Andrea Schaefer committed
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
G_BEGIN_DECLS

#define CHATTY_TYPE_MSG_LIST (chatty_msg_list_get_type())

G_DECLARE_DERIVABLE_TYPE (ChattyMsgList, chatty_msg_list, CHATTY, MSG_LIST, GtkBox)


struct _ChattyMsgListClass
{
  GtkBoxClass parent_class;
};


typedef struct {
  const char *str_0;
  const char *str_1;
  const char *str_2;
} header_strings_t;


Nikhil Jha's avatar
Nikhil Jha committed
36
typedef enum {
Andrea Schaefer's avatar
Andrea Schaefer committed
37 38 39 40 41 42 43
  MSG_LIST_HEADER     = 1 << 0,
  MSG_LIST_RULER      = 1 << 1,
  MSG_LIST_TIMESTAMP  = 1 << 2,
  ALL_FEATURES        = 0x7
} message_list_features;


Nikhil Jha's avatar
Nikhil Jha committed
44
typedef enum {
45 46 47 48 49 50
  CHATTY_MSG_TYPE_UNKNOWN,
  CHATTY_MSG_TYPE_IM,
  CHATTY_MSG_TYPE_IM_E2EE,
  CHATTY_MSG_TYPE_MUC,
  CHATTY_MSG_TYPE_SMS,
  CHATTY_MSG_TYPE_LAST
Andrea Schaefer's avatar
Andrea Schaefer committed
51 52 53
} e_msg_type;


Nikhil Jha's avatar
Nikhil Jha committed
54
typedef enum {
55 56 57 58 59
  ADD_MESSAGE_ON_BOTTOM,
  ADD_MESSAGE_ON_TOP,
} e_msg_pos;


Andrea Schaefer's avatar
Andrea Schaefer committed
60 61 62
GtkWidget *chatty_msg_list_new (guint message_type,
                                gboolean disclaimer);

63
GtkWidget *chatty_msg_list_add_message (ChattyMsgList *self,
Andrea Schaefer's avatar
Andrea Schaefer committed
64 65
                                  guint message_dir,
                                  const gchar *message,
66 67
                                  const gchar *footer,
                                  GtkWidget   *icon);
Andrea Schaefer's avatar
Andrea Schaefer committed
68 69 70 71 72 73 74 75 76 77 78

void chatty_msg_list_clear (ChattyMsgList *self);
void chatty_msg_list_autoscroll (ChattyMsgList *self);

void chatty_msg_list_show_typing_indicator (ChattyMsgList *self);
void chatty_msg_list_hide_typing_indicator (ChattyMsgList *self);

guint chatty_msg_list_get_msg_type (ChattyMsgList *self);
void chatty_msg_list_set_msg_type (ChattyMsgList *self,
                                   guint         message_type);

79

80
GtkWidget *chatty_msg_list_add_message_at (ChattyMsgList *self,
81 82 83 84 85 86
                                     guint          message_dir,
                                     const gchar   *message,
                                     const gchar   *footer,
                                     GtkWidget     *icon,
                                     guint position);

Andrea Schaefer's avatar
Andrea Schaefer committed
87 88 89
G_END_DECLS

#endif