File: ui_layout.h

package info (click to toggle)
mlterm 3.9.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,340 kB
  • sloc: ansic: 154,713; sh: 5,302; cpp: 2,953; objc: 2,776; java: 2,472; makefile: 2,445; perl: 1,674; xml: 44
file content (75 lines) | stat: -rw-r--r-- 1,952 bytes parent folder | download
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
/* -*- c-basic-offset:2; tab-width:2; indent-tabs-mode:nil -*- */

#ifndef __UI_LAYOUT_H__
#define __UI_LAYOUT_H__

#include <pobl/bl_types.h> /* int8_t */

#include "ui_screen.h"
#include "ui_scrollbar.h"
#include "ui_color_manager.h"

#define UI_SCREEN_TO_LAYOUT(screen) ((ui_layout_t *)(screen)->window.parent)

typedef struct ui_layout {
  ui_window_t window;

  struct terminal {
    ui_scrollbar_t scrollbar;
    ui_screen_t *screen;
    ui_sb_mode_t sb_mode;
    ui_scrollbar_event_listener_t sb_listener;
    ui_screen_scroll_event_listener_t screen_scroll_listener;

    u_int16_t separator_x;
    u_int16_t separator_y;
    int yfirst;
    int8_t autohide_scrollbar;
    int8_t idling_count;

    /* 0: right, 1: down */
    struct terminal *next[2];

  } term;

  char *pic_file_path;
  ui_picture_modifier_t pic_mod;
  ui_picture_t *bg_pic;

  void (*line_scrolled_out)(void *);
  void (*pointer_motion)(ui_window_t *, XMotionEvent *);

} ui_layout_t;

ui_layout_t *ui_layout_new(ui_screen_t *screen, char *view_name, char *fg_color, char *bg_color,
                           ui_sb_mode_t mode, u_int hmargin, u_int vmargin);

void ui_layout_destroy(ui_layout_t *layout);

#ifndef NO_SPLIT

int ui_layout_add_child(ui_layout_t *layout, ui_screen_t *screen, int horizontal,
                        const char *percent);

int ui_layout_remove_child(ui_layout_t *layout, ui_screen_t *screen);

int ui_layout_switch_screen(ui_layout_t *layout, int prev);

int ui_layout_resize(ui_layout_t *layout, ui_screen_t *screen, int horizontal, const char *size);

#else

#define ui_layout_add_child(layout, screen, horizontal, percent) (0)

#define ui_layout_remove_child(layout, screen) (0)

#define ui_layout_switch_screen(layout, prev) (0)

#define ui_layout_resize(layout, screen, horizontal, size) (0)

#endif /* NO_SPLIT */

#define ui_layout_has_one_child(layout) \
  ((layout)->term.next[0] == NULL && ((layout)->term.next[1]) == NULL)

#endif