UI库的设计问题 [英] Design question for UI library

查看:64
本文介绍了UI库的设计问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在用C ++编写一个小型用户界面库(我知道它已经完成了b / b
,但它很好用于学习)。


无论如何,我需要一些软件设计的帮助/建议

架构。我面临的问题是控件可以有很多状态......例如,按钮可以有各种形状

(圆形,方形,其他一些)自定义几何)。此外,它可能是

位图,纹理,仅文本,带位图的文本等等。所以,你得到了

图片。为这些中的每一个设置一个专门的Button类将很难维护。


所以,我对你的专家的问题是你如何组织一个小部件图书馆

就是这样。我建议您考虑哪些设计模式?

任何建议都会受到赞赏。


谢谢和欢呼!


xargy

Hi everyone,

I am writing a small user interface library in C++ (I know it has been
done to death, but it is good for learning ).

Anyways, I need some help/advice with the deisgn of the software
architecture. The problem I am facing is that a control can have so
many states... For example, a button could be have various shapes
(rounded, square, some other custom geometry). Also, it could be
bitmapped, textured, text only, text with bitmap etc. So, you get the
picture. Having a specialized Button class for each of these would be
very difficult to maintain.

So, my question to you gurus is how would you organize a widget library
like that. What design patterns would you recommend that I look into?
Any advice would be appreciated.

Thanks and cheers!

xargy

推荐答案

2005年12月9日13:20:04 -0800," xargon" < PA ******** @ excite.com>写道:
On 9 Dec 2005 13:20:04 -0800, "xargon" <pa********@excite.com> wrote:
大家好,

我正在用C ++编写一个小型用户界面库(我知道它已经完成了死亡,但是这对学习很有帮助。

无论如何,我需要一些软件
架构的帮助/建议。我面临的问题是控件可以有很多状态......例如,一个按钮可以有各种形状
(圆角,方形,其他一些自定义几何)。此外,它可能是位图,纹理,仅文本,带位图的文本等。所以,你得到了
图片。对于每一个都有一个专门的Button类很难维护。

所以,我向你问到的问题是你如何组织一个像这样的小部件库。我建议您考虑哪些设计模式?
任何建议都将受到赞赏。

谢谢和欢呼!

xargy
Hi everyone,

I am writing a small user interface library in C++ (I know it has been
done to death, but it is good for learning ).

Anyways, I need some help/advice with the deisgn of the software
architecture. The problem I am facing is that a control can have so
many states... For example, a button could be have various shapes
(rounded, square, some other custom geometry). Also, it could be
bitmapped, textured, text only, text with bitmap etc. So, you get the
picture. Having a specialized Button class for each of these would be
very difficult to maintain.

So, my question to you gurus is how would you organize a widget library
like that. What design patterns would you recommend that I look into?
Any advice would be appreciated.

Thanks and cheers!

xargy




不要制作具有不同属性的单独类按钮。对于不同/事物/使用

不同的类。如果你想能够在b / b
之间选择一个圆形按钮和一个方形按钮,

将这个选项作为类接口中的属性公开。



Don''t make separate classes buttons with different properties. Use
different classes for different /things/. If you want to be able to
choose between a rounded button and a square button for example,
expose this choice as a property in the class interface.


xargon写道:
大家好,

我正在用C ++编写一个小型用户界面库(我知道它已经<完成死亡,但这对学习有好处。

无论如何,我需要一些帮助/建议来设计软件。我面临的问题是控件可以有很多状态......例如,一个按钮可以有各种形状
(圆角,方形,其他一些自定义几何)。此外,它可能是位图,纹理,仅文本,带位图的文本等。所以,你得到了
图片。对于每一个都有一个专门的Button类很难维护。

所以,我向你问到的问题是你如何组织一个像这样的小部件库。我建议您考虑哪些设计模式?
任何建议都将受到赞赏。

谢谢和欢呼!

xargy
Hi everyone,

I am writing a small user interface library in C++ (I know it has been
done to death, but it is good for learning ).

Anyways, I need some help/advice with the deisgn of the software
architecture. The problem I am facing is that a control can have so
many states... For example, a button could be have various shapes
(rounded, square, some other custom geometry). Also, it could be
bitmapped, textured, text only, text with bitmap etc. So, you get the
picture. Having a specialized Button class for each of these would be
very difficult to maintain.

So, my question to you gurus is how would you organize a widget library
like that. What design patterns would you recommend that I look into?
Any advice would be appreciated.

Thanks and cheers!

xargy




这篇帖子在这里是偏离主题的,因为它不涉及C ++ *语言*

本身(参见FAQ:
http://www.parashift.com/c++ -faq点燃.... HTML#帮助-5.9)。试试

comp.software.patterns或comp.object。


干杯! --M



This post is off-topic here, as it does not concern the C++ *language*
proper (see the FAQ:
http://www.parashift.com/c++-faq-lit....html#faq-5.9). Try in
comp.software.patterns or comp.object.

Cheers! --M




W Marsh写道:

W Marsh wrote:
2005年12月9日13:20: 04 -0800,xargon < PA ******** @ excite.com>写道:
On 9 Dec 2005 13:20:04 -0800, "xargon" <pa********@excite.com> wrote:
大家好,

我正在用C ++编写一个小型用户界面库(我知道它已经完成了死亡,但是这对学习很有帮助。

无论如何,我需要一些软件
架构的帮助/建议。我面临的问题是控件可以有很多状态......例如,一个按钮可以有各种形状
(圆角,方形,其他一些自定义几何)。此外,它可能是位图,纹理,仅文本,带位图的文本等。所以,你得到了
图片。对于每一个都有一个专门的Button类很难维护。

所以,我向你问到的问题是你如何组织一个像这样的小部件库。我建议您考虑哪些设计模式?
任何建议都将受到赞赏。

谢谢和欢呼!

xargy
Hi everyone,

I am writing a small user interface library in C++ (I know it has been
done to death, but it is good for learning ).

Anyways, I need some help/advice with the deisgn of the software
architecture. The problem I am facing is that a control can have so
many states... For example, a button could be have various shapes
(rounded, square, some other custom geometry). Also, it could be
bitmapped, textured, text only, text with bitmap etc. So, you get the
picture. Having a specialized Button class for each of these would be
very difficult to maintain.

So, my question to you gurus is how would you organize a widget library
like that. What design patterns would you recommend that I look into?
Any advice would be appreciated.

Thanks and cheers!

xargy



不要制作具有不同属性的单独类按钮。对不同的/事物/使用不同的类。如果您希望能够在圆形按钮和方形按钮之间进行选择,
将此选项作为类接口中的属性公开。



Don''t make separate classes buttons with different properties. Use
different classes for different /things/. If you want to be able to
choose between a rounded button and a square button for example,
expose this choice as a property in the class interface.




OT:这只是一种方法,但它真的不是设计

模式或OO方式。


干杯! --M



OT: That''s just one way to do it, but it''s really not the design
patterns or OO way.

Cheers! --M


这篇关于UI库的设计问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆