Atrinik Client  4.0
textwin.h
Go to the documentation of this file.
1 /*************************************************************************
2  * Atrinik, a Multiplayer Online Role Playing Game *
3  * *
4  * Copyright (C) 2009-2014 Alex Tokar and Atrinik Development Team *
5  * *
6  * Fork from Crossfire (Multiplayer game for X-windows). *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the Free Software *
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
21  * *
22  * The author can be reached at admin@atrinik.org *
23  ************************************************************************/
24 
30 #ifndef TEXTWIN_H
31 #define TEXTWIN_H
32 
33 #include <button.h>
34 
35 #define TEXTWIN_TAB_NAME(_tab) ((_tab)->name ? (_tab)->name : textwin_tab_names[(_tab)->type - 1])
36 
37 typedef struct textwin_tab_struct {
38  uint8_t type;
39 
40  char *name;
41 
42  char *entries;
43 
44  size_t entries_size;
45 
47  uint32_t scroll_offset;
48 
50  uint32_t num_lines;
51 
52  button_struct button;
53 
54  char *charnames;
55 
56  text_input_struct text_input;
57 
58  text_input_history_struct *text_input_history;
59 
60  int unread : 1;
62 
64 typedef struct textwin_struct {
67 
70 
73 
75  int64_t selection_start;
76 
78  int64_t selection_end;
79 
80  struct textwin_tab_struct *tabs;
81 
82  size_t tabs_num;
83 
84  size_t tab_selected;
85 
86  uint8_t timestamps;
88 
89 #define TEXTWIN_TAB_HEIGHT 20
90 
96 #define TEXTWIN_TEXT_STARTX(_widget) (3)
97 
98 #define TEXTWIN_TEXT_STARTY(_widget) (1)
99 
100 #define TEXTWIN_TEXT_WIDTH(_widget) ((_widget)->w - scrollbar_get_width(&TEXTWIN((_widget))->scrollbar) - (TEXTWIN_TEXT_STARTX((_widget)) * 2))
101 
102 #define TEXTWIN_TEXT_HEIGHT(_widget) ((_widget)->h - (TEXTWIN_TEXT_STARTY((_widget)) * 2) - textwin_tabs_height((_widget)) - (TEXTWIN((_widget))->tabs_num != 0 && textwin_tab_commands[TEXTWIN((_widget))->tabs[TEXTWIN((_widget))->tab_selected].type - 1] ? TEXTWIN((_widget))->tabs[TEXTWIN((_widget))->tab_selected].text_input.coords.h : 0))
103 
105 #define TEXTWIN_TEXT_INPUT_STARTX(_widget) (1)
106 #define TEXTWIN_TEXT_INPUT_STARTY(_widget) (TEXTWIN_TEXT_STARTY((_widget)) + TEXTWIN_TEXT_HEIGHT((_widget)))
107 #define TEXTWIN_TEXT_INPUT_WIDTH(_widget) ((_widget)->w - TEXTWIN_TEXT_INPUT_STARTX((_widget)) * 2 - TEXTWIN_SCROLLBAR_WIDTH((_widget)))
108 
109 #define TEXTWIN_SCROLLBAR_WIDTH(_widget) (9)
110 #define TEXTWIN_SCROLLBAR_HEIGHT(_widget) ((_widget)->h - (TEXTWIN_TEXT_STARTY((_widget)) * 2) - textwin_tabs_height((_widget)))
111 
113 #define TEXTWIN_ROWS_VISIBLE(widget) (TEXTWIN_TEXT_HEIGHT((widget)) / FONT_HEIGHT(TEXTWIN((widget))->font))
114 
115 #define TEXTWIN_TEXT_FLAGS(widget) (TEXT_WORD_WRAP | TEXT_MARKUP | TEXT_NO_FONT_CHANGE)
116 
117 #endif
scrollbar_struct scrollbar
Definition: textwin.h:69
font_struct * font
Definition: textwin.h:66
int64_t selection_end
Definition: textwin.h:78
struct textwin_struct textwin_struct
int64_t selection_start
Definition: textwin.h:75
uint8_t selection_started
Definition: textwin.h:72
uint32_t num_lines
Definition: textwin.h:50
uint32_t scroll_offset
Definition: textwin.h:47