원문: http://reality.sgi.com/mjk/tips/mui/mui.html
PDF : http://www.cs.csustan.edu/~rsc/SDSU/MUI.User.Guide.pdf
Mooeee!
음메에!
By Steve Baker
The Micro User Interface (MUI) was written by Tom Davis (SGI) and comes as a part of the GLUT (OpenGL Utilities Toolkit) release 3.6. MUI's major drawback is that it is completely undocumented. The significance of MUI is that it is written entirely on top of GLUT and OpenGL - and as such should port cleanly across a wide range of UNIX, Mac, VMS and PC operating systems and be completely window-system independant.
마이크로 유저 인터페이스(MUI:The Micro User Interface)는 Tom Davis(SGI)가 만들었고 GLUT(OpenGL Utilities Toolkit) release 3.6 의 일부분이 되었습니다. 다만 MUI의 문제점은 완전히 문서화가 이루어지지 않았다는것 입니다. 중요한것은 MUI가 순수하게 GLUT와 OpenGL로 구현되어서 유닉스, 맥킨토시, VMS 그리고 PC 오퍼레이팅 시스템같이 폭넓은 범위로 완전한 포팅이 가능하게 하고, 독립적인 윈도우 시스템이라는것입니다.
To the user, MUI has a look-and-feel similar to X-Motif. All functions use the usual SGI naming conventions with a 'mui' prefix. The API is strongly object-oriented - but uses a C syntax. Here is a snap shot of a simple MUI program:
MUI는 사용자에게 X-Motif와 비슷한 모양새와 느낌을 줄것입니다. 그리고 MUI의 모든 함수들은 흔하게 사용되는 SGI의 이름 명명법을 따라 'mui'를 접두어로 사용합니다. API는 무척이나 객체 지향적입니다만, C문법을 사용합니다. 여기에 간단한 MUI 프로그램의 모습이 있습니다.
NB: There appears to be a widely used GUI for the Amiga that is also called MUI - I'm pretty sure it's unrelated to this library.
NB: 아미가(amiga)에서 널리 사용되는 GUI같이 보이는 것은 MUI라 불리는것입니다. - 그것이 이 라이브러리와는 관계 없는것을 확신합니다..
This document is an attempt to make MUI at least partially useful. Since I have built this description solely upon the two available demo programs and from the library source code, I could easily be hopelessly wrong. There will certainly be significant errors and omissions since I'm writing it as I learn to use MUI myself.
이 문서는 MUI가 조금이나마 유용하게 사용되기를 바라는 마음에서 쓰여졌습니다. 그리고 혼자서 두개의 데모프로그램과 라이브러리 소스코드를 바탕으로 이 설명들을 써냈습니다. 따라서 절망적인 문제점도 있을 수 있습니다. 필자도 이 글을 MUI를 배우는 입장에서 썼기때문에 중요한 문제점과 누락된 것이 분명히 있을것입니다.
Hopefully this documentation will only be a stop-gap measure until something official appears in some future GLUT/MUI release.
다만, 이 문서가 나중에 발표될 GLUT/MUI의 공식적인 문서가 공개되기 전까지 부족함을 메울 수 있기를 바랄 뿐입니다.
MUI comprises a bunch of header files (currently in the "include/mui" directory within the GLUT release), plus a single library file ('libmui.a' under UNIX, 'mui.lib' under Windoze).
MUI는 한 무더기의 헤더파일을 포함하고 있습니다. (현재 공개된 GLUT내의 "include/mui" 디렉토리에 있습니다.) 하나의 라이브러리 파일도 있습니다. (유닉스의 'libmui.a'와 윈도우의 'mui.lib')
A simple MUI program must start off by doing all the usual GLUT initialisations - for example:
간단한 MUI 프로그램이라도 흔한 GLUT 초기화를 하며 시작합니다. 다음의 에를 보세요:
#include <stdio.h>
#include <stdlib.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <mui/mui.h>
int main ( int argc, char **argv )
{
glutInitWindowSize ( 640, 480 ) ;
glutInit ( &argc, argv ) ;
glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ) ;
glutCreateWindow ( "My Application" ) ;
The next step is to construct all the MUI objects that comprise your user interface - I'll cover that in the next section (below).
다음단계로 당신의 사용자 인터페이스가 갖고 있는 MUI의 모든 객체들을 생성해야 합니다. 아래의 섹션에서 보충할 것입니다.
Finally, you should call 'muiInit()' and enter the GLUT main loop:
마지막으로 'muiInit()'을 호출하고 GLUT의 메인루프로 진입합니다:
muiInit () ;
glutMainLoop () ;
return 0 ;
}
This routine is where MUI takes over most (if not all) of the GLUT callbacks:
이 루틴은 GLUT의 콜백함수들을 대부분(전부는 아니고)을 가로챕니다.
glutKeyboardFunc
glutMouseFunc
glutReshapeFunc
glutMotionFunc
glutPassiveMotionFunc
glutDisplayFunc
glutMenuStateFunc
This is unfortunate since it pretty much prevents you from catching any of these events yourself.
이는 유감스럽게도 당신이 이 이벤트들을 가로채가는 것을 막기위해서입니다.
Before you start adding widgets, you have to create a User Interface List.
구성요소들을 추가하기 전에, 사용자 인터페이스 리스트를 만들어야 합니다.
Example:
예를 들면:
muiNewUIList ( 1 ) ;
Every widget you add goes into that UI List.
모든 구성요소들은 이 사용자 인터페이스 리스트에 추가될것입니다.
You can manage multiple UI lists using these calls:
다음 함수들로 여러개의 사용자 인터페이스 리스트를 관리할 수 있습니다:
void muiNewUIList ( int listid ) ; void muiAddToUIList ( int listid, muiObject *obj ) ; void muiSetActiveUIList ( int listid ) ; int muiGetActiveUIList () ;
Clearly (since there are no routines to remove an object from a UIList, or to delete an entire UIList), it is intended that MUI user interfaces are somewhat static in nature.
명확히 MUI 사용자 인터페이스는 어느정도 자연스럽게 정적으로 의도되었습니다. (사용자 인터페이스 리스트에서 객체를 제거하거나 리스트 전체를 지우는 루틴이 없기 때문입니다.)
MUI menu bars are built from a bunch of GLUT popup menus which are then bound to a MUI object.
MUI 메뉴바는 후에 MUI객체에 엮이게 되는 GLUT의 팝업메뉴로부터 만들어 집니다.
Example:
예를들면:
int menus_for_menubar [ 3 ] ; /* Build three GLUT popups... */ /* 3개의 GLUT 팝업메뉴를 생성... */ menus_for_menubar [ 0 ] = glutCreateMenu ( menu_cb ) ; glutAddMenuEntry ( "New" , MENU_FILE_NEW ) ; glutAddMenuEntry ( "Open..." , MENU_FILE_OPEN ) ; glutAddMenuEntry ( "Save" , MENU_FILE_SAVE ) ; glutAddMenuEntry ( "SaveAs...", MENU_FILE_SAVEAS ) ; glutAddMenuEntry ( "Exit" , MENU_FILE_EXIT ) ; menus_for_menubar [ 1 ] = glutCreateMenu ( menu_cb ) ; glutAddMenuEntry ( "Cut" , MENU_EDIT_CUT ) ; glutAddMenuEntry ( "Copy" , MENU_EDIT_COPY ) ; glutAddMenuEntry ( "Paste" , MENU_EDIT_PASTE ) ; menus_for_menubar [ 2 ] = glutCreateMenu ( menu_cb ) ; glutAddMenuEntry ( "About..." , MENU_HELP_ABOUT ) ; glutAddMenuEntry ( "Help" , MENU_HELP_HELP ) ;
In this case, all the MENU_* constants would be #defined somewhere and the 'menu_cb' function would probably just be a big switch statement that performs the appropriate actions as each menu item is invoked. All of this is covered in the GLUT documentation.
이 경우에 모든 MENU_* 상수들은 어디에선가 #define로 선언되었고, 'menu_cb'함수는 각각 선택된 메뉴 아이템에 따른 적합한 작동을 하는 그냥 커다란 스위치 명령들의 뭉치들로 만들어져 있는것입니다. 이에 대한 설명은 GLUT문서에서 자세히 설명하고 있습니다.
Next, you have to attach the GLUT menus to a menu bar:
다음에 GLUT 메뉴를 메뉴바에 첨부시켜야 합니다:
muiObject *menubar = muiNewPulldown () ; muiAddPulldownEntry ( menubar, "File", menus_for_menubar[0], 0 ) ; muiAddPulldownEntry ( menubar, "Edit", menus_for_menubar[1], 0 ) ; muiAddPulldownEntry ( menubar, "Help", menus_for_menubar[2], 1 ) ;
The final argument to 'muiAddPulldownEntry' is a boolean which is TRUE for the 'HELP' menu (which is always on the extreme right of the menu bar in traditional GUI's) - and FALSE for all the other entries which are simply packed onto the bar from left to right.
'muiAddPulldownEntry'의 마지막 인자는 TRUE 일때는 'HELP'메뉴(전통적인 GUI에서 메뉴바에서 항상 제일 오른쪽에 위치하는), 그리고 FALSE 일때는 단순히 왼쪽에서 오른쪽으로 쌓여지는 요소라는것을 의미하는 불린 값입니다.
Here is the menu bar API in full:
완전한 메뉴바의 API 함수형태:
muiObject *muiNewPulldown () ;
void muiAddPulldownEntry ( muiObject *obj, char *title,
int glut_menu, int is_help ) ;
NB. There seems to be a bug in MUI - if the GLUT window is ever resized - the menu bar can get hidden - or positioned somewhere in the middle of the window instead of at the very top where it belongs.
NB. MUI에 GLUT윈도의 크기가 바뀌었을때, 메뉴바가 보이지 않게 되거나, 윈도의 최상단에 있는것이 아니라 중간부분에 위치하게 되는, 버그로 보이는것이 있습니다.
There are three different styles of button:
버튼에는 세가지 스타일이 있습니다:
Button (with text inside). Radio Button (with text alongside). Tiny Radio Button (also with text alongside). First, construct the button using one of these three constructor functions:
버튼(내부에 글자가 있는) 라디오 버튼(옆쪽에 글자가 있는) 작은 라디오 버튼(옆쪽에 글자가 있는) 우선, 다음의 세가지 생성함수들중 하나로 버튼을 생성합니다.
muiObject *muiNewButton ( int xmin, int xmax,
int ymin, int ymax ) ;
muiObject *muiNewRadioButton ( int xmin, int ymin ) ;
muiObject *muiNewTinyRadioButton ( int xmin, int ymin ) ;
If a label is needed for the button:
만약 버튼에 라벨이 필요하면 이 함수를 사용하세요:
void muiLoadButton ( muiObject *button, char *label ) ;
'Radio' buttons are often used when pressing one button of a group causes any depressed buttons in that same group to turn off automatically. TO make this behaviour, you need to link all the buttons of a particular group together:
'라디오' 버튼은 하나의 버튼을 누름으로서, 같은 그룹내의 다른 버튼들이 자동적으로 선택이 해제하도록 할때 사용합니다. 이러한 행동을 하게 만들기 위해서는 다음 함수로 버튼들을 일부 그룹에 함께 연결시켜야 합니다.
void muiLinkButtons ( muiObject *obj1, muiObject *obj2 ) ;
Example: 예를들면:
muiObject *m1 = muiNewRadioButton ( 100, 100 ) ; muiObject *m2 = muiNewRadioButton ( 100, 120 ) ; muiObject *m3 = muiNewRadioButton ( 100, 140 ) ; muiLinkButtons ( m1, m2 ) ; muiLinkButtons ( m2, m3 ) ;
Sometimes you need to turn off all the buttons in a group: 어쩔때는 버튼을 그룹에서 해제해야 할 필요도 있을것입니다:
void muiClearRadio ( muiObject *button ) ;
Text labels can be placed anywhere in the window using either one of the following two commands:
텍스트 라벨은 다음의 두개의 함수중 하나를 사용하여 윈도의 어디에나 위치할 수 있습니다.
muiObject *muiNewLabel ( int xmin, int ymin, char *label ) ; muiObject *muiNewBoldLabel ( int xmin, int ymin, char *label ) ;
The two calls are identical except that the second generates a label in bold-faced text. You can change the string in the label after creation using this:
두개의 함수는 두번째 함수가 라벨의 텍스트를 굵은 형태로 만들어내는것을 제외하고는 동일합니다. 이미 생성된 택스트 라벨의 문자열을 바꾸는것은 다음 함수를 사용함으로서 가능합니다:
void muiChangeLabel ( muiObject *obj, char *label ) ;
This is actually a text entry box. Here is the API:
이것은 실제로 텍스트 엔트리 박스입니다. API는 다음과 같습니다:
muiObject *muiNewTextbox ( int xmin, int xmax, int ymin); char *muiGetTBString ( muiObject *obj ) ; void muiClearTBString ( muiObject *obj ) ; void muiSetTBString ( muiObject *obj, char *s ) ;
The textbox allows the user to enter text which can be queried using muiGetTBString(), cleared using muiClearTBString() or preset using muiSetTBString().
텍스트박스에서는 사용자가 텍스트를 입력한것을 muiGetTBString()을 이용해 가져오는것이 가능하고, muiClearTBString()으로 내용을 지우거나 muiSetTBString으로 미리 설정하는것도 가능합니다.
Sorry - I havn't documented these yet.
죄송합니다 - 아직 문서화 하지 않았습니다.
muiObject *muiNewTextList (int xmin, int ymin,
int xmax, int listheight ) ;
void muiSetTLTop ( muiObject *obj, float p ) ;
int muiGetTLSelectedItem ( muiObject *obj ) ;
void muiSetTLStrings ( muiObject *obj, char **s ) ;
void muiSetTLTopInt ( muiObject *obj, int top ) ;
Sorry - I havn't documented these yet.
죄송합니다 - 아직 문서화 하지 않았습니다.
muiObject *muiNewVSlider ( int xmin, int ymin,
int ymax, int scenter, int shalf);
muiObject *muiNewHSlider ( int xmin, int ymin,
int xmax, int scenter, int shalf);
float muiGetVSVal ( muiObject *obj ) ;
float muiGetHSVal ( muiObject *obj ) ;
void muiSetVSValue ( muiObject *obj, float val ) ;
void muiSetHSValue ( muiObject *obj, float val ) ;
void muiSetVSArrowDelta ( muiObject *obj, int newd ) ;
void muiSetHSArrowDelta ( muiObject *obj, int newd ) ;
All muiObjects share a collection of useful API.
모든 muiObject는 유용한 API들의 뭉치들을 공동으로 사용할 수 있습니다.
MUI objects can be visible (ie displayed) or invisible (hidden), active (ie clickable) or inactive ('greyed out') and can be enabled or disabled (for a button, this means depressed or not depressed, for a text box, the cursor is on or off, etc).
MUI 객체들은 눈에 보이거나(visible, displayed), 가려질(invisible, hidden) 수 있고, 활성화(active, clickable)되거나 비활성화(inactive, 'greyed out')될 수 있고, 또한 작동시키거나 작동정지(버튼으로서는 눌려지고, 텍스트박스와 커서는 켜지거나 꺼지는것과 같은것을 의미합니다.)시킬 수 있습니다.
void muiSetVisible ( muiObject *obj, int state ) ; void muiSetActive ( muiObject *obj, int state ) ; void muiSetEnable ( muiObject *obj, int state ) ; int muiGetVisible ( muiObject *obj ) ; int muiGetActive ( muiObject *obj ) ; int muiGetEnable ( muiObject *obj ) ;
All MUI objects has a single integer (called the 'ID') which can contain arbitary user data.
모든 MUI객체들은 임의의 사용자 데이터를 포함할 수 있는 하나의 정수('ID'라고 불리는)를 갖고 있습니다.
void muiSetID ( muiObject *obj, int id ) ; int muiGetID ( muiObject *obj ) ;
You can query the bounding box of a MUI object. (Note the order of the arguments - which is different from the routines to create objects of a given size!)
MUI객체가 고정되어 있는 상자를 얻어 올 수 있습니다. (주어진 크기에 따라서 객체를 만드는것과는 다른 인자들의 순서를 주목하세요.)
void muiGetObjectSize(muiObject *obj, int *xmin, int *ymin, int *xmax, int *ymax);
Each object can have a callback function associated with it that is called under various user imput conditions:
각각의 객체들은 다양한 사용자 입력 상태에 따라 호출되는, 콜백함수를 가질 수 있습니다.
void muiSetCallback ( muiObject *obj,
void (*cb)(muiObject *, enum muiReturnValue) ) ;
enum muiReturnValue
{
MUI_NO_ACTION,
MUI_SLIDER_MOVE,
MUI_SLIDER_RETURN,
MUI_SLIDER_SCROLLDOWN,
MUI_SLIDER_SCROLLUP,
MUI_SLIDER_THUMB,
MUI_BUTTON_PRESS,
MUI_TEXTBOX_RETURN,
MUI_TEXTLIST_RETURN,
MUI_TEXTLIST_RETURN_CONFIRM
};
The user callback function is passed the address of the muiObject that was clicked and also a parameter indicating how the object was activated.
사용자 콜백 함수는 클릭된 muiOjbect와 그외의 객체가 어떻게 활성화 되었는지 알려주는지 나타내는 매개변수를 얻습니다.
The following function allows the application to register a callback that is invoked whenever the mouse is clicked and no MUI widget is present at that screen location.
다음의 함수는 응용프로그램이 마우스가 클릭되었고, 그 위치에 MUI의 요소들이 없을때 호출되는 함수를 등록하는것을 가능하게 합니다.
void muiSetNonMUIcallback ( void (*cb)(int, int) ) ;
The routine is called with the (x,y) coordinate of the mouse at the time.
이 루틴은 그 당시 마우스의 (x, y)좌표와 함께 호출됩니다.
| 제일 위로 |
| 최종 수정 일시: 10월 27일(2001년) 02:07 PM 편집 | 정보 | 차이 | 비슷한 페이지 DebugInfo |
| 유용한 페이지들: 분류 분류 | 자유로운 연습장 SandBox | 무작위 페이지들 RandomPages | 인기있는 페이지들 MostPopular |