File: filedialog.h

package info (click to toggle)
komposter 0%2Bgit20201216%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,760 kB
  • sloc: ansic: 15,581; sh: 4,176; asm: 642; makefile: 74
file content (67 lines) | stat: -rw-r--r-- 1,280 bytes parent folder | download | duplicates (2)
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
/*
 * Komposter
 *
 * Copyright (c) 2010 Noora Halme et al. (see AUTHORS)
 *
 * This code is licensed under the GNU General Public
 * License version 2. See LICENSE for full text.
 *
 * Framework for file selector dialogs
 *
 */

#ifndef __FILEDIALOG_H_
#define __FILEDIALOG_H_

#include <glob.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <sys/stat.h>

#include "arch.h"
#include "constants.h"
#include "font.h"
#include "widgets.h"

#define FDUI_FILENAME	0
#define FDUI_OK		1
#define FDUI_VSLIDER	2

#define FDEXIT_CANCEL	1
#define FDEXIT_OK	2


typedef struct {
  char title[255];
  char cpath[255];
  char fname[255];
  char fmask[255];
  char fullpath[512];

  glob_t g;
  int exitstate;
  int owconfirm;

  int hover[4];
  int listhover;
  int kbfocus;

  int sliderpos;
  int sliderstep;
  int sliderdrag;
  int slider_yofs;
  int slider_dragstart;
} filedialog;


void filedialog_open(filedialog *fd, char *ext, char *path);
void filedialog_scanpath(filedialog *fd);
void filedialog_draw(filedialog *fd);

void filedialog_hover(filedialog *fd, int x, int y);
void filedialog_click(filedialog *fd, int button, int state, int x, int y);
void filedialog_keyboard(filedialog *fd, int key);
void filedialog_drag(filedialog *fd, int x, int y);

#endif