[go: up one dir, main page]

File: lightui.h

package info (click to toggle)
fcitx-ui-light 0.1.3-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 468 kB
  • sloc: ansic: 2,438; sh: 27; makefile: 5
file content (113 lines) | stat: -rw-r--r-- 4,246 bytes parent folder | download | duplicates (4)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/***************************************************************************
 *   Copyright (C) 2002~2005 by Yuking                                     *
 *   yuking_net@sohu.com                                                   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.              *
 ***************************************************************************/
#ifndef _LIGHT_UI_H
#define _LIGHT_UI_H

#include "config.h"

#include "fcitx/fcitx.h"
#include "fcitx/ui.h"
#include "fcitx-config/fcitx-config.h"
#include "fcitx-utils/utarray.h"

#include <X11/Xlib.h>

#include "draw.h"
#include <fcitx/module/x11/x11stuff.h>
#include <X11/Xft/Xft.h>

#define FCITX_LIGHT_UI_NAME "fcitx-light-ui"

#define _(x) dgettext("fcitx-light-ui", (x))

struct _MainWindow;
struct _AboutWindow;
struct _FcitxLightUIStatus;

typedef enum _HIDE_MAINWINDOW {
    HM_SHOW = 0,
    HM_AUTO = 1,
    HM_HIDE = 2
} HIDE_MAINWINDOW;

/**
 * @brief Config and Global State for Light UI
 **/
typedef struct _FcitxLightUI {
    FcitxGenericConfig gconfig;
    Display* dpy;
    int iScreen;
    Atom protocolAtom;
    Atom killAtom;
    struct _InputWindow* inputWindow;
    struct _MainWindow* mainWindow;
    struct _TrayWindow* trayWindow;
    struct _AboutWindow* aboutWindow;

    struct _FcitxInstance *owner;

    char* font;
    char* strUserLocale;
    int fontSize;
    boolean bUseTrayIcon;
    boolean bUseTrayIcon_;
    HIDE_MAINWINDOW hideMainWindow;
    boolean bVerticalList;
    char* skinType;
    int iMainWindowOffsetX;
    int iMainWindowOffsetY;
    FcitxConfigColor backcolor;
    FcitxConfigColor bordercolor;
    FcitxConfigColor fontColor[MESSAGE_TYPE_COUNT];
    FcitxConfigColor menuFontColor[2];
    FcitxConfigColor activeColor;
    FcitxConfigColor lineColor;
    FcitxConfigColor cursorColor;

    UT_array status;
    struct _XlibMenu* mainMenuWindow;
    FcitxUIMenu mainMenu;
    XftFont* xftfont;
    LightUIImage* imageTable;
    boolean isfallback;
} FcitxLightUI;

void GetScreenSize(FcitxLightUI* lightui, int* width, int* height);
void
LightUIInitWindowAttribute(FcitxLightUI* lightui, Visual ** vs, Colormap * cmap,
                             XSetWindowAttributes * attrib,
                             unsigned long *attribmask, int *depth);
Visual * LightUIFindARGBVisual (FcitxLightUI* lightui);
boolean LightUIMouseClick(FcitxLightUI* lightui, Window window, int *x, int *y);
boolean IsInRspArea(int x0, int y0, struct _FcitxLightUIStatus* status);
void LightUISetWindowProperty(FcitxLightUI* lightui, Window window, FcitxXWindowType type, char *windowTitle);
void ActivateWindow(Display *dpy, int iScreen, Window window);
boolean LoadLightUIConfig(FcitxLightUI* lightui);
void SaveLightUIConfig(FcitxLightUI* lightui);
boolean WindowIsVisable(Display* dpy, Window window);
GC LightUICreateGC(Display* dpy, Drawable drawable, FcitxConfigColor color);
void LightUISetGC(Display* dpy, GC gc, FcitxConfigColor color);

#define GetPrivateStatus(status) ((FcitxLightUIStatus*)(status)->uipriv[lightui->isfallback])

CONFIG_BINDING_DECLARE(FcitxLightUI);
#endif

// kate: indent-mode cstyle; space-indent on; indent-width 0;