mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-27 08:37:58 +03:00
Very minor improvements to the table header column icon.
This commit is contained in:
+18
-13
@@ -4,7 +4,6 @@
|
||||
--back: #31363b;
|
||||
--font: #eff0f1;
|
||||
--font-hint: #898b8d;
|
||||
--menu-font-disabled: #6e7275;
|
||||
--button-back: #30353a;
|
||||
--button-border: #6b6f73;
|
||||
--button-radius: 2dp;
|
||||
@@ -25,18 +24,19 @@
|
||||
--tab-line: #616569;
|
||||
--tab-active: #31363b;
|
||||
--tab-hover: #334e5e;
|
||||
--tab-close: #909396;
|
||||
--tab-close-hover: #863d47;
|
||||
--icon: #b6bbc2;
|
||||
--icon-active: white;
|
||||
--icon-back-hover: #eff0f1;
|
||||
--icon-line-hover: #3d4246;
|
||||
--icon-back-alert: #e49aa2;
|
||||
--menu-back: #2d3136;
|
||||
--menu-font: #eff0f1;
|
||||
--menu-border: #616569;
|
||||
--menu-font-active: white;
|
||||
--icon-back-hover: #eff0f1;
|
||||
--icon-line-hover: #3d4246;
|
||||
--icon-back-alert: #e49aa2;
|
||||
--menu-font-disabled: #6e7275;
|
||||
--win-icon: #dbdbdd;
|
||||
--tab-close: #909396;
|
||||
--tab-close-hover: #863d47;
|
||||
}
|
||||
|
||||
CheckBox,
|
||||
@@ -168,7 +168,7 @@ Table {
|
||||
ListBox::item {
|
||||
padding-left: 4dp;
|
||||
background-color: transparent;
|
||||
background-image: linear-gradient( to right, #232629, #383a3d ), linear-gradient( to right, #383a3d, #232629 );
|
||||
background-image: linear-gradient( to right, var(--list-back), var(--separator) ), linear-gradient( to right, var(--separator), var(--list-back) );
|
||||
background-size: 50% 1dp, 50% 1dp;
|
||||
background-position: left bottom, right bottom;
|
||||
}
|
||||
@@ -652,10 +652,6 @@ Menu::SubMenu:disabled > Menu::SubMenu::text {
|
||||
color: var(--menu-font-disabled);
|
||||
}
|
||||
|
||||
Menu::SubMenu::arrow {
|
||||
margin-right: 1dp;
|
||||
}
|
||||
|
||||
Menu::Item:hover > Menu::Item::text,
|
||||
Menu::CheckBox:hover > Menu::Item::text,
|
||||
Menu::RadioButton:hover > Menu::Item::text,
|
||||
@@ -678,6 +674,7 @@ Menu::Separator {
|
||||
Menu::SubMenu::Arrow {
|
||||
width: 16dp;
|
||||
height: 16dp;
|
||||
margin-right: 1dp;
|
||||
foreground-image: poly(line, var(--icon), "5dp 3dp, 10dp 8dp"), poly(line, var(--icon), "5dp 13dp, 10dp 8dp");
|
||||
}
|
||||
|
||||
@@ -786,8 +783,16 @@ TableView > ScrollBar {
|
||||
background-color: var(--list-back);
|
||||
}
|
||||
|
||||
table::header::column::arrow {
|
||||
margin-left: 2dp;
|
||||
table::header::column::arrow-up {
|
||||
width: 16dp;
|
||||
height: 12dp;
|
||||
foreground-image: poly(line, var(--icon), "1dp 4dp, 5dp 7dp"), poly(line, var(--icon), "5dp 7dp, 9dp 4dp");
|
||||
}
|
||||
|
||||
table::header::column::arrow-down {
|
||||
width: 16dp;
|
||||
height: 12dp;
|
||||
foreground-image: poly(line, var(--icon), "1dp 7dp, 5dp 4dp"), poly(line, var(--icon), "5dp 4dp, 9dp 7dp");
|
||||
}
|
||||
|
||||
.appbackground {
|
||||
|
||||
@@ -72,6 +72,12 @@ class EE_API UIAbstractTableView : public UIAbstractView {
|
||||
|
||||
void setIconSize( const size_t& iconSize );
|
||||
|
||||
const size_t& getSortIconSize() const;
|
||||
|
||||
void setSortIconSize( const size_t& sortIconSize );
|
||||
|
||||
void setColumnsVisible( const std::vector<size_t> columns );
|
||||
|
||||
protected:
|
||||
friend class EE::UI::UITableHeaderColumn;
|
||||
|
||||
@@ -88,7 +94,8 @@ class EE_API UIAbstractTableView : public UIAbstractView {
|
||||
mutable std::vector<std::map<int, UIWidget*>> mWidgets;
|
||||
UILinearLayout* mHeader;
|
||||
Float mDragBorderDistance{8};
|
||||
size_t mIconSize{16};
|
||||
size_t mIconSize{12};
|
||||
size_t mSortIconSize{16};
|
||||
bool mAutoExpandOnSingleColumn{false};
|
||||
|
||||
virtual ~UIAbstractTableView();
|
||||
|
||||
@@ -36,6 +36,10 @@ class EE_API UITableHeaderColumn : public UIPushButton {
|
||||
Uint32 onMouseDoubleClick( const Vector2i& position, const Uint32& flags );
|
||||
|
||||
Uint32 onDragStop( const Vector2i& pos, const Uint32& flags );
|
||||
|
||||
Sizef updateLayout();
|
||||
|
||||
virtual void updateSortIconPosition();
|
||||
};
|
||||
|
||||
}} // namespace EE::UI
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.12.2, 2020-08-10T01:42:08. -->
|
||||
<!-- Written by QtCreator 4.12.2, 2020-08-16T20:36:39. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
@@ -89,7 +89,7 @@
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{6d057187-158a-4883-8d5b-d470a6b6b025}</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">10</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">19</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">15</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">../../make/linux</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <eepp/ui/abstract/uiabstracttableview.hpp>
|
||||
#include <eepp/ui/uiimage.hpp>
|
||||
#include <eepp/ui/uilinearlayout.hpp>
|
||||
#include <eepp/ui/uinodedrawable.hpp>
|
||||
#include <eepp/ui/uipushbutton.hpp>
|
||||
#include <eepp/ui/uiscenenode.hpp>
|
||||
#include <eepp/ui/uiscrollbar.hpp>
|
||||
@@ -10,7 +11,8 @@ namespace EE { namespace UI { namespace Abstract {
|
||||
UIAbstractTableView::UIAbstractTableView( const std::string& tag ) :
|
||||
UIAbstractView( tag ),
|
||||
mDragBorderDistance( PixelDensity::dpToPx( 4 ) ),
|
||||
mIconSize( PixelDensity::dpToPxI( 12 ) ) {
|
||||
mIconSize( PixelDensity::dpToPxI( 12 ) ),
|
||||
mSortIconSize( PixelDensity::dpToPxI( 20 ) ) {
|
||||
mHeader = UILinearLayout::NewWithTag( "table::header", UIOrientation::Horizontal );
|
||||
mHeader->setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::Fixed );
|
||||
mHeader->setParent( this );
|
||||
@@ -267,6 +269,16 @@ void UIAbstractTableView::setColumnsHidden( const std::vector<size_t> columns, b
|
||||
createOrUpdateColumns();
|
||||
}
|
||||
|
||||
void UIAbstractTableView::setColumnsVisible( const std::vector<size_t> columns ) {
|
||||
if ( !getModel() )
|
||||
return;
|
||||
for ( size_t i = 0; i < getModel()->columnCount(); i++ )
|
||||
columnData( i).visible = false;
|
||||
for ( auto col : columns )
|
||||
columnData( col ).visible = true;
|
||||
createOrUpdateColumns();
|
||||
}
|
||||
|
||||
UITableRow* UIAbstractTableView::createRow() {
|
||||
mUISceneNode->invalidateStyle( this );
|
||||
mUISceneNode->invalidateStyleState( this, true );
|
||||
@@ -395,6 +407,14 @@ void UIAbstractTableView::setIconSize( const size_t& iconSize ) {
|
||||
mIconSize = iconSize;
|
||||
}
|
||||
|
||||
const size_t& UIAbstractTableView::getSortIconSize() const {
|
||||
return mSortIconSize;
|
||||
}
|
||||
|
||||
void UIAbstractTableView::setSortIconSize( const size_t& sortIconSize ) {
|
||||
mSortIconSize = sortIconSize;
|
||||
}
|
||||
|
||||
void UIAbstractTableView::onOpenModelIndex( const ModelIndex& index ) {
|
||||
ModelEvent event( getModel(), index, this );
|
||||
sendEvent( &event );
|
||||
@@ -413,11 +433,17 @@ void UIAbstractTableView::onSortColumn( const size_t& colIndex ) {
|
||||
}
|
||||
SortOrder sortOrder = model->sortOrder() == SortOrder::Ascending ? SortOrder::Descending
|
||||
: SortOrder::Ascending;
|
||||
Drawable* icon = mUISceneNode->findIconDrawable(
|
||||
sortOrder == SortOrder::Ascending ? "arrow-down" : "arrow-up", mIconSize );
|
||||
UIImage* image = columnData( colIndex ).widget->getExtraInnerWidget()->asType<UIImage>();
|
||||
if ( image && icon )
|
||||
image->setDrawable( icon );
|
||||
UIPushButton* button = columnData( colIndex ).widget;
|
||||
UIImage* image = button->getExtraInnerWidget()->asType<UIImage>();
|
||||
std::string tag = button->getElementTag() + "::arrow";
|
||||
image->setElementTag( sortOrder == SortOrder::Ascending ? tag + "-up" : tag + "-down" );
|
||||
image->reloadStyle();
|
||||
if ( image && image->getForeground() == nullptr ) {
|
||||
Drawable* icon = mUISceneNode->findIconDrawable(
|
||||
sortOrder == SortOrder::Ascending ? "arrow-down" : "arrow-up", mSortIconSize );
|
||||
if ( icon )
|
||||
image->setDrawable( icon );
|
||||
}
|
||||
model->setKeyColumnAndSortOrder( colIndex, sortOrder );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,10 +180,8 @@ Variant FileSystemModel::data( const ModelIndex& index, Model::Role role ) const
|
||||
|
||||
auto& node = this->nodeRef( index );
|
||||
|
||||
if ( role == Role::Custom ) {
|
||||
eeASSERT( index.column() == Column::Name );
|
||||
if ( role == Role::Custom )
|
||||
return Variant( node.info().getFilepath().c_str() );
|
||||
}
|
||||
|
||||
if ( role == Role::Sort ) {
|
||||
switch ( index.column() ) {
|
||||
|
||||
+14
-11
@@ -1,6 +1,7 @@
|
||||
#include <eepp/graphics/drawable.hpp>
|
||||
#include <eepp/graphics/drawablesearcher.hpp>
|
||||
#include <eepp/graphics/sprite.hpp>
|
||||
#include <eepp/ui/css/drawableimageparser.hpp>
|
||||
#include <eepp/ui/css/propertydefinition.hpp>
|
||||
#include <eepp/ui/uiicon.hpp>
|
||||
#include <eepp/ui/uiimage.hpp>
|
||||
@@ -240,18 +241,20 @@ bool UIImage::applyProperty( const StyleSheetProperty& attribute ) {
|
||||
switch ( attribute.getPropertyDefinition()->getPropertyId() ) {
|
||||
case PropertyId::Src: {
|
||||
std::string path( attribute.getValue() );
|
||||
bool ownIt;
|
||||
Drawable* createdDrawable =
|
||||
CSS::StyleSheetSpecification::instance()->getDrawableImageParser().createDrawable(
|
||||
path, mSize, ownIt, this );
|
||||
if ( createdDrawable ) {
|
||||
setDrawable( createdDrawable, ownIt );
|
||||
} else {
|
||||
Drawable* res = NULL;
|
||||
if ( NULL != ( res = DrawableSearcher::searchByName( path ) ) ) {
|
||||
if ( res->getDrawableType() == Drawable::SPRITE )
|
||||
mDrawableOwner = true;
|
||||
|
||||
FunctionString func( FunctionString::parse( path ) );
|
||||
if ( !func.getParameters().empty() && func.getName() == "url" ) {
|
||||
path = func.getParameters().at( 0 );
|
||||
}
|
||||
|
||||
Drawable* res = NULL;
|
||||
if ( NULL != ( res = DrawableSearcher::searchByName( path ) ) ) {
|
||||
if ( res->getDrawableType() == Drawable::SPRITE )
|
||||
mDrawableOwner = true;
|
||||
|
||||
setDrawable( res );
|
||||
setDrawable( res );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ Sizef UIPushButton::updateLayout() {
|
||||
size = packLayout( {mIcon, mTextBox, getExtraInnerWidget()}, autoPadding );
|
||||
break;
|
||||
}
|
||||
return size;
|
||||
return size.ceil();
|
||||
}
|
||||
|
||||
void UIPushButton::onPaddingChange() {
|
||||
|
||||
@@ -10,10 +10,9 @@ UITableHeaderColumn::UITableHeaderColumn( UIAbstractTableView* view, const size_
|
||||
mInnerWidgetOrientation = InnerWidgetOrientation::Right;
|
||||
auto cb = [&]( const Event* ) { updateLayout(); };
|
||||
mImage = UIImage::NewWithTag( mTag + "::arrow" );
|
||||
mImage->setScaleType( UIScaleType::FitInside )
|
||||
->setLayoutSizePolicy( SizePolicy::WrapContent, SizePolicy::WrapContent )
|
||||
mImage->setLayoutSizePolicy( SizePolicy::WrapContent, SizePolicy::WrapContent )
|
||||
->setFlags( UI_VALIGN_CENTER | UI_HALIGN_CENTER )
|
||||
->setParent( const_cast<UITableHeaderColumn*>( this ) );
|
||||
->setParent( this );
|
||||
mImage->setEnabled( false );
|
||||
mImage->addEventListener( Event::OnPaddingChange, cb );
|
||||
mImage->addEventListener( Event::OnMarginChange, cb );
|
||||
@@ -41,6 +40,19 @@ Uint32 UITableHeaderColumn::onCalculateDrag( const Vector2f& position, const Uin
|
||||
return 1;
|
||||
}
|
||||
|
||||
Sizef UITableHeaderColumn::updateLayout() {
|
||||
Sizef res = UIPushButton::updateLayout();
|
||||
updateSortIconPosition();
|
||||
return res;
|
||||
}
|
||||
|
||||
void UITableHeaderColumn::updateSortIconPosition() {
|
||||
mImage->setPixelsPosition( getPixelsSize().getWidth() - mImage->getPixelsSize().getWidth() -
|
||||
mImage->getLayoutPixelsMargin().Right,
|
||||
0 );
|
||||
mImage->centerVertical();
|
||||
}
|
||||
|
||||
Uint32 UITableHeaderColumn::onMouseDown( const Vector2i& position, const Uint32& flags ) {
|
||||
Vector2f localPos( convertToNodeSpace( position.asFloat() ) );
|
||||
if ( NULL != getEventDispatcher() && !getEventDispatcher()->isNodeDragging() &&
|
||||
|
||||
@@ -164,8 +164,8 @@ EE_MAIN_FUNC int main( int argc, char* argv[] ) {
|
||||
addIcon( "tree-expanded", 0xea50 );
|
||||
addIcon( "tree-contracted", 0xea54 );
|
||||
addIcon( "file", 0xecc3 );
|
||||
addIcon( "arrow-up", 0xea77 );
|
||||
addIcon( "arrow-down", 0xea4d );
|
||||
//addIcon( "arrow-up", 0xea78 );
|
||||
//addIcon( "arrow-down", 0xea4e );
|
||||
UISceneNode* uiSceneNode = UISceneNode::New();
|
||||
SceneManager::instance()->add( uiSceneNode );
|
||||
uiSceneNode->getUIThemeManager()->setDefaultFont( font );
|
||||
|
||||
@@ -790,6 +790,7 @@ void App::showFindView() {
|
||||
mSearchBarLayout->setEnabled( true )->setVisible( true );
|
||||
|
||||
UITextInput* findInput = mSearchBarLayout->find<UITextInput>( "search_find" );
|
||||
findInput->getDocument().selectAll();
|
||||
findInput->setFocus();
|
||||
|
||||
const TextDocument& doc = editor->getDocument();
|
||||
|
||||
Reference in New Issue
Block a user