CN103246505B - The creation method and device of a kind of window title bar - Google Patents
The creation method and device of a kind of window title bar Download PDFInfo
- Publication number
- CN103246505B CN103246505B CN201210031587.3A CN201210031587A CN103246505B CN 103246505 B CN103246505 B CN 103246505B CN 201210031587 A CN201210031587 A CN 201210031587A CN 103246505 B CN103246505 B CN 103246505B
- Authority
- CN
- China
- Prior art keywords
- view
- current form
- title bar
- window title
- sub
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- User Interface Of Digital Computer (AREA)
Abstract
The present invention is applied to IOS technical field, there is provided the creation method and device of a kind of window title bar, methods described include:A self-defined view is added in the top level view of forms;Using the self-defined view as window title bar covering forms header area.The present invention can meet the displaying of forms title in the self-defined and Dock and Expos é of window title bar under MAC simultaneously.
Description
Technical field
The invention belongs to a kind of wound of window title bar under IOS technical field, more particularly to IOS
Construction method and device.
Background technology
Forms in apple MAC operation system or ios operating systems are broadly divided into two classes, band title bar forms and without
Title bar forms.Forms with title bar use the look & feel that system pre-defines, and interface form is difficult to change.Without mark
Although inscribe column forms can with self-defined, its forms minimize to application program dock (Dock) when show it is entitled answer
With the title of program rather than the title of forms;And shown in the forms show tools (Expos é) of Apple Macintosh operating system
When, its forms title shows it is empty.
In summary, two kinds of forms in existing MAC operation system can not meet can self-defined window title bar, again
This demand of forms title can be shown in Dock and Expos é.
The content of the invention
It is an object of the invention to provide a kind of creation method of window title bar, to solve in existing MAC operation system
Forms can not meet simultaneously self-defined window title bar and in Dock and Expos é show forms title the problem of.
The present invention is achieved in that a kind of creation method of window title bar, and methods described includes:
A self-defined view is added in the top level view of forms;
Using the self-defined view as window title bar covering forms header area.
Another object of the present invention is to provide a kind of creating device of window title bar, described device includes:
View adding device, for adding a self-defined view in the top level view of forms;
View capping unit, for covering forms header area using the self-defined view as window title bar.
It can be seen from the above technical proposal that it is of the invention by adding a customized view in top level view, and will
The self-defined view is as window title bar covering forms header area, so that the view has self-defined property and common forms
Operating characteristic, forms title remains to normally show when minimizing in Dock and Expos é.
Brief description of the drawings
Fig. 1 is the implementation process figure for the window title bar creation method that the embodiment of the present invention one provides;
Fig. 2 is the exemplary plot of the form view level that the embodiment of the present invention one provides and layout;
Fig. 3 is the exemplary plot that the window title bar that the embodiment of the present invention one provides creates;
Fig. 4 is the implementation process figure for the window title bar creation method that the embodiment of the present invention two provides;
Fig. 5 is the composition structure chart for the window title bar creating device that the embodiment of the present invention three provides.
Embodiment
In order to make the purpose , technical scheme and advantage of the present invention be clearer, it is right below in conjunction with drawings and Examples
The present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, and
It is not used in the restriction present invention.
In order to illustrate technical solutions according to the invention, illustrated below by specific embodiment.
Embodiment one:
Fig. 1 shows the implementation process for the window title bar creation method that the embodiment of the present invention one provides, this method process
Details are as follows:
In step S101, a self-defined view is added in the top level view of forms;
Specifically, obtaining father's view (superView) object ViewP of user area view (contentView), apple is constructed
A view type in fruit operating system, such as NSView types, and construct the NSView types and derive from class object ViewS,
Sub- view using the derivation class object ViewS as father's view object ViewP, and by calling addition in ViewP to regard
Figure interface is (by addSubview in the sub- view interface:positioned:relativeTo:Method positioned parameter
It is arranged to NSWindowBelow) ViewS is arranged to ViewP bottom view.It is it should be noted that described
ContentView superView is the top level view of forms, and the sub- view is self-defined view.
In the present embodiment, the top level view refers to that superView is empty view, is a NSThemeFrame
The view of type.Wherein, NSThemeFrame types are view type in Apple Macintosh operating system (NSView) derived types, are
ContentView superView, while be also the top level view of forms.
In step s 102, forms header area is covered using the self-defined view as window title bar.
Specifically, a form types in construction Apple Macintosh operating system, such as NSWindow types, by this
The notification function of NSWindow types (NSWindowDidResizeNotification, touches when the size of forms changes
Hair) monitoring the big minor change of current form trigger action, when monitoring that current form size changes, by the ViewS
The upper left corner of current form, and the width by the width adjustment of the ViewS for current form are placed in, by described in
ContentView height is adjusted to the height of the ViewS, realizes the covering of forms header area.
In the present embodiment, by contentView and system button are all the sub- views of top level view (such as Fig. 2 institutes
Show), the title bar of forms is drawn in NSThemeFrame view areas.As long as made by oneself so adding one in top level view
The view of justice, window title bar (as shown in Figure 3) is made with the customized view covering forms Title area, then should
View just has self-defined property and the operating characteristic of common forms, and forms title remains to just when minimizing in Dock and Expos é
Often display.
Embodiment two:
Fig. 4 shows the implementation process for the window title bar creation method that the embodiment of the present invention two provides, and the present embodiment exists
Step S403 is added on the basis of embodiment one:
In step S403, window title bar background is drawn according to the state of current form.
Specifically, a form types in construction Apple Macintosh operating system, such as NSWindow types, by this
The notification function of NSWindow types (NSWindowDidBecomeMainNotification, touches when forms become activated state
Hair) and NSWindowDidResignMainNotification, the trigger event when forms become inactive state) monitoring is currently
The trigger action of forms Status Change, when monitoring that current form state changes, carried from the gradient color prestored
Gradient color corresponding with current form state is taken, NSGradient is generated (in Apple Macintosh operating system according to the gradient color of extraction
Type, the gradual change for view are drawn) object, and call the drawInRect in NSGradient objects:angle:Method
(method of NSGradient objects, for drawing the gradual change of designated area and angle) drafting window title bar background (such as paint
The title bar of system style is made).It should be noted that the gradual change under forms different conditions is previously stored with system library
Color, wherein the gradient color can store into constant.
In the present embodiment, the state includes but are not limited to activated state or inactive state.
The present embodiment can repaint title bar background during window title bar is customized, with anti-in time
Reflect the change of forms state.
Embodiment three:
Fig. 5 shows the composition structure for the window title bar creating device that the embodiment of the present invention three provides, for the ease of saying
It is bright, it illustrate only the part related to the embodiment of the present invention.
The window title bar creating device can be operate in software unit, hardware cell or soft in each application system
The unit that hardware is combined, it can also be integrated into as independent suspension member in each application system.
The window title bar creating device includes view adding device 51 and view capping unit 52.Wherein, each unit
Concrete function it is as follows:
View adding device 51, for adding a self-defined view in the top level view of forms;Specifically for obtaining
Father's view object of user area view, and construct a NSView type and derive from class object, using the derivation class object as father
The sub- view of view object, and by calling the sub- view interface of addition in father's view object to be arranged to the derivation class object
The bottom view of father's view object.
View capping unit 52, for covering forms header area using the self-defined view as window title bar;Specifically
For monitoring the trigger action of the big minor change of current form by NSWindow notification function, current form size is being monitored
During the trigger action of change, the sub- view is placed in the upper left corner of current form, and be by the width adjustment of the sub- view
The width of current form, the height of the user area view is adjusted to the height of the sub- view.
Further, described device also includes background drawing unit, for drawing forms mark according to the state of current form
Column background is inscribed, the state includes activation or inactive state,;Monitored specifically for the notification function by NSWindow current
The trigger action of forms Status Change, when monitoring the trigger action of current form Status Change, from the gradual change prestored
Gradient color corresponding with current form state is extracted in color, NSGradient objects are generated according to the gradient color of extraction, and call
DrawInRect in NSGradient objects:angle:Method draws window title bar background.
The window title bar creating device that the present embodiment provides can be used in foregoing corresponding window title bar establishment side
In method, details will not be repeated here referring to the associated description of above-mentioned window title bar creation method embodiment one and two.
One of ordinary skill in the art will appreciate that it is that the unit included by embodiment three is according to function logic
Divided, but be not limited to above-mentioned division, as long as corresponding function can be realized;In addition, each functional unit
Specific name also only to facilitate mutually distinguish, the protection domain being not intended to limit the invention.
In summary, the embodiment of the present invention is and self-defined by this by adding a customized view in top level view
View is as window title bar covering forms header area, so that the view has the operation of self-defined property and common forms special
Property, forms title remains to normally show when minimizing in Dock and Expos é.Moreover, in the customized process of window title bar
In, it can repaint title bar background, to reflect the change of forms state in time.In addition, the embodiment of the present invention realizes letter
Single, ease for use is good, has stronger practical value.
Those of ordinary skill in the art are further appreciated that all or part of step realized in above-described embodiment method is can
To instruct the hardware of correlation to complete by program, described program can be stored in a computer read/write memory medium
In, described storage medium, including ROM/RAM, disk, CD etc..
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention
All any modification, equivalent and improvement made within refreshing and principle etc., should be included in the scope of the protection.
Claims (8)
1. a kind of creation method of window title bar, it is characterised in that methods described includes:
A self-defined view is added in the top level view of forms;
Using the self-defined view as window title bar covering forms header area;
One self-defined view of addition in the top level view of forms specifically includes:
Father's view object of user area view is obtained, and constructs a NSView type and derives from class object, by the derived class pair
As the sub- view as father's view object, and by calling the sub- view interface of addition in father's view object by the derived class pair
Bottom view as being arranged to father's view object.
2. the method as described in claim 1, it is characterised in that described to be covered the self-defined view as window title bar
Forms header area specifically includes:
The trigger action of the big minor change of current form is monitored by NSWindow notification function, is monitoring current form size
During the trigger action of change, the sub- view is placed in the upper left corner of current form, and be by the width adjustment of the sub- view
The width of current form, the height of the user area view is adjusted to the height of the sub- view.
3. the method as described in claim 1, it is characterised in that methods described also includes:
Window title bar background is drawn according to the state of current form, the state includes activated state or inactive state.
4. method as claimed in claim 3, it is characterised in that described that the window title bar back of the body is drawn according to the state of current form
Scape specifically includes:
The trigger action of current form Status Change is monitored by NSWindow notification function, is monitoring current form state
During the trigger action of change, gradient color corresponding with current form state is extracted from the gradient color prestored, according to extraction
Gradient color generation NSGradient objects, and call the drawInRect in NSGradient objects:angle:Method is drawn
Window title bar background.
5. a kind of creating device of window title bar, it is characterised in that described device includes:
View adding device, for adding a self-defined view in the top level view of forms;
View capping unit, for covering forms header area using the self-defined view as window title bar;
The view adding device, father's view object specifically for obtaining user area view, and construct a NSView type
Class object is derived from, the sub- view using the derivation class object as father's view object, and by calling adding in father's view object
Add sub- view interface that the derivation class object is arranged to the bottom view of father's view object.
6. device as claimed in claim 5, it is characterised in that the view capping unit, specifically for passing through NSWindow
Notification function monitoring the big minor change of current form trigger action, monitoring the trigger action of the big minor change of current form
When, the sub- view is placed in the upper left corner of current form, and by the width that the width adjustment of the sub- view is current form,
The height of the user area view is adjusted to the height of the sub- view.
7. device as claimed in claim 5, it is characterised in that described device also includes:
Background drawing unit, for according to the state of current form draw window title bar background, the state include activation or
The inactive state of person.
8. device as claimed in claim 7, it is characterised in that the background drawing unit, specifically for passing through NSWindow
Notification function monitoring current form Status Change trigger action, monitoring the trigger action of current form Status Change
When, gradient color corresponding with current form state is extracted from the gradient color prestored, is generated according to the gradient color of extraction
NSGradient objects, and call the drawInRect in NSGradient objects:angle:Method draws the window title bar back of the body
Scape.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210031587.3A CN103246505B (en) | 2012-02-13 | 2012-02-13 | The creation method and device of a kind of window title bar |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210031587.3A CN103246505B (en) | 2012-02-13 | 2012-02-13 | The creation method and device of a kind of window title bar |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103246505A CN103246505A (en) | 2013-08-14 |
CN103246505B true CN103246505B (en) | 2017-11-10 |
Family
ID=48926040
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210031587.3A Active CN103246505B (en) | 2012-02-13 | 2012-02-13 | The creation method and device of a kind of window title bar |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103246505B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106970746B (en) * | 2017-03-31 | 2020-02-07 | 武汉斗鱼网络科技有限公司 | Title bar setting method and device |
CN110245315B (en) * | 2019-06-24 | 2021-09-03 | 北京向上一心科技有限公司 | Method, device, controller and storage medium for simulating APP title bar in webpage |
CN111209070B (en) * | 2020-01-06 | 2023-09-26 | 杭州涂鸦信息技术有限公司 | Linear gradual-change color-taking method for WEB end |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7448042B1 (en) * | 2003-05-06 | 2008-11-04 | Apple Inc. | Method and apparatus for providing inter-application accessibility |
US7539945B2 (en) * | 1993-06-11 | 2009-05-26 | Apple Inc. | Computer system with graphical user interface including drawer-like windows |
CN101504658A (en) * | 2009-01-23 | 2009-08-12 | 北京搜狗科技发展有限公司 | Method and system for implementing message interaction in multi-tag application program |
CN101639772A (en) * | 2008-07-31 | 2010-02-03 | 国际商业机器公司 | Method and device for generating window title |
CN102012820A (en) * | 2010-12-07 | 2011-04-13 | 福州锐达数码科技有限公司 | Method for realizing virtual page in Windows operating system |
-
2012
- 2012-02-13 CN CN201210031587.3A patent/CN103246505B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7539945B2 (en) * | 1993-06-11 | 2009-05-26 | Apple Inc. | Computer system with graphical user interface including drawer-like windows |
US7448042B1 (en) * | 2003-05-06 | 2008-11-04 | Apple Inc. | Method and apparatus for providing inter-application accessibility |
CN101639772A (en) * | 2008-07-31 | 2010-02-03 | 国际商业机器公司 | Method and device for generating window title |
CN101504658A (en) * | 2009-01-23 | 2009-08-12 | 北京搜狗科技发展有限公司 | Method and system for implementing message interaction in multi-tag application program |
CN102012820A (en) * | 2010-12-07 | 2011-04-13 | 福州锐达数码科技有限公司 | Method for realizing virtual page in Windows operating system |
Non-Patent Citations (1)
Title |
---|
《Android中将布局文件/View添加至窗口过程分析 ---- 从setContentView()谈起》;qinjuning;《 http://blog.csdn.net/qinjuning/article/details/7226787》;20120201;第1、3、10-11,13页 * |
Also Published As
Publication number | Publication date |
---|---|
CN103246505A (en) | 2013-08-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104007893B (en) | For providing the method and apparatus of user interface in portable terminal | |
CN103077361B (en) | Mobile terminal and peep-proof method thereof | |
CN104090714B (en) | A kind of mobile terminal checks the method and system of chat record | |
CN104024982B (en) | The method and apparatus that electronic mail user interface is presented | |
US20140089842A1 (en) | Method and device for interface display | |
CN104424359B (en) | For providing the electronic equipment of content and method according to field attribute | |
CN104238896B (en) | The display methods and device of function menu | |
CN103389868B (en) | A kind of method, apparatus and touch screen terminal of touch-control unlock | |
CN103106039B (en) | The page switching method and device of a kind of mobile terminal | |
CN105393202B (en) | Method for providing the portable equipment of combined user interface component and controlling it | |
CN104391625A (en) | Chat display method and device | |
WO2017031831A1 (en) | Message reminding and displaying method applied to multi-user intelligent mobile terminal | |
CN103593138A (en) | Method for operating mobile terminal with one hand and mobile terminal | |
KR20140051230A (en) | Launcher for context based menus | |
CN103246505B (en) | The creation method and device of a kind of window title bar | |
JP6448639B2 (en) | Text selection method, apparatus and terminal | |
CN104750393B (en) | Wallpaper method to set up and device | |
CN107181858A (en) | A kind of method and terminal for showing notification message | |
WO2017177833A1 (en) | Information display method and apparatus | |
CN103714301A (en) | Password input method and device | |
CN107682524A (en) | A kind of information displaying method and device, terminal and readable storage medium storing program for executing | |
CN105094553B (en) | A kind of implementation method of sub-menu bar special efficacy | |
CN104111799B (en) | Gesture reminding method in screen locking state | |
CN108415644A (en) | A kind of display control method and electronic equipment | |
CN105224221B (en) | A kind of terminal device and labeling method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |