aboutsummaryrefslogtreecommitdiff
path: root/src/Tab.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2001-12-11 20:47:02 (GMT)
committerfluxgen <fluxgen>2001-12-11 20:47:02 (GMT)
commit18830ac9add80cbd3bf7369307d7e35a519dca9b (patch)
tree4759a5434a34ba317fe77bbf8b0ed9bb57bb6018 /src/Tab.hh
parent1523b48bff07dead084af3064ad11c79a9b25df0 (diff)
downloadfluxbox_pavel-18830ac9add80cbd3bf7369307d7e35a519dca9b.zip
fluxbox_pavel-18830ac9add80cbd3bf7369307d7e35a519dca9b.tar.bz2
Initial revision
Diffstat (limited to 'src/Tab.hh')
-rw-r--r--src/Tab.hh125
1 files changed, 125 insertions, 0 deletions
diff --git a/src/Tab.hh b/src/Tab.hh
new file mode 100644
index 0000000..c20b6ba
--- /dev/null
+++ b/src/Tab.hh
@@ -0,0 +1,125 @@
1// Tab.hh for Fluxbox
2// Copyright (c) 2001 Henrik Kinnunen (fluxgen@linuxmail.org)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22#ifndef _TAB_HH_
23#define _TAB_HH_
24
25#ifndef _IMAGE_HH_
26#include "Image.hh"
27#endif
28#ifndef _SCREEN_HH_
29#include "Screen.hh"
30#endif
31#ifndef _WINDOW_HH_
32#include "Window.hh"
33#endif
34
35//Note: Tab is a friend of FluxboxWindow
36
37
38class Tab {
39public:
40 Tab(FluxboxWindow *win, Tab *prev=0, Tab *next=0);
41 ~Tab();
42 void draw(bool pressed);
43 inline Tab *next() const { return m_next; }
44 inline Tab *prev() const { return m_prev; }
45 inline FluxboxWindow *getWindow() const { return m_win; }
46 inline unsigned int getTabWidth() const { return m_size_w; }
47 inline unsigned int getTabHeight() const { return m_size_h; }
48 void focus();
49 void decorate();
50 void deiconify();
51 void iconify();
52 void raise();
53 void withdraw();
54 void stick();
55 void resize();
56 void shade();
57 //position tab to follow (FluxboxWindow *) m_win
58 void setPosition();
59 //event handlers
60 void buttonReleaseEvent(XButtonEvent *be);
61 void buttonPressEvent(XButtonEvent *be);
62 void exposeEvent(XExposeEvent *ee);
63 void motionNotifyEvent(XMotionEvent *me);
64 static Tab *getFirst(Tab *current);
65 void disconnect();
66
67 enum { PTop = 0, PBottom = 5, PLeft = 10, PRight = 15, pnone = 20};
68 enum { ALeft = 0, ACenter, ARight, ARelative, anone };
69
70 static const char *getTabPlacementString(int placement);
71 static int getTabPlacementNum(const char *string);
72 static const char *getTabAlignmentString(int placement);
73 static int getTabAlignmentNum(const char *string);
74 //TODO: do these have to be public?
75 void resizeGroup(void); // used when (un)shading windows
76 void calcIncrease(void);
77 inline bool configured() { return m_configured; }
78 inline void setConfigured(bool value) { m_configured = value; }
79private:
80 bool m_configured;
81
82 void insert(Tab *next);
83 //The size of the tab
84 unsigned int m_size_w;
85 unsigned int m_size_h;
86 //Increasements
87 int m_inc_x;
88 int m_inc_y;
89 static const int m_max_tabs;
90 bool m_focus, m_moving; // moving and focus
91 void createTabWindow(); // creates the X win of tab
92 void setTabWidth(unsigned int w);
93 void setTabHeight(unsigned int h);
94 unsigned int calcRelativeWidth();
95 unsigned int calcRelativeHeight();
96 unsigned int calcCenterXPos();
97 unsigned int calcCenterYPos();
98 int m_move_x, m_move_y; // Move coordinates, holds moving coordinates when draging
99 Tab *m_prev;
100 Tab *m_next;
101 FluxboxWindow *m_win;
102 Window m_tabwin;
103 Display *m_display;
104 Pixmap m_focus_pm, m_unfocus_pm;
105 unsigned long m_focus_pixel, m_unfocus_pixel;
106 static bool m_stoptabs; //used to "freeze" the tabs functions
107
108 struct t_tabplacementlist{
109 int tp;
110 const char *string;
111 inline bool operator == (int p) {
112 return (tp==p);
113 }
114 inline bool operator == (const char *str) {
115 if (strcasecmp(string, str)==0)
116 return true;
117 return false;
118 }
119 };
120 static t_tabplacementlist m_tabplacementlist[];
121 static t_tabplacementlist m_tabalignmentlist[];
122
123};
124
125#endif //_TAB_HH_