SCTC
the soundcloud.com terminal client
state.h
Go to the documentation of this file.
1 /*
2  SCTC - the soundcloud.com client
3  Copyright (C) 2015 Christian Eichler
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>
17 */
18 
19 #ifndef _STATE_H
20  #define _STATE_H
21 
22  #include "track.h"
23  #include "tui.h"
24 
25  #define LIST_STREAM 0
26  #define LIST_BOOKMARKS 1
27 
38  };
39 
41 
42  void state_add_list(struct track_list *_list);
43 
51  size_t state_get_current_list();
52 
56  struct track_list* state_get_list(size_t id);
57 
61  enum repeat state_get_repeat();
62 
66  char* state_get_title_text();
67 
71  char* state_get_status_text();
72 
77 
81  char* state_get_tb_text();
82 
86  char* state_get_tb_title();
87  char* state_get_input();
88  struct command* state_get_commands();
89  size_t state_get_current_time();
90  size_t state_get_tb_old_pos();
91  size_t state_get_tb_pos();
92  size_t state_get_old_selected();
95  size_t state_get_sugg_selected();
107  bool state_init();
108 
116  bool state_finalize();
117 
122  void state_set_commands (struct command *commands);
123  void state_set_current_list(size_t list);
124  void state_set_current_position(size_t pos);
125  void state_set_current_selected(size_t selected);
126  void state_set_current_selected_rel(int delta);
127  void state_set_repeat (enum repeat repeat);
128  void state_set_title (char *title_line_text);
129  void state_set_status (enum color color, char *text);
130  void state_set_tb (char *title, char *text);
131  void state_set_current_time(size_t time);
132  void state_set_sugg_selected(size_t selected);
133  void state_set_tb_pos (size_t pos);
134  void state_set_tb_pos_rel (int delta);
135  void state_set_current_playback(size_t list, size_t track);
139  void state_register_callback(enum callback_event evt, void (*cb)(void));
140 
141  #define NOTHING_SELECTED ((unsigned int) ~0)
142 
143 #endif /* _STATE_H */
Definition: state.h:40
Definition: state.h:30
void state_set_status(enum color color, char *text)
Definition: state.c:154
size_t state_get_current_list()
Get the id of the currently displayed list.
Definition: state.c:46
char * state_get_status_text()
Get the current text in the status bar.
Definition: state.c:57
void state_set_tb_pos_rel(int delta)
Definition: state.c:143
Definition: state.h:31
char * state_get_title_text()
Get the current text in the title bar.
Definition: state.c:56
Definition: command.h:28
size_t state_get_current_time()
Definition: state.c:64
struct command * state_get_commands()
Definition: state.c:63
Definition: state.h:40
bool state_init()
Global initialization of the internal state of SCTC.
Definition: state.c:173
size_t state_get_tb_old_pos()
size_t state_get_old_selected()
Definition: state.c:49
Definition: state.h:33
void state_set_title(char *title_line_text)
Definition: state.c:93
char * state_get_tb_text()
Get the text of the currently visible textbox.
Definition: state.c:59
Definition: track.h:95
The basic datastructure representing a single track.
Definition: track.h:67
size_t state_get_sugg_selected()
Definition: state.c:65
void state_set_current_selected(size_t selected)
Definition: state.c:118
Definition: state.h:36
void state_set_current_playback(size_t list, size_t track)
Definition: state.c:109
void state_set_sugg_selected(size_t selected)
Definition: state.c:96
Definition: state.h:37
struct track_list * state_get_list(size_t id)
Get the track_list for a specific id.
Definition: state.c:51
void state_set_repeat(enum repeat repeat)
Definition: state.c:92
size_t state_get_current_selected()
Definition: state.c:47
size_t state_get_current_position()
Definition: state.c:48
void state_add_list(struct track_list *_list)
Definition: state.c:78
repeat
Definition: state.h:40
callback_event
Definition: state.h:28
Definition: state.h:32
void state_set_tb_pos(size_t pos)
Definition: state.c:102
enum color state_get_status_color()
Get the current color of the text in the status bar.
Definition: state.c:58
void state_set_current_selected_rel(int delta)
Definition: state.c:129
Definition: state.h:35
const struct command commands[]
Array of all commands supported by SCTC.
Definition: command.c:600
size_t state_get_tb_pos()
Definition: state.c:61
Definition: state.h:40
void state_set_current_position(size_t pos)
Definition: state.c:125
char * state_get_input()
Definition: state.c:62
bool state_finalize()
Global finalization of the internal state of SCTC.
Definition: state.c:179
void state_register_callback(enum callback_event evt, void(*cb)(void))
Definition: state.c:168
Definition: state.h:29
void state_set_current_time(size_t time)
Definition: state.c:94
void state_set_tb(char *title, char *text)
Definition: state.c:161
void state_set_commands(struct command *commands)
Definition: state.c:67
size_t state_get_current_playback_list()
Definition: state.c:115
size_t state_get_current_playback_track()
Definition: state.c:116
void state_set_current_list(size_t list)
Definition: state.c:69
Definitions of the most important structures track and track_list
Definition: state.h:34
color
Definition: tui.h:26
char * state_get_tb_title()
Get the title of the currently visible textbox.
Definition: state.c:60
enum repeat state_get_repeat()
Get the current repeat state.
Definition: state.c:55