File: ui_im_candidate_screen.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 (73 lines) | stat: -rw-r--r-- 2,456 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
/* -*- c-basic-offset:2; tab-width:2; indent-tabs-mode:nil -*- */

#ifndef __UI_IM_CANDIDATE_SCREEN_H__
#define __UI_IM_CANDIDATE_SCREEN_H__

#include <vt_char.h>

#include "ui_window.h"
#include "ui_display.h"
#include "ui_font_manager.h"
#include "ui_color_manager.h"

typedef struct ui_im_candidate {
  u_short info; /* to store misc. info from IM plugins */

  vt_char_t *chars;
  u_int num_chars; /* == array size */
  u_int filled_len;

} ui_im_candidate_t;

typedef struct ui_im_candidate_event_listener {
  void *self;
  void (*selected)(void *p, u_int index);

} ui_im_candidate_event_listener_t;

typedef struct ui_im_candidate_screen {
  ui_window_t window;

  ui_font_manager_t *font_man;   /* same as attached screen */
  ui_color_manager_t *color_man; /* same as attached screen */
  void *vtparser;                /* same as attached screen */

  ui_im_candidate_t *candidates;
  u_int num_candidates; /* == array size          */

  u_int num_per_window;

  u_int index; /* current selected index of candidates   */

  int x;             /* not adjusted by window size            */
  int y;             /* not adjusted by window size            */
  u_int line_height; /* line height of attaced screen          */

  int8_t is_vertical_term;
  int8_t is_vertical_direction;
  int8_t need_redraw;

  /* ui_im_candidate_screen.c -> im plugins */
  ui_im_candidate_event_listener_t listener;

  /*
   * methods for ui_im_candidate_screen_t which is called from im
   */
  void (*destroy)(struct ui_im_candidate_screen *);
  void (*show)(struct ui_im_candidate_screen *);
  void (*hide)(struct ui_im_candidate_screen *);
  int (*set_spot)(struct ui_im_candidate_screen *, int, int);
  int (*init)(struct ui_im_candidate_screen *, u_int, u_int);
  int (*set)(struct ui_im_candidate_screen *, ef_parser_t *, const u_char *, u_int);
  int (*select)(struct ui_im_candidate_screen *cand_screen, u_int);

} ui_im_candidate_screen_t;

ui_im_candidate_screen_t *ui_im_candidate_screen_new(ui_display_t *disp,
                                                     ui_font_manager_t *font_man,
                                                     ui_color_manager_t *color_man,
                                                     void *vtparser, int is_vertical_term,
                                                     int is_vertical_direction,
                                                     u_int line_height_of_screen, int x, int y);

#endif