1-增加部分功能图标
2-增加自定义组件样式.采用复用复合式 3-规范化命名部分文件
47
entry/src/main/ets/pages/CustomStyle/StyleButton.ets
Normal file
@ -0,0 +1,47 @@
|
||||
import { BtnEvent } from "../LayoutData/TitleInterface";
|
||||
|
||||
//单一功能按钮
|
||||
@ComponentV2
|
||||
export struct EventButton {
|
||||
@Param strIcon:string='';
|
||||
@Param strName:string='';
|
||||
build() {
|
||||
Column({ space: 0 }) {
|
||||
// 请将$r('app.media.loading')替换为实际资源文件
|
||||
Image($r('app.media.' + this.strIcon))
|
||||
.width(50)
|
||||
.height(40)
|
||||
.objectFit(ImageFit.Contain)
|
||||
Text(this.strName)
|
||||
.fontSize(12)
|
||||
.width(50)
|
||||
.height(10)
|
||||
.textAlign(TextAlign.Center)
|
||||
}
|
||||
.height('50')
|
||||
.width('50')
|
||||
.padding('1')
|
||||
}
|
||||
}
|
||||
|
||||
//菜单目录按钮
|
||||
//功能目录菜单,主要用于针对单一按钮多个功能形式
|
||||
@ComponentV2
|
||||
export struct EventBtnMenu {
|
||||
@Param btnMenus: Array<BtnEvent>=[];
|
||||
@Builder
|
||||
EventMenu(_btnMenus:Array<BtnEvent>){
|
||||
Menu() {
|
||||
ForEach(_btnMenus, (item: BtnEvent, index: number) => {
|
||||
MenuItem({ startIcon: $r('app.media.'+item.eIcon), content: item.eName })
|
||||
.width('150')
|
||||
.margin({ top: 0, left: 0, bottom: 0, right: 0
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
build() {
|
||||
EventButton({strIcon:this.btnMenus[0].eIcon,strName:this.btnMenus[0].eName}).bindMenu(this.EventMenu(this.btnMenus))
|
||||
}
|
||||
}
|
||||
|
||||
36
entry/src/main/ets/pages/CustomStyle/StyleMenu.ets
Normal file
@ -0,0 +1,36 @@
|
||||
import { BaseMenu } from "../LayoutData/TitleInterface";
|
||||
|
||||
//菜单按钮
|
||||
//主要用于功能组操作菜单.文件下拉菜单等.
|
||||
@ComponentV2
|
||||
export struct GroupTextEventMenu {
|
||||
@Param grpName:string =''
|
||||
@Param grpMenus: Array<BaseMenu>=[];
|
||||
@Builder
|
||||
GroupMenu(menus: Array<BaseMenu>) {
|
||||
ForEach(menus, (item: BaseMenu, index: number) => {
|
||||
MenuItem({ startIcon: $r('app.media.'+item.icon), content: item.str })
|
||||
.width('150')
|
||||
.margin({ top: 0, left: 0, bottom: 0, right: 0
|
||||
})
|
||||
})
|
||||
}
|
||||
build(){
|
||||
Row(){
|
||||
//功能组名文本
|
||||
Text(this.grpName)
|
||||
.fontSize(8)
|
||||
.fontColor(Color.Gray)
|
||||
Button('X')
|
||||
.fontColor(Color.Gray)
|
||||
.fontSize(8)
|
||||
.height(12)
|
||||
.width(8)
|
||||
.padding(1)
|
||||
.type(ButtonType.Normal)
|
||||
.bindMenu(this.GroupMenu(this.grpMenus))
|
||||
.backgroundColor(Color.Transparent)
|
||||
}.align(Alignment.BottomEnd)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
import { edgeColors } from '@kit.ArkUI';
|
||||
import {TitleTab} from './titleTab'
|
||||
import {TitleTab} from './TitleTab/TitleTab'
|
||||
import {LeftSideTab} from './leftSideTab'
|
||||
import {ModelViewTab} from './modelViewTab'
|
||||
const DOMAIN = 0x0000;
|
||||
|
||||
62
entry/src/main/ets/pages/LayoutData/TitleInterface.ets
Normal file
@ -0,0 +1,62 @@
|
||||
export enum Model{
|
||||
CAD,
|
||||
CAM,
|
||||
CAE,
|
||||
BASE
|
||||
};
|
||||
//Button和Event绑定
|
||||
export interface BtnEvent {
|
||||
eModel:Array<Model>
|
||||
eName:string
|
||||
eNamed:string
|
||||
eIcon:string
|
||||
eTips:string
|
||||
eEvent:string
|
||||
}
|
||||
//Menu
|
||||
export interface Menu{
|
||||
mName:string
|
||||
mIcon:string
|
||||
mTips:string
|
||||
mEvent:string
|
||||
}
|
||||
//功能组
|
||||
export interface GroupEvent{
|
||||
//功能组名字
|
||||
grpName:string;
|
||||
//按钮列表
|
||||
grpBtn:Array<BtnEvent|Array<BtnEvent>>
|
||||
//功能组菜单
|
||||
grpMenu:Array<BaseMenu>
|
||||
}
|
||||
export interface CAXModel{
|
||||
//模块名
|
||||
cmName:string
|
||||
//模块路由页面
|
||||
cmPage:string
|
||||
//模块提示
|
||||
cmTips:string
|
||||
//菜单列表
|
||||
cmBtnEvents:Array<BtnEvent>
|
||||
//模块布局数据
|
||||
//第一个Array为TabContent的行数
|
||||
//第二个Array为单行的按钮列表,该参数分为三种形态
|
||||
//BtnEvent单按钮
|
||||
//Array<GroupEvent>按钮组
|
||||
//Array<BtnEvent>菜单按钮
|
||||
cmEvents:Array<Array<BtnEvent|Array<GroupEvent>|Array<BtnEvent>>>
|
||||
}
|
||||
//Title配置
|
||||
export interface TitleConfig{
|
||||
//Title配置ID名(唯一)
|
||||
mId:string;
|
||||
//功能模块
|
||||
mModel:Array<CAXModel>
|
||||
}
|
||||
//菜单配置
|
||||
export interface BaseMenu{
|
||||
str:string
|
||||
icon:string
|
||||
tips:string
|
||||
event:string
|
||||
}
|
||||
77
entry/src/main/ets/pages/LayoutData/TitleLayoutData.ets
Normal file
@ -0,0 +1,77 @@
|
||||
import {
|
||||
BaseMenu,
|
||||
Model,
|
||||
TitleConfig ,
|
||||
CAXModel,
|
||||
GroupEvent,
|
||||
Menu,
|
||||
BtnEvent
|
||||
}from './TitleInterface'
|
||||
|
||||
export let GroupMenu:Array<BaseMenu>=[
|
||||
{str:'增功能',icon:'',tips:"",event:''},
|
||||
{str:'编辑组',icon:'',tips:"",event:''},
|
||||
{str:'改图标',icon:'',tips:"",event:''},
|
||||
{str:'重命名',icon:'',tips:"",event:''},
|
||||
{str:'移动到',icon:'',tips:"",event:''}
|
||||
]
|
||||
export let RowMenu:Array<BaseMenu>=[
|
||||
{str:'增加功能',icon:'',tips:"",event:''},
|
||||
{str:'编辑功能组',icon:'',tips:"",event:''},
|
||||
{str:'删除功能组',icon:'',tips:"",event:''},
|
||||
{str:'移动功能组',icon:'',tips:"",event:''}
|
||||
]
|
||||
export let TitleData:TitleConfig= {
|
||||
mId:"0",
|
||||
mModel:[
|
||||
//模块一
|
||||
{cmName:"文件",cmPage:"",cmTips:"",cmBtnEvents:[
|
||||
{eModel:[Model.BASE],eName:"新建",eNamed:"",eIcon:"base_new_file",eTips:"",eEvent:""},
|
||||
{eModel:[Model.BASE],eName:"打开",eNamed:"",eIcon:"base_open_file",eTips:"",eEvent:""},
|
||||
{eModel:[Model.BASE],eName:"保存",eNamed:"",eIcon:"base_save_file",eTips:"",eEvent:""},
|
||||
{eModel:[Model.BASE],eName:"关闭",eNamed:"",eIcon:"base_close_file",eTips:"",eEvent:""},
|
||||
{eModel:[Model.BASE],eName:"导入",eNamed:"",eIcon:"base_import_file",eTips:"",eEvent:""},
|
||||
{eModel:[Model.BASE],eName:"导出",eNamed:"",eIcon:"base_export_file",eTips:"",eEvent:""},
|
||||
{eModel:[Model.BASE],eName:"选项",eNamed:"",eIcon:"base_preferences",eTips:"",eEvent:""},
|
||||
{eModel:[Model.BASE],eName:"帮助",eNamed:"",eIcon:"base_help",eTips:"",eEvent:""},
|
||||
{eModel:[Model.BASE],eName:"退出",eNamed:"",eIcon:"base_exit",eTips:"",eEvent:""},
|
||||
],cmEvents:[]},
|
||||
//模块二
|
||||
{cmName:"主页",cmPage:"",cmTips:"",cmBtnEvents:[],cmEvents:
|
||||
//第一行
|
||||
[
|
||||
//数组表示非单个BtnEvent
|
||||
[
|
||||
//数组成员区别是GroupEvent还是BtnEvent
|
||||
[{grpName:'文件功能组',grpBtn:[
|
||||
{eModel:[Model.BASE],eName:"新建",eNamed:"",eIcon:"base_new_file",eTips:"",eEvent:""},
|
||||
{eModel:[Model.BASE],eName:"打开",eNamed:"",eIcon:"base_open_file",eTips:"",eEvent:""},
|
||||
[
|
||||
{eModel:[Model.BASE],eName:"保存",eNamed:"",eIcon:"base_save_file",eTips:"",eEvent:""},
|
||||
{eModel:[Model.BASE],eName:"另存为",eNamed:"",eIcon:"base_saveas_file",eTips:"",eEvent:""},
|
||||
{eModel:[Model.BASE],eName:"保存全部",eNamed:"",eIcon:"base_saveall_file",eTips:"",eEvent:""},
|
||||
] as Array<BtnEvent>,
|
||||
{eModel:[Model.BASE],eName:"关闭",eNamed:"",eIcon:"base_close_file",eTips:"",eEvent:""},
|
||||
{eModel:[Model.BASE],eName:"导入",eNamed:"",eIcon:"base_import_file",eTips:"",eEvent:""},
|
||||
{eModel:[Model.BASE],eName:"导出",eNamed:"",eIcon:"base_export_file",eTips:"",eEvent:""},
|
||||
{eModel:[Model.BASE],eName:"选项",eNamed:"",eIcon:"base_open_file",eTips:"",eEvent:""},
|
||||
{eModel:[Model.BASE],eName:"帮助",eNamed:"",eIcon:"base_help_file",eTips:"",eEvent:""},
|
||||
],grpMenu:RowMenu}] as Array<GroupEvent>
|
||||
]
|
||||
]},
|
||||
{cmName:"建模",cmPage:"",cmTips:"",cmBtnEvents:[],cmEvents:[]},
|
||||
{cmName:"曲线",cmPage:"",cmTips:"",cmBtnEvents:[],cmEvents:[]},
|
||||
{cmName:"曲面",cmPage:"",cmTips:"",cmBtnEvents:[],cmEvents:[]},
|
||||
{cmName:"装配",cmPage:"",cmTips:"",cmBtnEvents:[],cmEvents:[]},
|
||||
{cmName:"多边建模",cmPage:"",cmTips:"",cmBtnEvents:[],cmEvents:[]},
|
||||
{cmName:"分析",cmPage:"",cmTips:"",cmBtnEvents:[],cmEvents:[]},
|
||||
{cmName:"选择",cmPage:"",cmTips:"",cmBtnEvents:[],cmEvents:[]},
|
||||
{cmName:"显示",cmPage:"",cmTips:"",cmBtnEvents:[],cmEvents:[]},
|
||||
{cmName:"工具",cmPage:"",cmTips:"",cmBtnEvents:[],cmEvents:[]},
|
||||
{cmName:"应用模块",cmPage:"",cmTips:"",cmBtnEvents:[],cmEvents:[]},
|
||||
{cmName:"关于",cmPage:"",cmTips:"",cmBtnEvents:[],cmEvents:[]},
|
||||
{cmName:"调试",cmPage:"",cmTips:"",cmBtnEvents:[],cmEvents:[]}
|
||||
]
|
||||
}
|
||||
|
||||
export { TitleConfig, CAXModel }
|
||||
93
entry/src/main/ets/pages/TitleTab/TitleTab.ets
Normal file
@ -0,0 +1,93 @@
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
import { ArrayList } from '@kit.ArkTS';
|
||||
import { AddFormMenuItem } from '@ohos.arkui.advanced.FormMenu';
|
||||
import { SceneResourceType } from '@kit.ArkGraphics3D';
|
||||
|
||||
//导入布局模块
|
||||
import {TitleData,TitleConfig,CAXModel} from '../LayoutData/TitleLayoutData'
|
||||
import { BtnEvent } from '../LayoutData/TitleInterface'
|
||||
import {TitleTabContent} from './TitleTabContent'
|
||||
|
||||
@Component
|
||||
export struct TitleTab {
|
||||
//顶部导航组件
|
||||
private titleBarTabs: TabsController = new TabsController();
|
||||
//当前的顶部导航选择页
|
||||
@State titleBarFocusIndex: number = 1;
|
||||
@State titleBarDefaultFocusIndex: number = 1;
|
||||
@Builder
|
||||
FileMenu(menus: Array<BtnEvent>) {
|
||||
Menu() {
|
||||
ForEach(menus, (item: BtnEvent, index: number) => {
|
||||
MenuItem({ startIcon: $r('app.media.'+item.eIcon), content: item.eName })
|
||||
.width('150')
|
||||
.margin({
|
||||
top: 0,
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
right: 0
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Column }){
|
||||
Scroll() {
|
||||
Row() {
|
||||
ForEach(TitleData.mModel, (item: CAXModel, index: number) => {
|
||||
Row({ space: 1 }) {
|
||||
if(index>0){
|
||||
Button(item.cmName)
|
||||
.fontWeight(index === this.titleBarFocusIndex ? FontWeight.Bold : FontWeight.Normal)
|
||||
.height(25)
|
||||
.width(60)
|
||||
.padding(5)
|
||||
.type(ButtonType.Normal)
|
||||
.backgroundColor(Color.Brown)
|
||||
}else{
|
||||
Button(item.cmName)
|
||||
.fontWeight(index === this.titleBarFocusIndex ? FontWeight.Bold : FontWeight.Normal)
|
||||
.height(25)
|
||||
.width(60)
|
||||
.padding(5)
|
||||
.bindMenu(this.FileMenu(item.cmBtnEvents))
|
||||
.type(ButtonType.Normal)
|
||||
.backgroundColor(Color.Brown)
|
||||
}
|
||||
|
||||
}.onClick(() => {
|
||||
if(index!=0){
|
||||
this.titleBarTabs.changeIndex(index);
|
||||
this.titleBarFocusIndex = index;
|
||||
}else{
|
||||
this.titleBarTabs.changeIndex(this.titleBarDefaultFocusIndex);
|
||||
this.titleBarFocusIndex = this.titleBarDefaultFocusIndex;
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
.align(Alignment.Start)
|
||||
.scrollable(ScrollDirection.Horizontal)
|
||||
.scrollBar(BarState.Off)
|
||||
.margin({ top: 2,left:2,bottom:2,right:2})
|
||||
.width('100%')
|
||||
Tabs({barPosition: BarPosition.Start, index: this.titleBarDefaultFocusIndex,controller: this.titleBarTabs}){
|
||||
ForEach(TitleData.mModel,(item:CAXModel, index: number)=>{
|
||||
TabContent() {
|
||||
if(item.cmBtnEvents.length==0){
|
||||
TitleTabContent({tabLayout:item.cmEvents})
|
||||
}
|
||||
}.align(Alignment.Start)
|
||||
.padding(1)
|
||||
.margin({ top: 0,left:0,bottom:2,right:0})
|
||||
})
|
||||
}.scrollable(false)
|
||||
.barHeight(0)
|
||||
.margin({ top: 0,left:0,bottom:0,right:0})
|
||||
.height('auto')
|
||||
.barMode(BarMode.Fixed)
|
||||
}.borderWidth('1')
|
||||
.height('auto')
|
||||
}
|
||||
}
|
||||
65
entry/src/main/ets/pages/TitleTab/TitleTabContent.ets
Normal file
@ -0,0 +1,65 @@
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
import { BaseMenu, BtnEvent, GroupEvent } from '../LayoutData/TitleInterface';
|
||||
import {GroupTextEventMenu} from '../CustomStyle/StyleMenu'
|
||||
import {EventButton,EventBtnMenu} from '../CustomStyle/StyleButton'
|
||||
|
||||
|
||||
@ComponentV2
|
||||
export struct TitleTabContent {
|
||||
@Param tabLayout:Array<Array<BtnEvent|Array<GroupEvent>|Array<BtnEvent>>>=[];
|
||||
build() {
|
||||
//垂直布局展示多行
|
||||
Column({ space: 0 }) {
|
||||
//迭代生成行容器
|
||||
ForEach(this.tabLayout, (row_items: Array<BtnEvent|Array<GroupEvent>|Array<BtnEvent>>, index: number) => {
|
||||
//行的按钮组容器
|
||||
Row(){
|
||||
ForEach(row_items, (row_item: BtnEvent|Array<GroupEvent>|Array<BtnEvent>, index: number) => {
|
||||
//首先判断是否为数组.如果不为数组者为BtnEvent
|
||||
if(!Array.isArray(row_item)){
|
||||
//单按钮
|
||||
EventButton({strIcon:row_item.eIcon,strName:row_item.eName})
|
||||
}else if(row_item instanceof Array<GroupEvent>){
|
||||
//功能组,迭代多个功能组
|
||||
ForEach(row_item, (group_item: GroupEvent, index: number) =>{
|
||||
Column({ space: 2 }){
|
||||
Row({ space: 1 }){
|
||||
ForEach(group_item.grpBtn, (btn_item: BtnEvent|Array<BtnEvent>, index: number) =>{
|
||||
//如果是数组则为菜单按钮否则为单功能按钮
|
||||
if(Array.isArray(btn_item)){
|
||||
EventBtnMenu({btnMenus:btn_item})
|
||||
}else{
|
||||
EventButton({strIcon:btn_item.eIcon,strName:btn_item.eName})
|
||||
}
|
||||
})
|
||||
}.margin({ top: 1,left:1,bottom:1,right:1})
|
||||
//功能组名
|
||||
GroupTextEventMenu({grpName:group_item.grpName,grpMenus:group_item.grpMenu})
|
||||
}.borderWidth(1)
|
||||
.borderColor(Color.Grey)
|
||||
})
|
||||
}else{
|
||||
//菜单按钮
|
||||
Column(){
|
||||
Button((row_item as Array<BtnEvent>)[0].eName)
|
||||
.height('95%')
|
||||
.width('50')
|
||||
.padding('1')
|
||||
.type(ButtonType.Normal)
|
||||
Button()
|
||||
.height('5%')
|
||||
.width('50')
|
||||
.padding('1')
|
||||
.type(ButtonType.Normal)
|
||||
//.bindMenu(this.BtnMenu((row_item as Array<BtnEvent>)))
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
.align(Alignment.BottomEnd)
|
||||
.borderColor(Color.Gray)
|
||||
})
|
||||
}.margin({ top: 1,left:1,bottom:1,right:1})
|
||||
}
|
||||
}
|
||||
@ -1,162 +0,0 @@
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
|
||||
export class ToolButton{
|
||||
//功能
|
||||
str:string='';
|
||||
//图标
|
||||
icon:string='';
|
||||
//按钮提示
|
||||
tips:string='';
|
||||
//事件
|
||||
event:string='';
|
||||
}
|
||||
|
||||
export class RowBtn{
|
||||
str:string=''
|
||||
btnGroup:Array<ToolButton|Array<ToolButton>>=new Array<ToolButton|Array<ToolButton>>
|
||||
}
|
||||
|
||||
class XMenu{
|
||||
str:string=''
|
||||
icon:string=''
|
||||
event:string=''
|
||||
}
|
||||
|
||||
let groupMenu:Array<XMenu>=[
|
||||
{str:'增功能',icon:'',event:''},
|
||||
{str:'编辑组',icon:'',event:''},
|
||||
{str:'改图标',icon:'',event:''},
|
||||
{str:'重命名',icon:'',event:''},
|
||||
{str:'移动到->',icon:'',event:''}
|
||||
]
|
||||
let rowMenu:Array<XMenu>=[
|
||||
{str:'增加功能组',icon:'',event:''},
|
||||
{str:'编辑功能组',icon:'',event:''},
|
||||
{str:'修改功能组',icon:'',event:''},
|
||||
{str:'命名功能组',icon:'',event:''},
|
||||
{str:'移动功能组',icon:'',event:''}
|
||||
]
|
||||
@ComponentV2
|
||||
export struct RowBtnTab {
|
||||
@Param rowsBtn: Array<Array<RowBtn>> = new Array<Array<RowBtn>>;
|
||||
@Param rightBtn: Array<ToolButton | Array<ToolButton>> = new Array<ToolButton | Array<ToolButton>>;
|
||||
@Builder
|
||||
ToolsMenu(menus: Array<ToolButton>) {
|
||||
Menu() {
|
||||
ForEach(menus, (item: ToolButton, index: number) => {
|
||||
MenuItem({ startIcon: $r('app.media.startIcon'), content: item.str })
|
||||
.width('150')
|
||||
.margin({
|
||||
top: 0,
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
right: 0
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
@Builder
|
||||
TButton(strIcon: string, strName: string) {
|
||||
Column() {
|
||||
// 请将$r('app.media.loading')替换为实际资源文件
|
||||
Image($r('app.media.startIcon'))
|
||||
.width(50)
|
||||
.height(40)
|
||||
.objectFit(ImageFit.Contain)
|
||||
Text(strName)
|
||||
.fontSize(12)
|
||||
.width(50)
|
||||
.height(10)
|
||||
.textAlign(TextAlign.Center)
|
||||
}
|
||||
.height('50')
|
||||
.width('50')
|
||||
.padding('1')
|
||||
}
|
||||
@Builder
|
||||
XMenu(menus: Array<XMenu>) {
|
||||
Menu() {
|
||||
ForEach(menus, (item: ToolButton, index: number) => {
|
||||
MenuItem({ startIcon: $r('app.media.startIcon'), content: item.str })
|
||||
.width('150')
|
||||
.margin({
|
||||
top: 0,
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
right: 0
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
build() {
|
||||
//垂直布局展示多行
|
||||
Column({ space: 0 }) {
|
||||
//迭代生成行容器
|
||||
ForEach(this.rowsBtn, (rowBtn: Array<Array<RowBtn>>, index: number) => {
|
||||
//行的按钮组容器
|
||||
Row(){
|
||||
ForEach(rowBtn, (rowGroup: RowBtn, index: number) => {
|
||||
Row(){
|
||||
Column({ space: 5 }) {
|
||||
//Group的按钮组
|
||||
Column({ space: 1 }) {
|
||||
//每个Group和非Group的横向布局
|
||||
Row() {
|
||||
ForEach(rowGroup.btnGroup, (btn: ToolButton | Array<ToolButton>, index: number) => {
|
||||
if (Array.isArray(btn)) {
|
||||
if ((btn as Array<ToolButton>).length > 0) {
|
||||
Button((btn as Array<ToolButton>)[0].str)
|
||||
.bindMenu(this.ToolsMenu((btn as Array<ToolButton>)))
|
||||
.height('50')
|
||||
.width('50')
|
||||
.padding('1')
|
||||
.type(ButtonType.Normal)
|
||||
}
|
||||
} else {
|
||||
this.TButton((btn as ToolButton).icon, (btn as ToolButton).str);
|
||||
}
|
||||
})
|
||||
}.margin({ top: 2, left: 2, bottom: 0, right: 2})
|
||||
Row() {
|
||||
Text(rowGroup.str)
|
||||
.fontSize(8)
|
||||
.fontColor(Color.Gray)
|
||||
Button('X')
|
||||
.fontColor(Color.Gray)
|
||||
.fontSize(8)
|
||||
.height(12)
|
||||
.width(8)
|
||||
.padding(1)
|
||||
.type(ButtonType.Normal)
|
||||
.bindMenu(this.XMenu(groupMenu))
|
||||
.align(Alignment.BottomEnd)
|
||||
.backgroundColor(Color.Transparent)
|
||||
}
|
||||
}.margin({ top: 1,left:1,bottom:1,right:1})
|
||||
}
|
||||
}.margin({ top: 1,left:1,bottom:1,right:1})
|
||||
.borderWidth('1')
|
||||
.borderRadius(5)
|
||||
.borderColor(Color.Gray)
|
||||
})
|
||||
//设置尾部的按钮
|
||||
Row(){
|
||||
Button('X')
|
||||
.fontColor(Color.Gray)
|
||||
.fontSize(8)
|
||||
.width(8)
|
||||
.height(70)
|
||||
.padding(1)
|
||||
.type(ButtonType.Normal)
|
||||
.align(Alignment.BottomEnd)
|
||||
.bindMenu(this.XMenu(rowMenu))
|
||||
.backgroundColor(Color.Transparent)
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.align(Alignment.BottomEnd)
|
||||
.borderColor(Color.Gray)
|
||||
})
|
||||
}.margin({ top: 1,left:1,bottom:5,right:1})
|
||||
}
|
||||
}
|
||||
@ -1,152 +0,0 @@
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
import { ArrayList } from '@kit.ArkTS';
|
||||
import { AddFormMenuItem } from '@ohos.arkui.advanced.FormMenu';
|
||||
import {ToolButton,RowBtnTab,RowBtn}from './rowBtnTab'
|
||||
import { SceneResourceType } from '@kit.ArkGraphics3D';
|
||||
|
||||
const DOMAIN = 0x0000;
|
||||
|
||||
|
||||
class TitleTabName {
|
||||
//标题
|
||||
str: string='';
|
||||
//图标名
|
||||
icon: string='';
|
||||
//页面名
|
||||
page:string='';
|
||||
//提示
|
||||
tips:string='';
|
||||
//Content的内容
|
||||
rowsBtn:Array<Array<RowBtn>>=new Array<Array<RowBtn>>;
|
||||
}
|
||||
|
||||
//测试数据
|
||||
let testPagInfo:Array<TitleTabName>=[
|
||||
//第一个tab
|
||||
{str:'文件',icon:'',page:'',tips:'',rowsBtn:[]},
|
||||
//第二个tab
|
||||
{str:'主页',icon:'',page:'',tips:'',rowsBtn:[
|
||||
[//第一行按钮
|
||||
{ str:'1行功能组-A',btnGroup:[
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
[
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
],
|
||||
],
|
||||
},
|
||||
{ str:'1行功能组-B',btnGroup:[
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
[
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
],
|
||||
]}
|
||||
],
|
||||
[//第二行按钮
|
||||
{ str:'二行功能组-A',btnGroup:[
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
[
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
],
|
||||
],
|
||||
},
|
||||
{ str:'测试',btnGroup:[
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
[
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
{str:'测试',icon:'',tips:'',event:''} as ToolButton,
|
||||
],
|
||||
]}
|
||||
]
|
||||
]
|
||||
},
|
||||
{str:'曲线',icon:'',page:'',tips:'',rowsBtn:[]},
|
||||
{str:'曲面',icon:'',page:'',tips:'',rowsBtn:[]},
|
||||
{str:'装配',icon:'',page:'',tips:'',rowsBtn:[]},
|
||||
{str:'多边形建模',icon:'',page:'',tips:'',rowsBtn:[]},
|
||||
{str:'分析',icon:'',page:'',tips:'',rowsBtn:[]},
|
||||
{str:'选择',icon:'',page:'',tips:'',rowsBtn:[]},
|
||||
{str:'显示',icon:'',page:'',tips:'',rowsBtn:[]},
|
||||
{str:'工具',icon:'',page:'',tips:'',rowsBtn:[]},
|
||||
{str:'应用模块',icon:'',page:'',tips:'',rowsBtn:[]},
|
||||
]
|
||||
|
||||
@Component
|
||||
export struct TitleTab {
|
||||
titleBarTabsName:Array<TitleTabName>=new Array<TitleTabName>;
|
||||
//顶部导航组件
|
||||
private titleBarTabs: TabsController = new TabsController();
|
||||
//当前的顶部导航选择页
|
||||
@State titleBarFocusIndex: number = 0;
|
||||
@State titleBarDefaultFocusIndex: number = 1;
|
||||
LoadData(): void {
|
||||
this.titleBarTabsName=testPagInfo;
|
||||
}
|
||||
aboutToAppear() {
|
||||
this.LoadData();
|
||||
}
|
||||
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Column }){
|
||||
Scroll() {
|
||||
Row() {
|
||||
ForEach(this.titleBarTabsName, (item: TitleTabName, index: number) => {
|
||||
Row({ space: 1 }) {
|
||||
Button(item.str)
|
||||
.fontWeight(index === this.titleBarFocusIndex ? FontWeight.Bold : FontWeight.Normal)
|
||||
.height(25)
|
||||
.width(60)
|
||||
.padding(5)
|
||||
.type(ButtonType.Normal)
|
||||
}.onClick(() => {
|
||||
if(index!=0){
|
||||
this.titleBarTabs.changeIndex(index);
|
||||
this.titleBarFocusIndex = index;
|
||||
}else{
|
||||
this.titleBarTabs.changeIndex(this.titleBarDefaultFocusIndex);
|
||||
this.titleBarFocusIndex = this.titleBarDefaultFocusIndex;
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
.align(Alignment.Start)
|
||||
.scrollable(ScrollDirection.Horizontal)
|
||||
.scrollBar(BarState.Off)
|
||||
.margin({ top: 2,left:2,bottom:2,right:2})
|
||||
.width('100%')
|
||||
Tabs({barPosition: BarPosition.Start, index: this.titleBarDefaultFocusIndex,controller: this.titleBarTabs}){
|
||||
ForEach(this.titleBarTabsName,(item:TitleTabName, index: number)=>{
|
||||
TabContent() {
|
||||
RowBtnTab({rowsBtn:item.rowsBtn})
|
||||
}.align(Alignment.Start)
|
||||
.padding(1)
|
||||
.margin({ top: 0,left:0,bottom:2,right:0})
|
||||
})
|
||||
}.scrollable(false)
|
||||
.barHeight(0)
|
||||
.margin({ top: 0,left:0,bottom:0,right:0})
|
||||
.height('auto')
|
||||
.barMode(BarMode.Fixed)
|
||||
}.borderWidth('1')
|
||||
.height('auto')
|
||||
}
|
||||
}
|
||||
BIN
entry/src/main/resources/base/media/base_app_exit.bmp
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
entry/src/main/resources/base/media/base_close_file.bmp
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
entry/src/main/resources/base/media/base_export_file.bmp
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
entry/src/main/resources/base/media/base_help_file.bmp
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
entry/src/main/resources/base/media/base_import_export_file.bmp
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
entry/src/main/resources/base/media/base_import_file.bmp
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
entry/src/main/resources/base/media/base_new_file.bmp
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
entry/src/main/resources/base/media/base_open_file.bmp
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
entry/src/main/resources/base/media/base_save_file.bmp
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
entry/src/main/resources/base/media/base_saveall_file.bmp
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
entry/src/main/resources/base/media/base_saveas_file.bmp
Normal file
|
After Width: | Height: | Size: 64 KiB |