Style is based on the 'phase' style which according to its author David Johnson, is "abandonware" (per 2020-09-24 email to Author). This initial commit is based on code developed <= 2020-07-20 and has been tested and actively used on Author's systems to date. Signed-off-by: Vincent Reher <tde@4reher.org>feature/Phase2_style
parent
f39f559fbf
commit
714ac1f0c4
@ -1 +1 @@
|
||||
SUBDIRS = dotnet phase
|
||||
SUBDIRS = dotnet phase phase2
|
||||
|
@ -0,0 +1,3 @@
|
||||
##### create translation templates ##############
|
||||
|
||||
tde_l10n_auto_add_subdirectories( )
|
@ -0,0 +1,49 @@
|
||||
#################################################
|
||||
#
|
||||
# (C) 2021 Vincent Reher
|
||||
# tde (AT) 4reher.org
|
||||
#
|
||||
# Improvements and feedback are welcome
|
||||
#
|
||||
# This file is released under GPL >= 2
|
||||
#
|
||||
#################################################
|
||||
|
||||
add_definitions(
|
||||
-DQT_PLUGIN
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${TQT_INCLUDE_DIRS}
|
||||
${TDE_INCLUDE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
|
||||
link_directories(
|
||||
${TQT_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
add_subdirectory( config )
|
||||
|
||||
##### other data ################################
|
||||
|
||||
tde_create_translated_desktop(
|
||||
SOURCE phase2.themerc
|
||||
DESTINATION ${DATA_INSTALL_DIR}/tdestyle/themes
|
||||
PO_DIR style-themes
|
||||
)
|
||||
|
||||
##### phase2style #################################
|
||||
|
||||
set( target phase2style )
|
||||
|
||||
set( ${target}_SRCS
|
||||
phase2style.cpp phase2style.h shapes.h scaling.h
|
||||
)
|
||||
|
||||
tde_add_kpart( ${target} AUTOMOC
|
||||
SOURCES ${${target}_SRCS}
|
||||
LINK tdefx-shared
|
||||
DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/styles
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
SUBDIRS = config
|
||||
|
||||
KDE_CXXFLAGS = -DQT_PLUGIN
|
||||
|
||||
INCLUDES = $(all_includes)
|
||||
|
||||
styledir = $(kde_datadir)/tdestyle/themes
|
||||
style_DATA = phase2.themerc
|
||||
|
||||
EXTRA_DIST = $(style_DATA)
|
||||
|
||||
noinst_HEADERS = phase2style.h bitmaps.h shapes.h arrows.h
|
||||
|
||||
kde_style_LTLIBRARIES = phase2style.la
|
||||
phase2style_la_SOURCES = phase2style.cpp
|
||||
phase2style_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module $(LIB_QT) $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx
|
||||
phase2style_la_LIBADD = -ltdefx -ltdecore
|
||||
phase2style_la_METASOURCES = AUTO
|
||||
|
||||
DISTCLEANFILES = $(phase2style_la_METASOURCES)
|
@ -0,0 +1,67 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// bitmaps.h
|
||||
// -------------------
|
||||
// Bitmaps for Phase style
|
||||
// -------------------
|
||||
// Copyright (c) 2004 David Johnson
|
||||
// Please see the phasestyle.h file for copyright and license information.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Note: the "light" bits are drawn with midlight color
|
||||
|
||||
// Arrows (6x6)
|
||||
|
||||
static TQBitmap uarrow;
|
||||
static const unsigned char uarrow_bits[] = {
|
||||
0x00, 0x0c, 0x1e, 0x3f, 0x3f, 0x00};
|
||||
|
||||
static TQBitmap darrow;
|
||||
static const unsigned char darrow_bits[] = {
|
||||
0x00, 0x3f, 0x3f, 0x1e, 0x0c, 0x00};
|
||||
|
||||
static TQBitmap larrow;
|
||||
static const unsigned char larrow_bits[] = {
|
||||
0x18, 0x1c, 0x1e, 0x1e, 0x1c, 0x18};
|
||||
|
||||
static TQBitmap rarrow;
|
||||
static const unsigned char rarrow_bits[] = {
|
||||
0x06, 0x0e, 0x1e, 0x1e, 0x0e, 0x06};
|
||||
|
||||
// plus/minus "arrows"
|
||||
|
||||
static TQBitmap bplus;
|
||||
static const unsigned char bplus_bits[] = {
|
||||
0x0c, 0x0c, 0x3f, 0x3f, 0x0c, 0x0c};
|
||||
|
||||
static TQBitmap bminus;
|
||||
static const unsigned char bminus_bits[] = {
|
||||
0x00, 0x00, 0x3f, 0x3f, 0x00, 0x00};
|
||||
|
||||
// checkmark (9x9)
|
||||
|
||||
static TQBitmap bcheck;
|
||||
static const unsigned char bcheck_bits[] = {
|
||||
0x00, 0x00, 0x80, 0x01, 0xc0, 0x01, 0xe0, 0x00, 0x73, 0x00, 0x3f, 0x00,
|
||||
0x1e, 0x00, 0x0c, 0x00, 0x00, 0x00};
|
||||
|
||||
// expander arrows (9x9)
|
||||
|
||||
static TQBitmap dexpand;
|
||||
static const unsigned char dexpand_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0x01, 0xfe, 0x00, 0x7c, 0x00, 0x38, 0x00,
|
||||
0x10, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static TQBitmap rexpand;
|
||||
static const unsigned char rexpand_bits[] = {
|
||||
0x04, 0x00, 0x0c, 0x00, 0x1c, 0x00, 0x3c, 0x00, 0x7c, 0x00, 0x3c, 0x00,
|
||||
0x1c, 0x00, 0x0c, 0x00, 0x04, 0x00};
|
||||
|
||||
// scrollbar doodads (4x4)
|
||||
|
||||
static TQBitmap doodad_mid;
|
||||
static const unsigned char doodad_mid_bits[] = {
|
||||
0x07, 0x01, 0x01, 0x00};
|
||||
|
||||
static TQBitmap doodad_light;
|
||||
static const unsigned char doodad_light_bits[] = {
|
||||
0x00, 0x08, 0x08, 0x0e};
|
@ -0,0 +1,3 @@
|
||||
##### create translation templates ##############
|
||||
|
||||
tde_l10n_create_template( "tdestyle_phase_config" )
|
@ -0,0 +1,36 @@
|
||||
#################################################
|
||||
#
|
||||
# (C) 2021 Vincent Reher
|
||||
# tde (AT) 4reher.org
|
||||
#
|
||||
# Improvements and feedback are welcome
|
||||
#
|
||||
# This file is released under GPL >= 2
|
||||
#
|
||||
#################################################
|
||||
|
||||
include_directories(
|
||||
${TQT_INCLUDE_DIRS}
|
||||
${TDE_INCLUDE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
link_directories(
|
||||
${TQT_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
##### tdestyle_phase_config ########################
|
||||
|
||||
set( target tdestyle_phase2_config )
|
||||
|
||||
set( ${target}_SRCS
|
||||
phase2styleconfig.h
|
||||
phase2styleconfig.cpp
|
||||
styledialog.ui
|
||||
)
|
||||
|
||||
tde_add_kpart( ${target} AUTOMOC
|
||||
SOURCES ${${target}_SRCS}
|
||||
LINK tdeui-shared
|
||||
DESTINATION ${PLUGIN_INSTALL_DIR}
|
||||
)
|
@ -0,0 +1,12 @@
|
||||
INCLUDES = $(all_includes)
|
||||
|
||||
noinst_HEADERS = phase2styleconfig.h
|
||||
|
||||
kde_module_LTLIBRARIES = tdestyle_phase2_config.la
|
||||
tdestyle_phase_config_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module $(LIB_QT) $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx
|
||||
tdestyle_phase_config_la_LIBADD = $(LIB_TDEUI)
|
||||
tdestyle_phase_config_la_SOURCES = phases2tyleconfig.cpp styledialog.ui
|
||||
tdestyle_phase_config_la_METASOURCES = AUTO
|
||||
|
||||
messages: rc.cpp
|
||||
$(XGETTEXT) *.cpp *.h -o $(podir)/tdestyle_phase2_config.pot
|
@ -0,0 +1,111 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// phasestyleconfig.cpp
|
||||
// -------------------
|
||||
// Config dialog for Phase widget style
|
||||
// -------------------
|
||||
// Copyright (c) 2004 David Johnson <david@usermode.org>
|
||||
// Please see the header file for copyright and license information.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <tqsettings.h>
|
||||
#include <tqcheckbox.h>
|
||||
#include <tqgroupbox.h>
|
||||
#include <tqwhatsthis.h>
|
||||
#include <tdelocale.h>
|
||||
#include <tdeglobal.h>
|
||||
|
||||
#include "phase2styleconfig.h"
|
||||
#include "styledialog.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// PhaseStyleConfig Class //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// PhaseStyleConfig()
|
||||
// ----------------
|
||||
// Constructor
|
||||
|
||||
PhaseStyleConfig::PhaseStyleConfig(TQWidget* parent) : StyleDialog(parent)
|
||||
{
|
||||
TDEGlobal::locale()->insertCatalogue("tdestyle_phase_config");
|
||||
|
||||
TQSettings settings;
|
||||
oldgradients =
|
||||
settings.readBoolEntry("/phasestyle/Settings/gradients", true);
|
||||
gradients->setChecked(oldgradients);
|
||||
oldhighlights =
|
||||
settings.readBoolEntry("/phasestyle/Settings/highlights", true);
|
||||
highlights->setChecked(oldhighlights);
|
||||
|
||||
// connections
|
||||
connect(gradients, TQT_SIGNAL(toggled(bool)),
|
||||
this, TQT_SLOT(updateChanged()));
|
||||
connect(highlights, TQT_SIGNAL(toggled(bool)),
|
||||
this, TQT_SLOT(updateChanged()));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// ~PhaseStyleConfig()
|
||||
// -----------------
|
||||
// Destructor
|
||||
|
||||
PhaseStyleConfig::~PhaseStyleConfig()
|
||||
{
|
||||
TDEGlobal::locale()->removeCatalogue("tdestyle_phase_config");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// selectionChanged()
|
||||
// ------------------
|
||||
// Selection has changed
|
||||
|
||||
void PhaseStyleConfig::updateChanged()
|
||||
{
|
||||
bool update = false;
|
||||
|
||||
if ((gradients->isChecked() != oldgradients) ||
|
||||
(highlights->isChecked() != oldhighlights)) {
|
||||
update = true;
|
||||
}
|
||||
|
||||
emit changed(update);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// save()
|
||||
// ------
|
||||
// Save the settings
|
||||
|
||||
void PhaseStyleConfig::save()
|
||||
{
|
||||
TQSettings settings;
|
||||
settings.writeEntry("/phasestyle/Settings/gradients",
|
||||
gradients->isChecked());
|
||||
settings.writeEntry("/phasestyle/Settings/highlights",
|
||||
highlights->isChecked());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// defaults()
|
||||
// ----------
|
||||
// Set to the defaults
|
||||
|
||||
void PhaseStyleConfig::defaults()
|
||||
{
|
||||
gradients->setChecked(true);
|
||||
highlights->setChecked(true);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Plugin Stuff //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern "C"
|
||||
{
|
||||
KDE_EXPORT TQObject* allocate_tdestyle_config(TQWidget* parent) {
|
||||
return(TQT_TQOBJECT(new PhaseStyleConfig(parent)));
|
||||
}
|
||||
}
|
||||
|
||||
#include "phase2styleconfig.moc"
|
@ -0,0 +1,57 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// phasestyleconfig.h
|
||||
// -------------------
|
||||
// Config dialog for Phase widget style
|
||||
// -------------------
|
||||
// Copyright (c) 2004 David Johnson <david@usermode.org>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PHASESTYLECONFIG_H
|
||||
#define PHASESTYLECONFIG_H
|
||||
|
||||
#include "styledialog.h"
|
||||
|
||||
class TDEConfig;
|
||||
|
||||
class PhaseStyleConfig : public StyleDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PhaseStyleConfig(TQWidget* parent);
|
||||
~PhaseStyleConfig();
|
||||
|
||||
signals:
|
||||
void changed(bool);
|
||||
|
||||
public slots:
|
||||
void save();
|
||||
void defaults();
|
||||
|
||||
protected slots:
|
||||
void updateChanged();
|
||||
|
||||
private:
|
||||
bool oldgradients;
|
||||
bool oldhighlights;
|
||||
};
|
||||
|
||||
#endif // PHASESTYLECONFIG_H
|
@ -0,0 +1,70 @@
|
||||
<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
|
||||
<class>StyleDialog</class>
|
||||
<widget class="TQWidget">
|
||||
<property name="name">
|
||||
<cstring>StyleDialog</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>217</width>
|
||||
<height>103</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>Style Dialog</string>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="TQGroupBox">
|
||||
<property name="name">
|
||||
<cstring>stylebox</cstring>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>GroupBoxPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>Sunken</enum>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Style Settings</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="TQCheckBox">
|
||||
<property name="name">
|
||||
<cstring>gradients</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use &gradients</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>This option will draw buttons and several other widgets using a gradient texture</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQCheckBox">
|
||||
<property name="name">
|
||||
<cstring>highlights</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Highlight on &mouse hover</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>This option will highlight buttons and several other widgets when the mouse cursor is over them</string>
|
||||
</property>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>gradients</tabstop>
|
||||
<tabstop>highlights</tabstop>
|
||||
</tabstops>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
@ -0,0 +1,86 @@
|
||||
[Misc]
|
||||
Name=Phase2
|
||||
Name[br]=Prantadoù
|
||||
Name[ca]=Fase
|
||||
Name[el]=Φάση
|
||||
Name[eo]=Fazo
|
||||
Name[es]=Fase
|
||||
Name[et]=Faas
|
||||
Name[eu]=Fasea
|
||||
Name[fa]=گام
|
||||
Name[fi]=Vaihe
|
||||
Name[fy]=Faze
|
||||
Name[ga]=Pas
|
||||
Name[he]=קרני לייזר
|
||||
Name[hi]=फेज़
|
||||
Name[is]=Fasi
|
||||
Name[it]=Fase
|
||||
Name[ja]=位相
|
||||
Name[ka]=ფაზა
|
||||
Name[mk]=Фаза
|
||||
Name[ms]=Fasa
|
||||
Name[nb]=Fase
|
||||
Name[nds]=Phaas
|
||||
Name[ne]=चरण
|
||||
Name[nn]=Fase
|
||||
Name[pa]=ਪੜਾਅ
|
||||
Name[pl]=Faza
|
||||
Name[ru]=Фаза
|
||||
Name[sl]=Faza
|
||||
Name[sr]=Фаза
|
||||
Name[sr@Latn]=Faza
|
||||
Name[sv]=Fas
|
||||
Name[ta]=பகுதி
|
||||
Name[tr]=Faz
|
||||
Name[uk]=Фаза
|
||||
Name[vi]=Pha
|
||||
Name[zh_TW]=相
|
||||
ConfigPage=tdestyle_phase2_config
|
||||
Comment=Clean classical look that scales with current widget font
|
||||
Comment[bg]=Семпъл и изчистен стил
|
||||
Comment[bs]=Jednostavan klasični stil
|
||||
Comment[ca]=Un estil clàssic i net
|
||||
Comment[cs]=Klasický čistý vzhled
|
||||
Comment[da]=Rent klassisk udseende
|
||||
Comment[de]=Ein einfaches und klares Aussehen
|
||||
Comment[el]=Ένα απλό και κλασσικό στυλ
|
||||
Comment[es]=Un estilo clásico y claro
|
||||
Comment[et]=Lihtne klassikaline välimus
|
||||
Comment[eu]=Itxura garbi klasikoa
|
||||
Comment[fa]=ظاهر کلاسیک واضح
|
||||
Comment[fi]=Puhdas perinteinen tyyli
|
||||
Comment[fr]=Un style simple et propre
|
||||
Comment[fy]=In klassyk en moai uterlik
|
||||
Comment[gl]=Apariencia sinxela e clásica
|
||||
Comment[he]=סגנון פשוט ונקי
|
||||
Comment[hi]=साफ शास्त्रीय रूप
|
||||
Comment[hu]=Tiszta, egyszerű stílus
|
||||
Comment[is]=Einfaldur og hreinlegur stíll
|
||||
Comment[it]=Orologio classico
|
||||
Comment[ja]=単純で清潔なスタイル
|
||||
Comment[ka]=სადა და კლასიკური სტილი
|
||||
Comment[mk]=Чист класичен изглед
|
||||
Comment[ms]=Rupa klasik bersih
|
||||
Comment[nb]=Enkelt klassisk utseende
|
||||
Comment[nds]=Oprüümt klass'sch Utsehn
|
||||
Comment[ne]=सफा उत्कृष्ट ढाँचा
|
||||
Comment[nl]=Een klassiek en schoon uiterlijk
|
||||
Comment[nn]=Enkel og klassisk utsjånad
|
||||
Comment[pa]=ਸਾਫ਼ ਟਕਸਾਲੀ ਦਿੱਖ
|
||||
Comment[pl]=Czysty, klasyczny wygląd
|
||||
Comment[pt]=Um estilo clássico limpo
|
||||
Comment[pt_BR]=Uma aprência clássica limpa
|
||||
Comment[ru]=Простой классический стиль
|
||||
Comment[sk]=Jednoduchý klasický vzhľad
|
||||
Comment[sl]=Čist klasičen izgled
|
||||
Comment[sr]=Чист класичан изглед
|
||||
Comment[sr@Latn]=Čist klasičan izgled
|
||||
Comment[sv]=Ren och klassisk stil
|
||||
Comment[ta]=விசேஷ பார்வையைத் துடை
|
||||
Comment[tr]=Temiz ve klasik bir görünüm
|
||||
Comment[uk]=Акуратний, класичний стиль
|
||||
Comment[vi]=Sạch, kiểu dáng truyền thống
|
||||
Comment[zh_CN]=简洁经典的外观
|
||||
Comment[zh_TW]=乾淨的傳統外觀
|
||||
[KDE]
|
||||
WidgetStyle=Phase2
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,280 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// phase2style.h
|
||||
// -------------------
|
||||
// TQt/TDE widget style
|
||||
// -------------------
|
||||
// Copyright (c) 2004 David Johnson <david@usermode.org>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PHASE2STYLE_H
|
||||
#define PHASE2STYLE_H
|
||||
|
||||
#include <tdestyle.h>
|
||||
#include <tqcolor.h>
|
||||
#include <tqintcache.h>
|
||||
|
||||
class KPixmap;
|
||||
|
||||
class GradientSet
|
||||
{
|
||||
public:
|
||||
enum GradientType {
|
||||
Horizontal,
|
||||
Vertical,
|
||||
HorizontalReverse,
|
||||
VerticalReverse,
|
||||
GradientTypeCount
|
||||
};
|
||||
|
||||
GradientSet(const TQColor &color, int size);
|
||||
~GradientSet();
|
||||
|
||||
KPixmap* gradient(bool horizontal, bool reverse);
|
||||
|
||||
private:
|
||||
KPixmap *set[GradientTypeCount];
|
||||
TQColor color_;
|
||||
int size_;
|
||||
};
|
||||
|
||||
class Phase2Style : public TDEStyle
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Phase2Style();
|
||||
virtual ~Phase2Style();
|
||||
|
||||
void applicationPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *);
|
||||
void polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *);
|
||||
void polish(TQPalette &pal);
|
||||
void unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *);
|
||||
|
||||
void drawPrimitive(TQ_PrimitiveElement element,
|
||||
TQPainter *painter,
|
||||
const TQStyleControlElementData &ceData,
|
||||
ControlElementFlags elementFlags,
|
||||
const TQRect &rect,
|
||||
const TQColorGroup &group,
|
||||
SFlags flags = Style_Default,
|
||||
const TQStyleOption &option = TQStyleOption::Default) const;
|
||||
|
||||
void drawTDEStylePrimitive(TDEStylePrimitive element,
|
||||
TQPainter *painter,
|
||||
const TQStyleControlElementData &ceData,
|
||||
ControlElementFlags elementFlags,
|
||||
const TQRect &rect,
|
||||
const TQColorGroup &group,
|
||||
SFlags flags = Style_Default,
|
||||
const TQStyleOption &option = TQStyleOption::Default,
|
||||
const TQWidget *widget = 0) const;
|
||||
|
||||
void drawControl(TQ_ControlElement element,
|
||||
TQPainter *painter,
|
||||
const TQStyleControlElementData &ceData,
|
||||
ControlElementFlags elementFlags,
|
||||
const TQRect &rect,
|
||||
const TQColorGroup &group,
|
||||
SFlags flags = Style_Default,
|
||||
const TQStyleOption &option = TQStyleOption::Default,
|
||||
const TQWidget *widget = 0) const;
|
||||
|
||||
void drawControlMask(TQ_ControlElement element,
|
||||
TQPainter *painter,
|
||||
const TQStyleControlElementData &ceData,
|
||||
ControlElementFlags elementFlags,
|
||||
const TQRect &rect,
|
||||
const TQStyleOption &option = TQStyleOption::Default,
|
||||
const TQWidget *widget = 0) const;
|
||||
|
||||
void drawComplexControl(TQ_ComplexControl control,
|
||||
TQPainter *painter,
|
||||
const TQStyleControlElementData &ceData,
|
||||
ControlElementFlags elementFlags,
|
||||
const TQRect &rect,
|
||||
const TQColorGroup &group,
|
||||
SFlags flags = Style_Default,
|
||||
SCFlags controls = SC_All,
|
||||
SCFlags active = SC_None,
|
||||
const TQStyleOption &option = TQStyleOption::Default,
|
||||
const TQWidget *widget = 0) const;
|
||||
|
||||
void drawComplexControlMask(TQ_ComplexControl control,
|
||||
TQPainter *painter,
|
||||
const TQStyleControlElementData &ceData,
|
||||
const ControlElementFlags elementFlags,
|
||||
const TQRect &rect,
|
||||
const TQStyleOption &option = TQStyleOption::Default,
|
||||
const TQWidget *widget = 0) const;
|
||||
|
||||
int pixelMetric(PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags,
|
||||
const TQWidget *widget = 0) const;
|
||||
|
||||
TQRect subRect(SubRect rect, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget = 0) const;
|
||||
|
||||
TQRect querySubControlMetrics(TQ_ComplexControl control,
|
||||
const TQStyleControlElementData &ceData,
|
||||
ControlElementFlags elementFlags,
|
||||
SubControl subcontrol,
|
||||
const TQStyleOption &option = TQStyleOption::Default,
|
||||
const TQWidget *widget = 0) const;
|
||||
|
||||
TQSize sizeFromContents(ContentsType contents,
|
||||
const TQStyleControlElementData &ceData,
|
||||
ControlElementFlags elementFlags,
|
||||
const TQSize &contentsize,
|
||||
const TQStyleOption& option = TQStyleOption::Default,
|
||||
const TQWidget *widget = 0) const;
|
||||
|
||||
int styleHint(TQ_StyleHint, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags,
|
||||
const TQStyleOption & = TQStyleOption::Default,
|
||||
TQStyleHintReturn * = 0, const TQWidget * = 0 ) const;
|
||||
|
||||
//#include "plastik-excerpt.h"
|
||||
|
||||
private:
|
||||
//Phase2Style(const Phase2Style &);
|
||||
//Phase2Style& operator=(const Phase2Style &);
|
||||
|
||||
void drawPhaseBevel(TQPainter *painter,
|
||||
int x, int y, int w, int h,
|
||||
const TQColorGroup &group,
|
||||
const TQColor &fill,
|
||||
bool sunken=false,
|
||||
bool horizontal=true,
|
||||
bool reverse=false) const;
|
||||
|
||||
void drawPhaseButton(TQPainter *painter,
|
||||
int x, int y, int w, int h,
|
||||
const TQColorGroup &group,
|
||||
const TQColor &fill,
|
||||
bool sunken=false) const;
|
||||
|
||||
void drawPhasePanel(TQPainter *painter,
|
||||
int x, int y, int w, int h,
|
||||
const TQColorGroup &group,
|
||||
bool sunken=false,
|
||||
const TQBrush *fill=NULL) const;
|
||||
|
||||
void drawPhaseTab(TQPainter *painter,
|
||||
int x, int y, int w, int h,
|
||||
const TQColorGroup &group,
|
||||
const TQStyleControlElementData &ceData,
|
||||
ControlElementFlags elementFlags,
|
||||
const TQStyleOption &option,
|
||||
const SFlags flags) const;
|
||||
|
||||
void drawPhaseGradient(TQPainter *painter,
|
||||
const TQRect &rect,
|
||||
TQColor color,
|
||||
bool horizontal,
|
||||
int px=0, int py=0,
|
||||
int pw=-1, int ph=-1,
|
||||
bool reverse=false) const;
|
||||
|
||||
bool flatToolbar(
|
||||
const TQStyleControlElementData &ceData,
|
||||
const ControlElementFlags elementFlags,
|
||||
const TQToolBar* toolbar
|
||||
) const;
|
||||
|
||||
bool objectEventHandler(
|
||||
const TQStyleControlElementData &ceData,
|
||||
ControlElementFlags elementFlags,
|
||||
void* source,
|
||||
TQEvent* e
|
||||
);
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Low-level image drawing functions
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
//--- Taken from Highcontrast style:
|
||||
|
||||
void drawRect(
|
||||
TQPainter* painter,
|
||||
TQRect rect,
|
||||
int offset = 0,
|
||||
bool filled = true
|
||||
) const;
|
||||
|
||||
void drawRoundRect(
|
||||
TQPainter* painter,
|
||||
TQRect rect,
|
||||
int offset = 0,
|
||||
bool filled = true
|
||||
) const;
|
||||
|
||||
void drawEllipse(
|
||||
TQPainter* painter,
|
||||
TQRect rect,
|
||||
int offset = 0,
|
||||
bool filled = true
|
||||
) const;
|
||||
|
||||
void drawArrow(
|
||||
TQPainter* painter,
|
||||
TQRect rect,
|
||||
TQ_PrimitiveElement arrow,
|
||||
int offset = 0
|
||||
) const;
|
||||
|
||||
//--- Taken from legacy code:
|
||||
|
||||
void drawArrowBitmap(
|
||||
TQPainter* painter,
|
||||
TQRect rect,
|
||||
TQ_PrimitiveElement arrow
|
||||
) const;
|
||||
|
||||
//--- New code:
|
||||
|
||||
void drawCheckmark(
|
||||
TQPainter* painter,
|
||||
TQRect rect,
|
||||
int offset = 0
|
||||
) const;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Image generation functions
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
TQPixmap * Create_Arrow_Pix(
|
||||
TQ_PrimitiveElement shape,
|
||||
int size,
|
||||
int scaling
|
||||
) const ;
|
||||
|
||||
TQImage * Create_Arrow_Image(
|
||||
TQ_PrimitiveElement shape,
|
||||
int size,
|
||||
int scaling
|
||||
) const ;
|
||||
|
||||
private:
|
||||
TQMap<unsigned int, TQIntDict<GradientSet> > * gradients;
|
||||
bool gradients_;
|
||||
bool highlights_;
|
||||
bool reverse_;
|
||||
bool kicker_;
|
||||
};
|
||||
|
||||
#endif // PHASE2STYLE_H
|
@ -0,0 +1,139 @@
|
||||
#ifndef __SCALING_H__
|
||||
#define __SCALING_H__
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
static int QT3SCALE_MAX = 3 ;
|
||||
static int QT3SCALE = 1 ;
|
||||
|
||||
#define QT3SCALE_TAG_BUFFSIZE 3
|
||||
static char QT3SCALE_TAG[QT3SCALE_TAG_BUFFSIZE] = { '1', 0, 0 } ;
|
||||
|
||||
//--- Information about current application font
|
||||
|
||||
const static TQFont CurrentFont = TQApplication::font() ;
|
||||
const static TQFontInfo CurrentFontInfo(CurrentFont) ;
|
||||
const static TQFontMetrics CurrentFontMetrics(CurrentFont) ;
|
||||
|
||||
|
||||
static int FONT_Size = 16 ; // Sans 12 pixel size
|
||||
static double FONT_Scale = 1.00 ; // 96 DPI
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Functions called during style initialization
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static void
|
||||
Generate_Scaling_Metrics(const QWidget * w = 0)
|
||||
{
|
||||
//--- FONT_Size is an important metric for scaling widget elements
|
||||
|
||||
FONT_Size = CurrentFontMetrics.ascent() + CurrentFontMetrics.descent() ;
|
||||
/* Alternative methods for initial computing FONT_Size
|
||||
with exmplary values displayed for Sans 10/12 fonts:
|
||||
CurrentFontMetrics.strikeOutPos() * 3 ; // 12/15
|
||||
CurrentFontInfo.pixelSize() ; // 13/16
|
||||
CurrentFontMetrics.overlinePos() ; // 13/16
|
||||
CurrentFontMetrics.ascent() + CurrentFontMetrics.descent() ; // 14/18
|
||||
CurrentFontMetrics.height() ; // 15/19
|
||||
*/
|
||||
if (FONT_Size % 2 != 0) FONT_Size++ ;
|
||||
|
||||
//--- FONT_scale is also an important metric for scaling widget elements
|
||||
|
||||
double Pixels_96dpi = 4 * CurrentFontInfo.pointSize() / 3 ;
|
||||
// Calculate font size relative to 96dpi
|
||||
FONT_Scale = (double)(int)((double)( FONT_Size / Pixels_96dpi )*4)/4 ;
|
||||
// Calculate font scaling relative to 96dpi in increments of 0.25
|
||||
|
||||
//fprintf(stderr,
|
||||
// "At the current %.2f scaling, a %d-point font is %d (%d) pixels high\n",
|
||||
// FONT_scale, FONT_points, FONT_size, FONT_height
|
||||
//) ;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void Set_QT3SCALE()
|
||||
{
|
||||
QT3SCALE = 1 ;
|
||||
const char *QT3SCALE_env = getenv("QT3SCALE");
|
||||
if ( QT3SCALE_env != NULL ) {
|
||||
int QT3SCALE_int = atoi(QT3SCALE_env) ;
|
||||
if ( QT3SCALE_int > 1 && QT3SCALE_int <= QT3SCALE_MAX )
|
||||
QT3SCALE = QT3SCALE_int ;
|
||||
}
|
||||
snprintf(QT3SCALE_TAG, QT3SCALE_TAG_BUFFSIZE, "%d", QT3SCALE) ;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
QStyle::PE_ButtonCommand - button used to initiate an action, for example, a QPushButton.
|
||||
QStyle::PE_ButtonDefault - this button is the default button, e.g. in a dialog.
|
||||
QStyle::PE_ButtonBevel - generic button bevel.
|
||||
QStyle::PE_ButtonTool - tool button, for example, a QToolButton.
|
||||
QStyle::PE_ButtonDropDown - drop down button, for example, a tool button that displays a popup menu, for example, QPopupMenu.
|
||||
|
||||
QStyle::PE_FocusRect - generic focus indicator.
|
||||
|
||||
QStyle::PE_ArrowUp - up arrow.
|
||||
QStyle::PE_ArrowDown - down arrow.
|
||||
QStyle::PE_ArrowRight - right arrow.
|
||||
QStyle::PE_ArrowLeft - left arrow.
|
||||
|
||||
QStyle::PE_SpinWidgetUp - up symbol for a spin widget, for example a QSpinBox.
|
||||
QStyle::PE_SpinWidgetDown - down symbol for a spin widget.
|
||||
QStyle::PE_SpinWidgetPlus - increase symbol for a spin widget.
|
||||
QStyle::PE_SpinWidgetMinus - decrease symbol for a spin widget.
|
||||
|
||||
QStyle::PE_Indicator - on/off indicator, for example, a QCheckBox.
|
||||
QStyle::PE_IndicatorMask - bitmap mask for an indicator.
|
||||
QStyle::PE_ExclusiveIndicator - exclusive on/off indicator, for example, a QRadioButton.
|
||||
QStyle::PE_ExclusiveIndicatorMask - bitmap mask for an exclusive indicator.
|
||||
|
||||
QStyle::PE_DockWindowHandle - tear off handle for dock windows and toolbars, for example QDockWindows and QToolBars.
|
||||
QStyle::PE_DockWindowSeparator - item separator for dock window and toolbar contents.
|
||||
QStyle::PE_DockWindowResizeHandle - resize handle for dock windows.
|
||||
QStyle::PE_Splitter - splitter handle; see also QSplitter.
|
||||
|
||||
QStyle::PE_Panel - generic panel frame; see also QFrame.
|
||||
QStyle::PE_PanelPopup - panel frame for popup windows/menus; see also QPopupMenu.
|
||||
QStyle::PE_PanelMenuBar - panel frame for menu bars.
|
||||
QStyle::PE_PanelDockWindow - panel frame for dock windows and toolbars.
|
||||
QStyle::PE_PanelTabWidget - panel frame for tab widgets.
|
||||
QStyle::PE_PanelLineEdit - panel frame for line edits.
|
||||
QStyle::PE_PanelGroupBox - panel frame for group boxes.
|
||||
QStyle::PE_TabBarBase - area below tabs in a tab widget, for example, QTab.
|
||||
|
||||
QStyle::PE_HeaderSection - section of a list or table header; see also QHeader.
|
||||
QStyle::PE_HeaderArrow - arrow used to indicate sorting on a list or table header
|
||||
QStyle::PE_StatusBarSection - section of a status bar; see also QStatusBar.
|
||||
|
||||
QStyle::PE_GroupBoxFrame - frame around a group box; see also QGroupBox.
|
||||
QStyle::PE_WindowFrame - frame around a MDI window or a docking window
|
||||
|
||||
QStyle::PE_Separator - generic separator.
|
||||
|
||||
QStyle::PE_SizeGrip - window resize handle; see also QSizeGrip.
|
||||
|
||||
QStyle::PE_CheckMark - generic check mark; see also QCheckBox.
|
||||
|
||||
QStyle::PE_ScrollBarAddLine - scrollbar line increase indicator (i.e. scroll down); see also QScrollBar.
|
||||
QStyle::PE_ScrollBarSubLine - scrollbar line decrease indicator (i.e. scroll up).
|
||||
QStyle::PE_ScrollBarAddPage - scolllbar page increase indicator (i.e. page down).
|
||||
QStyle::PE_ScrollBarSubPage - scrollbar page decrease indicator (i.e. page up).
|
||||
QStyle::PE_ScrollBarSlider - scrollbar slider
|
||||
QStyle::PE_ScrollBarFirst - scrollbar first line indicator (i.e. home).
|
||||
QStyle::PE_ScrollBarLast - scrollbar last line indicator (i.e. end).
|
||||
|
||||
QStyle::PE_ProgressBarChunk - section of a progress bar indicator; see also QProgressBar.
|
||||
QStyle::PE_CheckListController - controller part of a listview item
|
||||
QStyle::PE_CheckListIndicator - checkbox part of a listview item
|
||||
QStyle::PE_CheckListExclusiveIndicator - radiobutton part of a listview item
|
||||
QStyle::PE_RubberBand - rubber band used in such things as iconview
|
||||
QStyle::PE_CustomBase - base value for custom PrimitiveElements. All values above this are reserved for custom use. Custom values must be greater than this value.
|
||||
*/
|
||||
|
||||
#endif
|
@ -0,0 +1,400 @@
|
||||
#ifndef __SHAPES_H__
|
||||
#define __SHAPES_H__
|
||||
|
||||
#include <tdestyle.h>
|
||||
#include <tqcolor.h>
|
||||
#include <tqimage.h>
|
||||
#include "bitmaps.h"
|
||||
|
||||
/*
|
||||
Symbols supported by Liberation Sans:
|
||||
|
||||
0x2713 - Unicode checkmark - regular
|
||||
0x2714 - Unicode checkmark = bold
|
||||
|
||||
0x2206 - Unicode math operator triangle "up"
|
||||
0x2207 - Unicode math operator triangle "down"
|
||||
|
||||
0x25B2 - Unicode geometric shape triangle solid "up"
|
||||
0x25BA - Unicode geometric shape triangle solid "right"
|
||||
0x25BC - Unicode geometric shape triangle solid "down"
|
||||
|
||||
Symbols NOT supported by Liberation Sans:
|
||||
|
||||
0x22B2 - Unicode mathematical operator triangle "left"
|
||||
0x22B3 - Unicode mathematical operator triangle "right"
|
||||
|
||||
0x25C2 - Unicode geometric shape solid "left" triangle
|
||||
*/
|
||||
|
||||
//--- Checkmark unicode characters
|
||||
|
||||
#define UNICODE_CHECKMARK_REGULAR 0x2713
|
||||
#define UNICODE_CHECKMARK_BOLD 0x2714
|
||||
#define UNICODE_CHECKMARK_BALLOT_BOX 0x2611
|
||||
|
||||
static TQChar Checkmark = 0 ;
|
||||
|
||||
//--- Arrow unicode characters
|
||||
|
||||
#define UNICODE_TRIANGLE_OTHER 0x25BC
|
||||
|
||||
//--- Arrow sizes (drawn)
|
||||
|
||||
static int ARROW_Size1 = 16 ; // FONT_size / 2
|
||||
static int ARROW_Size2 = 8 ; // FONT_size / 2
|
||||
static int ARROW_Size3 = 6 ; // FONT_size / 3, made even
|
||||
static int ARROW_Size4 = 4 ; // FONT_size / 4
|
||||
static int ARROW_Size4x3 = 12 ; // FONT_size * (3/4)
|
||||
|
||||
//--- Arrow images (pre-drawn)
|
||||
|
||||
static TQPixmap * KPE_ListViewExpander_ArrowLeft = 0 ;
|
||||
static TQPixmap * KPE_ListViewExpander_ArrowRight = 0 ;
|
||||
static TQImage * iKPE_ListViewExpander_ArrowLeft = 0 ;
|
||||
static TQImage * iKPE_ListViewExpander_ArrowRight = 0 ;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Initialization
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
Initialize_Shapes()
|
||||
{
|
||||
//--- Determine checkmark
|
||||
|
||||
TQChar checkmark = UNICODE_CHECKMARK_BOLD ;
|
||||
if (! CurrentFontMetrics.inFont( checkmark ) )
|
||||
checkmark = 'x' ;
|
||||
Checkmark = checkmark ;
|
||||
|
||||
//--- Determine drawn arrow sizes, in terms of fractions of FONT_size
|
||||
|
||||
ARROW_Size1 = FONT_Size ; if (ARROW_Size1 % 2 != 0) ARROW_Size1++ ;
|
||||
ARROW_Size1 = FONT_Size + FONT_Size % 2 ;
|
||||
ARROW_Size2 = ARROW_Size1 / 2 ;
|
||||
ARROW_Size3 = ARROW_Size1 / 3 + ARROW_Size1 % 3 ;
|
||||
ARROW_Size4 = ARROW_Size1 / 4 + ARROW_Size1 % 4 ;
|
||||
ARROW_Size4x3 = ARROW_Size4 * 3 ;
|
||||
|
||||
//--- Create bitmaps used in legacy code:
|
||||
|
||||
uarrow = TQBitmap(6, 6, uarrow_bits, true);
|
||||
uarrow.setMask(uarrow);
|
||||
darrow = TQBitmap(6, 6, darrow_bits, true);
|
||||
darrow.setMask(darrow);
|
||||
larrow = TQBitmap(6, 6, larrow_bits, true);
|
||||
larrow.setMask(larrow);
|
||||
rarrow = TQBitmap(6, 6, rarrow_bits, true);
|
||||
rarrow.setMask(rarrow);
|
||||
bplus = TQBitmap(6, 6, bplus_bits, true);
|
||||
bplus.setMask(bplus);
|
||||
bminus = TQBitmap(6, 6, bminus_bits, true);
|
||||
bminus.setMask(bminus);
|
||||
bcheck = TQBitmap(9, 9, bcheck_bits, true);
|
||||
bcheck.setMask(bcheck);
|
||||
dexpand = TQBitmap(9, 9, dexpand_bits, true);
|
||||
dexpand.setMask(dexpand);
|
||||
rexpand = TQBitmap(9, 9, rexpand_bits, true);
|
||||
rexpand.setMask(rexpand);
|
||||
doodad_mid = TQBitmap(4, 4, doodad_mid_bits, true);
|
||||
doodad_light = TQBitmap(4, 4, doodad_light_bits, true);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Low-level image drawing functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//--- Taken from Highcontrast style:
|
||||
|
||||
void
|
||||
addOffset(
|
||||
TQRect* r,
|
||||
int offset,
|
||||
int lineWidth = 0
|
||||
)
|
||||
{
|
||||
int offset1 = offset;
|
||||
int offset2 = offset;
|
||||
|
||||
*r = r->normalize();
|
||||
|
||||
if (lineWidth > 0)
|
||||
{
|
||||
offset1 += lineWidth/2;
|
||||
offset2 += lineWidth - lineWidth/2 - 1;
|
||||
}
|
||||
|
||||
if (offset1 + offset2 > r->width())
|
||||
r->addCoords (r->width()/2, 0, - (r->width() - r->width()/2), 0);
|
||||
else
|
||||
r->addCoords (offset1, 0, -offset2, 0);
|
||||
|
||||
if (offset1 + offset2 > r->height())
|
||||
r->addCoords (0, r->height()/2, 0, - (r->height() - r->height()/2));
|
||||
else
|
||||
r->addCoords (0, offset1, 0, -offset2);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
Phase2Style::drawRect(
|
||||
TQPainter* p,
|
||||
TQRect r,
|
||||
int offset,
|
||||
bool filled
|
||||
) const
|
||||
{
|
||||
addOffset (&r, offset, p->pen().width());
|
||||
if (filled)
|
||||
p->fillRect (r, p->backgroundColor());
|
||||
|
||||
p->drawRect (r);
|
||||
}
|
||||
|
||||
void
|
||||
Phase2Style::drawRoundRect(
|
||||
TQPainter* p,
|
||||
TQRect r,
|
||||
int offset,
|
||||
bool filled
|
||||
) const
|
||||
{
|
||||
int lineWidth = p->pen().width();
|
||||
if ((r.width() >= 5*lineWidth + 2*offset) && (r.height() >= 5*lineWidth + 2*offset))
|
||||
{
|
||||
TQRect r2 (r);
|
||||
addOffset (&r2, offset, lineWidth);
|
||||
|
||||
addOffset (&r, offset);
|
||||
TQRect r3 (r);
|
||||
addOffset (&r3, lineWidth);
|
||||
|
||||
p->save();
|
||||
p->setPen (Qt::NoPen);
|
||||
if (filled)
|
||||
p->fillRect (r3, p->backgroundColor());
|
||||
p->drawRect (r3);
|
||||
p->restore();
|
||||
|
||||
p->drawLine (r.left()+lineWidth, r2.top(), r.right()+1-lineWidth, r2.top());
|
||||
p->fillRect (r.left()+1, r.top()+1, lineWidth, lineWidth, p->pen().color());
|
||||
p->drawLine (r2.left(), r.top()+lineWidth, r2.left(), r.bottom()+1-lineWidth);
|
||||
p->fillRect (r.left()+1, r.bottom()-lineWidth, lineWidth, lineWidth, p->pen().color());
|
||||
p->drawLine (r.left()+lineWidth, r2.bottom(), r.right()+1-lineWidth, r2.bottom());
|
||||
p->fillRect (r.right()-lineWidth, r.bottom()-lineWidth, lineWidth, lineWidth, p->pen().color());
|
||||
p->drawLine (r2.right(), r.top()+lineWidth, r2.right(), r.bottom()+1-lineWidth);
|
||||
p->fillRect (r.right()-lineWidth, r.top()+1, lineWidth, lineWidth, p->pen().color());
|
||||
}
|
||||
else
|
||||
drawRect (p, r, offset, filled);
|
||||
}
|
||||
|
||||
void
|
||||
Phase2Style::drawEllipse(
|
||||
TQPainter* p,
|
||||
TQRect r,
|
||||
int offset,
|
||||
bool filled
|
||||
) const
|
||||
{
|
||||
addOffset (&r, offset, p->pen().width());
|
||||
|
||||
if (filled) {
|
||||
p->save();
|
||||
p->setBrush (p->backgroundColor());
|
||||
p->drawRoundRect (r, 99, 99);
|
||||
p->restore();
|
||||
}
|
||||
|
||||
p->drawRoundRect (r, 99, 99);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
Phase2Style::drawArrow(
|
||||
TQPainter* p,
|
||||
TQRect r,
|
||||
TQ_PrimitiveElement arrow,
|
||||
int offset
|
||||
) const
|
||||
{
|
||||
p->save();
|
||||
addOffset (&r, offset);
|
||||
|
||||
TQPoint center = r.center();
|
||||
if (r.height() < r.width())
|
||||
r.setWidth (r.height());
|
||||
if (r.width() % 2 != 0)
|
||||
r.setWidth (r.width() - 1);
|
||||
r.setHeight (r.width());
|
||||
r.moveCenter (center);
|
||||
|
||||
TQPointArray points (3);
|
||||
switch (arrow) {
|
||||
case PE_ArrowUp:
|
||||
case PE_SpinWidgetUp:
|
||||
case PE_SpinWidgetPlus: {
|
||||
points.setPoint (0, r.bottomLeft());
|
||||
points.setPoint (1, r.bottomRight());
|
||||
points.setPoint (2, r.center().x(), r.top() + r.height()/7);
|
||||
break;
|
||||
}
|
||||
case PE_ArrowDown:
|
||||
case PE_SpinWidgetDown:
|
||||
case PE_SpinWidgetMinus: {
|
||||
points.setPoint (0, r.topLeft());
|
||||
points.setPoint (1, r.topRight());
|
||||
points.setPoint (2, r.center().x(), r.bottom() - r.height()/7);
|
||||
break;
|
||||
}
|
||||
case PE_ArrowLeft: {
|
||||
points.setPoint (0, r.topRight());
|
||||
points.setPoint (1, r.bottomRight());
|
||||
points.setPoint (2, r.left() + r.width()/7, r.center().y());
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
points.setPoint (0, r.topLeft());
|
||||
points.setPoint (1, r.bottomLeft());
|
||||
points.setPoint (2, r.right() - r.width()/7, r.center().y());
|
||||
}
|
||||
}
|
||||
|
||||
p->setPen (p->pen().color());
|
||||
p->setBrush (p->pen().color());
|
||||
p->drawPolygon (points);
|
||||
p->restore();
|
||||
}
|
||||
|
||||
/*
|
||||
* Called from phasestyle.cpp:
|
||||
* drawPrimitive()
|
||||
* PE_HeaderArrow ARROW_Size2 (scaling = 0)
|
||||
* PE_ScrollBar(Add,Sub)Line ARROW_Size2 (scaling = 0)
|
||||
* PE_SpinWidget(Up,Down) ARROW_Size2 (scaling = 1)
|
||||
* PE_Arrow(Up,Down,Left,Right) ARROW_Size4 (scaling = -1)
|
||||
* drawTDEStylePrimitive()
|
||||
* KPE_ListViewExpander ARROW_Size2 (scaling = 1)
|
||||
* drawControl()
|
||||
* CE_PopupMenuItem ARROW_Size2 (offset=0)
|
||||
* CE_PushButtonLabel drawArrow called directly, offset 3 # FIXME
|
||||
*
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//--- Taken from legacy code:
|
||||
|
||||
void
|
||||
Phase2Style::drawArrowBitmap(
|
||||
TQPainter* painter,
|
||||
TQRect rect,
|
||||
TQ_PrimitiveElement arrow
|
||||
) const
|
||||
{
|
||||
int x, y, w, h, x2, y2 ;
|
||||
rect.rect(&x, &y, &w, &h) ;
|
||||
|
||||
TQBitmap arrowBitmap ;
|
||||
switch (arrow) {
|
||||
case PE_ArrowUp: { arrowBitmap = uarrow ; break ; }
|
||||
case PE_ArrowDown: { arrowBitmap = darrow ; break ; }
|
||||
case PE_ArrowLeft: { arrowBitmap = larrow ; break ; }
|
||||
case PE_ArrowRight: { arrowBitmap = rarrow ; break ; }
|
||||
}
|
||||
|
||||
painter->drawPixmap(x+w/2-3, y+h/2-3, arrowBitmap);
|
||||
}
|
||||
|
||||
//--- New code:
|
||||
|
||||
void
|
||||
Phase2Style::drawCheckmark(
|
||||
TQPainter* p,
|
||||
TQRect r,
|
||||
int offset
|
||||
) const
|
||||
{
|
||||
p->save();
|
||||
p->setPen( p->pen().black );
|
||||
|
||||
if ( ! Checkmark.isNull() )
|
||||
//--- "Draw" the unicode checkmark character
|
||||
p->drawText( r, TQt::AlignCenter, Checkmark );
|
||||
|
||||
else {
|
||||
|
||||
//--- Draw a crude-looking checkmark
|
||||
|
||||
p->setPen( p->pen().SolidLine );
|
||||
|
||||
TQPen pen = p->pen();
|
||||
pen.setWidth( 2 );
|
||||
p->setPen( pen );
|
||||
|
||||
addOffset (&r, 2);
|
||||
|
||||
TQPoint center = r.center();
|
||||
if (r.height() < r.width())
|
||||
r.setWidth (r.height());
|
||||
if (r.width() % 2 != 0)
|
||||
r.setWidth (r.width() - 1);
|
||||
r.setHeight (r.width());
|
||||
|
||||
TQPointArray points (3);
|
||||
points.setPoint (0, r.topRight());
|
||||
points.setPoint (1, r.center().x(), r.bottom() - r.height()/7);
|
||||
points.setPoint (2, r.left() + r.width()/7, r.center().y());
|
||||
|
||||
p->drawPolyline (points);
|
||||
}
|
||||
|
||||
p->restore();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Image generation functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
TQPixmap *
|
||||
Phase2Style::Create_Arrow_Pix(
|
||||
TQ_PrimitiveElement shape,
|
||||
int size,
|
||||
int scaling
|
||||
) const
|
||||
{
|
||||
TQRect frame = TQRect(0, 0, size, size) ;
|
||||
TQPainter canvas ;
|
||||
TQPixmap * picture = new TQPixmap(size, size, 1) ;
|
||||
canvas.begin(picture) ;
|
||||
canvas.fillRect(frame, color0) ;
|
||||
drawArrow( &canvas, frame, shape, scaling ) ;
|
||||
canvas.end() ;
|
||||
|
||||
// TQImage image = picture->convertToImage() ;
|
||||
|
||||
// TQImage * image = new TQImage() ;
|
||||
// *image = picture->convertToImage() ;
|
||||
|
||||
return picture;
|
||||
}
|
||||
|
||||
TQImage *
|
||||
Phase2Style::Create_Arrow_Image(
|
||||
TQ_PrimitiveElement shape,
|
||||
int size,
|
||||
int scaling
|
||||
) const
|
||||
{
|
||||
TQPixmap * pixmap = Create_Arrow_Pix( shape, size, scaling) ;
|
||||
if (! pixmap ) return NULL ;
|
||||
TQImage * image = new TQImage() ;
|
||||
*image = pixmap->convertToImage() ;
|
||||
return image ;
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in new issue